mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-06-12 09:20:14 +00:00
add type defs for community automatic review
This commit is contained in:
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
import type { AnyEntry, FilePathWithPrefix } from "@lib/common/models/db.type";
|
||||
import type { IMinimumLiveSyncCommands, LiveSyncBaseCore } from "@/LiveSyncBaseCore";
|
||||
import type { ServiceContext } from "@lib/services/base/ServiceBase";
|
||||
export declare abstract class AbstractModule<T extends LiveSyncBaseCore<ServiceContext, IMinimumLiveSyncCommands> = LiveSyncBaseCore<ServiceContext, IMinimumLiveSyncCommands>> {
|
||||
core: T;
|
||||
_log: (msg: unknown, level?: import("octagonal-wheels/common/logger").LOG_LEVEL, key?: string) => void;
|
||||
get services(): import("../lib/src/services/InjectableServices").InjectableServiceHub<ServiceContext>;
|
||||
addCommand: <TCommand extends import("../lib/src/services/base/IService").ICommandCompat>(command: TCommand) => TCommand;
|
||||
registerView: (type: string, factory: (leaf: any) => any) => void;
|
||||
addRibbonIcon: (icon: string, title: string, callback: (evt: MouseEvent) => any) => HTMLElement;
|
||||
registerObsidianProtocolHandler: (action: string, handler: (params: Record<string, string>) => any) => void;
|
||||
get localDatabase(): import("../lib/src/pouchdb/LiveSyncLocalDB").LiveSyncLocalDB;
|
||||
get settings(): import("../lib/src/common/types").ObsidianLiveSyncSettings;
|
||||
set settings(value: import("../lib/src/common/types").ObsidianLiveSyncSettings);
|
||||
getPath(entry: AnyEntry): FilePathWithPrefix;
|
||||
getPathWithoutPrefix(entry: AnyEntry): FilePathWithPrefix;
|
||||
onBindFunction(core: T, services: typeof core.services): void;
|
||||
constructor(core: T);
|
||||
saveSettings: () => Promise<void>;
|
||||
addTestResult(key: string, value: boolean, summary?: string, message?: string): void;
|
||||
testDone(result?: boolean): Promise<boolean>;
|
||||
testFail(message: string): Promise<boolean>;
|
||||
_test(key: string, process: () => Promise<unknown>): Promise<boolean>;
|
||||
isMainReady(): boolean;
|
||||
isMainSuspended(): boolean;
|
||||
isDatabaseReady(): boolean;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import type { Prettify } from "@lib/common/models/shared.type.util";
|
||||
import type { LiveSyncCore } from "@/main";
|
||||
import type ObsidianLiveSyncPlugin from "@/main";
|
||||
import { AbstractModule } from "./AbstractModule.ts";
|
||||
import type { ChainableExecuteFunction, OverridableFunctionsKeys } from "./ModuleTypes";
|
||||
export type IObsidianModuleBase = OverridableFunctionsKeys<ObsidianLiveSyncPlugin>;
|
||||
export type IObsidianModule = Prettify<Partial<IObsidianModuleBase>>;
|
||||
export type ModuleKeys = keyof IObsidianModule;
|
||||
export type ChainableModuleProps = ChainableExecuteFunction<ObsidianLiveSyncPlugin>;
|
||||
export declare abstract class AbstractObsidianModule extends AbstractModule {
|
||||
plugin: ObsidianLiveSyncPlugin;
|
||||
get app(): import("obsidian").App;
|
||||
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore);
|
||||
isThisModuleEnabled(): boolean;
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
import type { Prettify } from "@lib/common/models/shared.type.util";
|
||||
import type { LiveSyncCore } from "@/main";
|
||||
export type OverridableFunctionsKeys<T> = {
|
||||
[K in keyof T as K extends `$${string}` ? K : never]: T[K];
|
||||
};
|
||||
export type ChainableExecuteFunction<T> = {
|
||||
[K in keyof T as K extends `$${string}` ? T[K] extends (...args: any) => ChainableFunctionResult ? K : never : never]: T[K];
|
||||
};
|
||||
export type ICoreModuleBase = OverridableFunctionsKeys<LiveSyncCore>;
|
||||
export type ICoreModule = Prettify<Partial<ICoreModuleBase>>;
|
||||
export type CoreModuleKeys = keyof ICoreModule;
|
||||
export type ChainableFunctionResult = Promise<boolean | undefined | string> | Promise<boolean | undefined> | Promise<boolean> | Promise<void>;
|
||||
export type ChainableFunctionResultOrAll = Promise<boolean | undefined | string | void>;
|
||||
type AllExecuteFunction<T> = {
|
||||
[K in keyof T as K extends `$all${string}` ? T[K] extends (...args: any[]) => ChainableFunctionResultOrAll ? K : never : never]: T[K];
|
||||
};
|
||||
type EveryExecuteFunction<T> = {
|
||||
[K in keyof T as K extends `$every${string}` ? T[K] extends (...args: any[]) => ChainableFunctionResult ? K : never : never]: T[K];
|
||||
};
|
||||
type AnyExecuteFunction<T> = {
|
||||
[K in keyof T as K extends `$any${string}` ? T[K] extends (...args: any[]) => ChainableFunctionResult ? K : never : never]: T[K];
|
||||
};
|
||||
type InjectableFunction<T> = {
|
||||
[K in keyof T as K extends `$$${string}` ? (T[K] extends (...args: any[]) => any ? K : never) : never]: T[K];
|
||||
};
|
||||
export type AllExecuteProps = AllExecuteFunction<LiveSyncCore>;
|
||||
export type EveryExecuteProps = EveryExecuteFunction<LiveSyncCore>;
|
||||
export type AnyExecuteProps = AnyExecuteFunction<LiveSyncCore>;
|
||||
export type AllInjectableProps = InjectableFunction<LiveSyncCore>;
|
||||
export {};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { PeriodicProcessor } from "@/common/PeriodicProcessor";
|
||||
import type { LiveSyncCore } from "@/main";
|
||||
import { AbstractModule } from "@/modules/AbstractModule";
|
||||
export declare class ModulePeriodicProcess extends AbstractModule {
|
||||
periodicSyncProcessor: PeriodicProcessor;
|
||||
disablePeriodic(): Promise<boolean>;
|
||||
resumePeriodic(): Promise<boolean>;
|
||||
private _allOnUnload;
|
||||
private _everyBeforeRealizeSetting;
|
||||
private _everyBeforeSuspendProcess;
|
||||
private _everyAfterResumeProcess;
|
||||
private _everyAfterRealizeSetting;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { AbstractModule } from "@/modules/AbstractModule";
|
||||
import type { EntryDoc } from "@lib/common/models/db.definition";
|
||||
import type { RemoteType } from "@lib/common/models/setting.type";
|
||||
import type { LiveSyncCore } from "@/main";
|
||||
import { ReplicateResultProcessor } from "./ReplicateResultProcessor";
|
||||
export declare class ModuleReplicator extends AbstractModule {
|
||||
_replicatorType?: RemoteType;
|
||||
processor: ReplicateResultProcessor;
|
||||
private _unresolvedErrorManager;
|
||||
clearErrors(): void;
|
||||
private _everyOnloadAfterLoadSettings;
|
||||
_onReplicatorInitialised(): Promise<boolean>;
|
||||
_everyOnDatabaseInitialized(showNotice: boolean): Promise<boolean>;
|
||||
_everyBeforeReplicate(showMessage: boolean): Promise<boolean>;
|
||||
/**
|
||||
* obsolete method. No longer maintained and will be removed in the future.
|
||||
* @deprecated v0.24.17
|
||||
* @param showMessage If true, show message to the user.
|
||||
*/
|
||||
cleaned(showMessage: boolean): Promise<void>;
|
||||
private onReplicationFailed;
|
||||
_parseReplicationResult(docs: Array<PouchDB.Core.ExistingDocument<EntryDoc>>): Promise<boolean>;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { RemoteDBSettings } from "@lib/common/models/setting.type";
|
||||
import type { LiveSyncAbstractReplicator } from "@lib/replication/LiveSyncAbstractReplicator";
|
||||
import { AbstractModule } from "@/modules/AbstractModule";
|
||||
import type { LiveSyncCore } from "@/main";
|
||||
export declare class ModuleReplicatorCouchDB extends AbstractModule {
|
||||
_anyNewReplicator(settingOverride?: Partial<RemoteDBSettings>): Promise<LiveSyncAbstractReplicator | false>;
|
||||
_everyAfterResumeProcess(): Promise<boolean>;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { RemoteDBSettings } from "@lib/common/models/setting.type";
|
||||
import type { LiveSyncAbstractReplicator } from "@lib/replication/LiveSyncAbstractReplicator";
|
||||
import type { LiveSyncCore } from "@/main";
|
||||
import { AbstractModule } from "@/modules/AbstractModule";
|
||||
export declare class ModuleReplicatorMinIO extends AbstractModule {
|
||||
_anyNewReplicator(settingOverride?: Partial<RemoteDBSettings>): Promise<LiveSyncAbstractReplicator | false>;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
import type { AnyEntry, LoadedEntry, MetaEntry } from "@lib/common/models/db.type";
|
||||
import type { EntryDoc } from "@lib/common/models/db.definition";
|
||||
import type { ModuleReplicator } from "./ModuleReplicator";
|
||||
import type { ReactiveSource } from "octagonal-wheels/dataobject/reactive_v2";
|
||||
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore";
|
||||
export declare class ReplicateResultProcessor {
|
||||
private log;
|
||||
private logError;
|
||||
private replicator;
|
||||
constructor(replicator: ModuleReplicator);
|
||||
get localDatabase(): import("../../lib/src/pouchdb/LiveSyncLocalDB").LiveSyncLocalDB;
|
||||
get services(): import("../../lib/src/services/InjectableServices").InjectableServiceHub<import("../../lib/src/services/base/ServiceBase").ServiceContext>;
|
||||
get core(): LiveSyncBaseCore;
|
||||
getPath(entry: AnyEntry): string;
|
||||
suspend(): void;
|
||||
resume(): void;
|
||||
private _suspended;
|
||||
get isSuspended(): boolean;
|
||||
/**
|
||||
* Take a snapshot of the current processing state.
|
||||
* This snapshot is stored in the KV database for recovery on restart.
|
||||
*/
|
||||
protected _takeSnapshot(): Promise<void>;
|
||||
/**
|
||||
* Trigger taking a snapshot.
|
||||
*/
|
||||
protected _triggerTakeSnapshot(): void;
|
||||
/**
|
||||
* Throttled version of triggerTakeSnapshot.
|
||||
*/
|
||||
protected triggerTakeSnapshot: import("octagonal-wheels/function").ThrottledFunction<() => void>;
|
||||
/**
|
||||
* Restore from snapshot.
|
||||
*/
|
||||
restoreFromSnapshot(): Promise<void>;
|
||||
private _restoreFromSnapshot;
|
||||
/**
|
||||
* Restore from snapshot only once.
|
||||
* @returns Promise that resolves when restoration is complete.
|
||||
*/
|
||||
restoreFromSnapshotOnce(): Promise<void>;
|
||||
/**
|
||||
* Perform the given procedure while counting the concurrency.
|
||||
* @param proc async procedure to perform
|
||||
* @param countValue reactive source to count concurrency
|
||||
* @returns result of the procedure
|
||||
*/
|
||||
withCounting<T>(proc: () => Promise<T>, countValue: ReactiveSource<number>): Promise<T>;
|
||||
/**
|
||||
* Report the current status.
|
||||
*/
|
||||
protected reportStatus(): void;
|
||||
/**
|
||||
* Enqueue all the given changes for processing.
|
||||
* @param changes Changes to enqueue
|
||||
*/
|
||||
enqueueAll(changes: PouchDB.Core.ExistingDocument<EntryDoc>[]): void;
|
||||
/**
|
||||
* Process the change if it is not a document change.
|
||||
* @param change Change to process
|
||||
* @returns True if the change was processed; false otherwise
|
||||
*/
|
||||
protected processIfNonDocumentChange(change: PouchDB.Core.ExistingDocument<EntryDoc>): boolean;
|
||||
/**
|
||||
* Queue of changes to be processed.
|
||||
*/
|
||||
private _queuedChanges;
|
||||
/**
|
||||
* List of changes being processed.
|
||||
*/
|
||||
private _processingChanges;
|
||||
/**
|
||||
* Enqueue the given document change for processing.
|
||||
* @param doc Document change to enqueue
|
||||
* @returns
|
||||
*/
|
||||
protected enqueueChange(doc: PouchDB.Core.ExistingDocument<EntryDoc>): void;
|
||||
/**
|
||||
* Trigger processing of the queued changes.
|
||||
*/
|
||||
protected triggerProcessQueue(): void;
|
||||
/**
|
||||
* Semaphore to limit concurrent processing.
|
||||
* This is the per-id semaphore + concurrency-control (max 10 concurrent = 10 documents being processed at the same time).
|
||||
*/
|
||||
private _semaphore;
|
||||
/**
|
||||
* Flag indicating whether the process queue is currently running.
|
||||
*/
|
||||
private _isRunningProcessQueue;
|
||||
/**
|
||||
* Process the queued changes.
|
||||
*/
|
||||
private runProcessQueue;
|
||||
/**
|
||||
* Parse the given document change.
|
||||
* @param change
|
||||
* @returns
|
||||
*/
|
||||
parseDocumentChange(change: PouchDB.Core.ExistingDocument<EntryDoc>): Promise<void>;
|
||||
protected applyToDatabase(doc: PouchDB.Core.ExistingDocument<AnyEntry>): Promise<void>;
|
||||
private _applyToDatabase;
|
||||
/**
|
||||
* Phase 3: Apply the given entry to storage.
|
||||
* @param entry
|
||||
* @returns
|
||||
*/
|
||||
protected applyToStorage(entry: MetaEntry): Promise<void>;
|
||||
/**
|
||||
* Check whether processing is required for the given document.
|
||||
* @param dbDoc Document to check
|
||||
* @returns True if processing is required; false otherwise
|
||||
*/
|
||||
protected checkIsChangeRequiredForDatabaseProcessing(dbDoc: LoadedEntry): Promise<boolean>;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { AbstractModule } from "@/modules/AbstractModule.ts";
|
||||
import type { FilePathWithPrefix } from "@lib/common/models/db.type";
|
||||
import { QueueProcessor } from "octagonal-wheels/concurrency/processor";
|
||||
import type { InjectableServiceHub } from "@lib/services/InjectableServices.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare class ModuleConflictChecker extends AbstractModule {
|
||||
_queueConflictCheckIfOpen(file: FilePathWithPrefix): Promise<void>;
|
||||
_queueConflictCheck(file: FilePathWithPrefix): Promise<void>;
|
||||
_waitForAllConflictProcessed(): Promise<boolean>;
|
||||
conflictResolveQueue: QueueProcessor<FilePathWithPrefix, unknown>;
|
||||
conflictCheckQueue: QueueProcessor<FilePathWithPrefix, FilePathWithPrefix>;
|
||||
onBindFunction(core: LiveSyncCore, services: InjectableServiceHub): void;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { AbstractModule } from "@/modules/AbstractModule.ts";
|
||||
import type { diff_check_result } from "@lib/common/models/diff.definition";
|
||||
import type { FilePathWithPrefix } from "@lib/common/models/db.type";
|
||||
import type { InjectableServiceHub } from "@lib/services/InjectableServices.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
declare global {
|
||||
interface LSEvents {
|
||||
"conflict-cancelled": FilePathWithPrefix;
|
||||
}
|
||||
}
|
||||
export declare class ModuleConflictResolver extends AbstractModule {
|
||||
private _resolveConflictByDeletingRev;
|
||||
checkConflictAndPerformAutoMerge(path: FilePathWithPrefix): Promise<diff_check_result>;
|
||||
private _resolveConflict;
|
||||
private _anyResolveConflictByNewest;
|
||||
private _resolveAllConflictedFilesByNewerOnes;
|
||||
onBindFunction(core: LiveSyncCore, services: InjectableServiceHub): void;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { TweakValues } from "@lib/common/models/tweak.definition";
|
||||
import type { ObsidianLiveSyncSettings, RemoteDBSettings } from "@lib/common/models/setting.type";
|
||||
import { AbstractModule } from "@/modules/AbstractModule.ts";
|
||||
import type { InjectableServiceHub } from "@lib/services/InjectableServices.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare class ModuleResolvingMismatchedTweaks extends AbstractModule {
|
||||
private _hasNotifiedAutoAcceptCompatibleUndefined;
|
||||
private _collectMismatchedTweakKeys;
|
||||
private _selectNewerTweakSide;
|
||||
private _shouldAutoAcceptCompatibleLossy;
|
||||
/**
|
||||
* Hook before saving settings, to check if there are changes in tweak values, and if so,
|
||||
* update the tweakModified timestamp to current time.
|
||||
* This allows other devices to know that the tweak values have been changed and decide whether to accept the new values based on the modification time.
|
||||
* @param next
|
||||
* @param previous
|
||||
* @returns
|
||||
*/
|
||||
_onBeforeSaveSettingData(next: ObsidianLiveSyncSettings, previous: ObsidianLiveSyncSettings): Promise<{
|
||||
tweakModified: number;
|
||||
} | undefined>;
|
||||
_anyAfterConnectCheckFailed(): Promise<boolean | "CHECKAGAIN" | undefined>;
|
||||
_checkAndAskResolvingMismatchedTweaks(preferred: TweakValues): Promise<[TweakValues | boolean, boolean]>;
|
||||
_askResolvingMismatchedTweaks(): Promise<"OK" | "CHECKAGAIN" | "IGNORE">;
|
||||
_fetchRemotePreferredTweakValues(trialSetting: RemoteDBSettings): Promise<TweakValues | false>;
|
||||
_checkAndAskUseRemoteConfiguration(trialSetting: RemoteDBSettings): Promise<{
|
||||
result: false | TweakValues;
|
||||
requireFetch: boolean;
|
||||
}>;
|
||||
_askUseRemoteConfiguration(trialSetting: RemoteDBSettings, preferred: TweakValues): Promise<{
|
||||
result: false | TweakValues;
|
||||
requireFetch: boolean;
|
||||
}>;
|
||||
onBindFunction(core: LiveSyncCore, services: InjectableServiceHub): void;
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
import { ButtonComponent } from "@/deps.ts";
|
||||
import { App, FuzzySuggestModal, Modal, Plugin } from "@/deps.ts";
|
||||
import { type CompatIntervalHandle } from "@lib/common/coreEnvFunctions.ts";
|
||||
declare class AutoClosableModal extends Modal {
|
||||
_closeByUnload(): void;
|
||||
constructor(app: App);
|
||||
onClose(): void;
|
||||
}
|
||||
export declare class InputStringDialog extends AutoClosableModal {
|
||||
result: string | false;
|
||||
onSubmit: (result: string | false) => void;
|
||||
title: string;
|
||||
key: string;
|
||||
placeholder: string;
|
||||
isManuallyClosed: boolean;
|
||||
isPassword: boolean;
|
||||
constructor(app: App, title: string, key: string, placeholder: string, isPassword: boolean, onSubmit: (result: string | false) => void);
|
||||
onOpen(): void;
|
||||
onClose(): void;
|
||||
}
|
||||
export declare class PopoverSelectString extends FuzzySuggestModal<string> {
|
||||
_app: App;
|
||||
callback: ((e: string) => void) | undefined;
|
||||
getItemsFun: () => string[];
|
||||
constructor(app: App, note: string, placeholder: string | undefined, getItemsFun: (() => string[]) | undefined, callback: (e: string) => void);
|
||||
getItems(): string[];
|
||||
getItemText(item: string): string;
|
||||
onChooseItem(item: string, evt: MouseEvent | KeyboardEvent): void;
|
||||
onClose(): void;
|
||||
}
|
||||
export declare class MessageBox<T extends readonly string[]> extends AutoClosableModal {
|
||||
plugin: Plugin;
|
||||
title: string;
|
||||
contentMd: string;
|
||||
buttons: T;
|
||||
result: string | false;
|
||||
isManuallyClosed: boolean;
|
||||
defaultAction: string | undefined;
|
||||
timeout: number | undefined;
|
||||
timer: CompatIntervalHandle | undefined;
|
||||
defaultButtonComponent: ButtonComponent | undefined;
|
||||
wideButton: boolean;
|
||||
onSubmit: (result: string | false) => void;
|
||||
constructor(plugin: Plugin, title: string, contentMd: string, buttons: T, defaultAction: T[number], timeout: number | undefined, wideButton: boolean, onSubmit: (result: T[number] | false) => void);
|
||||
onOpen(): void;
|
||||
onClose(): void;
|
||||
}
|
||||
export declare function confirmWithMessage<T extends readonly string[]>(plugin: Plugin, title: string, contentMd: string, buttons: T, defaultAction: T[number], timeout?: number): Promise<T[number] | false>;
|
||||
export declare function confirmWithMessageWithWideButton<T extends readonly string[]>(plugin: Plugin, title: string, contentMd: string, buttons: T, defaultAction: T[number], timeout?: number): Promise<T[number] | false>;
|
||||
export declare const askYesNo: (app: App, message: string) => Promise<"yes" | "no">;
|
||||
export declare const askSelectString: (app: App, message: string, items: string[]) => Promise<string>;
|
||||
export declare const askString: (app: App, title: string, key: string, placeholder: string, isPassword?: boolean) => Promise<string | false>;
|
||||
export {};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { TFile, type TAbstractFile, type TFolder } from "@/deps.ts";
|
||||
import type { FilePathWithPrefix } from "@lib/common/models/db.type";
|
||||
import type { UXFileInfo, UXFileInfoStub, UXFolderInfo, UXInternalFileInfoStub } from "@lib/common/models/fileaccess.type";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
import type { FileAccessObsidian } from "@/serviceModules/FileAccessObsidian.ts";
|
||||
export declare function TFileToUXFileInfo(core: LiveSyncCore, file: TFile, prefix?: string, deleted?: boolean): Promise<UXFileInfo>;
|
||||
export declare function InternalFileToUXFileInfo(fullPath: string, vaultAccess: FileAccessObsidian, prefix?: string): Promise<UXFileInfo>;
|
||||
export declare function TFileToUXFileInfoStub(file: TFile | TAbstractFile, deleted?: boolean): UXFileInfoStub;
|
||||
export declare function InternalFileToUXFileInfoStub(filename: FilePathWithPrefix, deleted?: boolean): UXInternalFileInfoStub;
|
||||
export declare function TFolderToUXFileInfoStub(file: TFolder): UXFolderInfo;
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { LiveSyncCore } from "@/main";
|
||||
import { AbstractModule } from "@/modules/AbstractModule";
|
||||
export declare class ModuleBasicMenu extends AbstractModule {
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { AbstractModule } from "@/modules/AbstractModule.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare class ModuleMigration extends AbstractModule {
|
||||
migrateUsingDoctor(skipRebuild?: boolean, activateReason?: string, forceRescan?: boolean): Promise<boolean>;
|
||||
migrateDisableBulkSend(): Promise<void>;
|
||||
initialMessage(): Promise<boolean>;
|
||||
askAgainForSetupURI(): Promise<boolean>;
|
||||
hasIncompleteDocs(force?: boolean): Promise<boolean>;
|
||||
hasCompromisedChunks(): Promise<boolean>;
|
||||
_everyOnFirstInitialize(): Promise<boolean>;
|
||||
_everyOnLayoutReady(): Promise<boolean>;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { FetchHttpHandler, type FetchHttpHandlerOptions } from "@smithy/fetch-http-handler";
|
||||
import { HttpRequest, HttpResponse, type HttpHandlerOptions } from "@smithy/protocol-http";
|
||||
/**
|
||||
* This is close to origin implementation of FetchHttpHandler
|
||||
* https://github.com/aws/aws-sdk-js-v3/blob/main/packages/fetch-http-handler/src/fetch-http-handler.ts
|
||||
* that is released under Apache 2 License.
|
||||
* But this uses Obsidian requestUrl instead.
|
||||
*/
|
||||
export declare class ObsHttpHandler extends FetchHttpHandler {
|
||||
requestTimeoutInMs: number | undefined;
|
||||
reverseProxyNoSignUrl: string | undefined;
|
||||
constructor(options?: FetchHttpHandlerOptions, reverseProxyNoSignUrl?: string);
|
||||
handle(request: HttpRequest, { abortSignal }?: HttpHandlerOptions): Promise<{
|
||||
response: HttpResponse;
|
||||
}>;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { AbstractObsidianModule } from "@/modules/AbstractObsidianModule.ts";
|
||||
import { type TFile } from "@/deps.ts";
|
||||
import { type ReactiveSource } from "octagonal-wheels/dataobject/reactive";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare class ModuleObsidianEvents extends AbstractObsidianModule {
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
__performAppReload(): void;
|
||||
initialCallback: (() => unknown) | undefined;
|
||||
swapSaveCommand(): void;
|
||||
registerWatchEvents(): void;
|
||||
hasFocus: boolean;
|
||||
isLastHidden: boolean;
|
||||
setHasFocus(hasFocus: boolean): void;
|
||||
watchWindowVisibility(): void;
|
||||
watchOnline(): void;
|
||||
watchOnlineAsync(): Promise<void>;
|
||||
watchWindowVisibilityAsync(): Promise<void>;
|
||||
watchWorkspaceOpen(file: TFile | null): void;
|
||||
watchWorkspaceOpenAsync(file: TFile): Promise<void>;
|
||||
_everyOnLayoutReady(): Promise<boolean>;
|
||||
private _askReload;
|
||||
_totalProcessingCount?: ReactiveSource<number>;
|
||||
private _scheduleAppReload;
|
||||
_isReloadingScheduled(): boolean;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
import { AbstractModule } from "@/modules/AbstractModule.ts";
|
||||
export declare class ModuleObsidianMenu extends AbstractModule {
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
import { AbstractObsidianModule } from "@/modules/AbstractObsidianModule.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare class ModuleDev extends AbstractObsidianModule {
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
onMissingTranslation(key: string): Promise<void>;
|
||||
private _everyOnloadAfterLoadSettings;
|
||||
_everyOnLayoutReady(): Promise<boolean>;
|
||||
testResults: import("svelte/store").Writable<[boolean, string, string][]>;
|
||||
private _addTestResult;
|
||||
private _everyModuleTest;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { ItemView, WorkspaceLeaf } from "@/deps.ts";
|
||||
import TestPaneComponent from "./TestPane.svelte";
|
||||
import type ObsidianLiveSyncPlugin from "@/main.ts";
|
||||
import type { ModuleDev } from "@/modules/extras/ModuleDev.ts";
|
||||
export declare const VIEW_TYPE_TEST = "ols-pane-test";
|
||||
declare global {
|
||||
interface LSEvents {
|
||||
"debug-sync-status": string[];
|
||||
}
|
||||
}
|
||||
export declare class TestPaneView extends ItemView {
|
||||
component?: TestPaneComponent;
|
||||
plugin: ObsidianLiveSyncPlugin;
|
||||
moduleDev: ModuleDev;
|
||||
icon: string;
|
||||
title: string;
|
||||
navigation: boolean;
|
||||
getIcon(): string;
|
||||
constructor(leaf: WorkspaceLeaf, plugin: ObsidianLiveSyncPlugin, moduleDev: ModuleDev);
|
||||
getViewType(): string;
|
||||
getDisplayText(): string;
|
||||
onOpen(): Promise<void>;
|
||||
onClose(): Promise<void>;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import type ObsidianLiveSyncPlugin from "@/main.ts";
|
||||
export declare function enableTestFunction(plugin_: ObsidianLiveSyncPlugin): void;
|
||||
export declare function addDebugFileLog(message: unknown, stackLog?: boolean): void;
|
||||
@@ -0,0 +1,69 @@
|
||||
import { TFile, Modal, App } from "@/deps.ts";
|
||||
import type ObsidianLiveSyncPlugin from "@/main.ts";
|
||||
import type { DocumentID, FilePathWithPrefix, LoadedEntry } from "@lib/common/models/db.type";
|
||||
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore.ts";
|
||||
export declare class DocumentHistoryModal extends Modal {
|
||||
plugin: ObsidianLiveSyncPlugin;
|
||||
core: LiveSyncBaseCore;
|
||||
get services(): import("../../../lib/src/services/InjectableServices").InjectableServiceHub<import("../../../lib/src/services/base/ServiceBase").ServiceContext>;
|
||||
range: HTMLInputElement;
|
||||
contentView: HTMLDivElement;
|
||||
info: HTMLDivElement;
|
||||
fileInfo: HTMLDivElement;
|
||||
showDiff: boolean;
|
||||
diffOnly: boolean;
|
||||
id?: DocumentID;
|
||||
file: FilePathWithPrefix;
|
||||
revs_info: PouchDB.Core.RevisionInfo[];
|
||||
currentDoc?: LoadedEntry;
|
||||
currentText: string;
|
||||
currentDeleted: boolean;
|
||||
initialRev?: string;
|
||||
currentDiffIndex: number;
|
||||
diffNavContainer: HTMLDivElement;
|
||||
diffNavIndicator: HTMLSpanElement;
|
||||
diffOnlyLabel: HTMLLabelElement;
|
||||
searchKeyword: string;
|
||||
searchResults: {
|
||||
rev: string;
|
||||
index: number;
|
||||
matchType: "Content" | "Diff";
|
||||
}[];
|
||||
currentSearchIndex: number;
|
||||
searchResultIndicator: HTMLSpanElement;
|
||||
searchProgressIndicator: HTMLSpanElement;
|
||||
searchTimeout: number | null;
|
||||
constructor(app: App, core: LiveSyncBaseCore, plugin: ObsidianLiveSyncPlugin, file: TFile | FilePathWithPrefix, id?: DocumentID, revision?: string);
|
||||
loadFile(initialRev?: string): Promise<void>;
|
||||
loadRevs(initialRev?: string): Promise<void>;
|
||||
BlobURLs: Map<string, string>;
|
||||
revokeURL(key: string): void;
|
||||
generateBlobURL(key: string, data: Uint8Array<ArrayBuffer>): string;
|
||||
prepareContentView(usePreformatted?: boolean): void;
|
||||
appendTextDiff(diff: [number, string][]): void;
|
||||
appendSearchHighlightedText(container: HTMLElement, text: string): void;
|
||||
appendImageDiff(baseSrc: string, overlaySrc?: string): void;
|
||||
appendDeletedNotice(usePreformatted?: boolean): void;
|
||||
showExactRev(rev: string): Promise<void>;
|
||||
/**
|
||||
* Navigate to the previous or next diff block in the content view.
|
||||
* Only effective when diff highlighting is enabled.
|
||||
*/
|
||||
navigateDiff(direction: "prev" | "next"): void;
|
||||
/**
|
||||
* Reset the diff navigation index and update the indicator.
|
||||
*/
|
||||
resetDiffNavigation(): void;
|
||||
/**
|
||||
* Show or hide the diff navigation buttons based on the showDiff state.
|
||||
*/
|
||||
updateDiffNavVisibility(): void;
|
||||
/**
|
||||
* Search through the last 100 revisions for the given keyword.
|
||||
*/
|
||||
performSearch(keyword: string): Promise<void>;
|
||||
updateSearchUI(): void;
|
||||
navigateSearch(direction: "prev" | "next"): void;
|
||||
onOpen(): void;
|
||||
onClose(): void;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { WorkspaceLeaf } from "@/deps.ts";
|
||||
import type ObsidianLiveSyncPlugin from "@/main.ts";
|
||||
import { SvelteItemView } from "@/common/SvelteItemView.ts";
|
||||
export declare const VIEW_TYPE_GLOBAL_HISTORY = "global-history";
|
||||
export declare class GlobalHistoryView extends SvelteItemView {
|
||||
instantiateComponent(target: HTMLElement): {
|
||||
$on?(type: string, callback: (e: any) => void): () => void;
|
||||
$set?(props: Partial<Record<string, any>>): void;
|
||||
} & Record<string, any>;
|
||||
plugin: ObsidianLiveSyncPlugin;
|
||||
icon: string;
|
||||
title: string;
|
||||
navigation: boolean;
|
||||
getIcon(): string;
|
||||
constructor(leaf: WorkspaceLeaf, plugin: ObsidianLiveSyncPlugin);
|
||||
getViewType(): string;
|
||||
getDisplayText(): string;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import { App, Modal } from "@/deps.ts";
|
||||
import { CANCELLED, LEAVE_TO_SUBSEQUENT } from "@lib/common/models/shared.const.symbols";
|
||||
import type { diff_result } from "@lib/common/models/diff.definition";
|
||||
import { eventHub } from "@/common/events.ts";
|
||||
export type MergeDialogResult = typeof CANCELLED | typeof LEAVE_TO_SUBSEQUENT | string;
|
||||
declare global {
|
||||
interface Slips extends LSSlips {
|
||||
"conflict-resolved": typeof CANCELLED | MergeDialogResult;
|
||||
}
|
||||
}
|
||||
export declare class ConflictResolveModal extends Modal {
|
||||
result: diff_result;
|
||||
filename: string;
|
||||
response: MergeDialogResult;
|
||||
isClosed: boolean;
|
||||
consumed: boolean;
|
||||
title: string;
|
||||
pluginPickMode: boolean;
|
||||
localName: string;
|
||||
remoteName: string;
|
||||
offEvent?: ReturnType<typeof eventHub.onEvent>;
|
||||
currentDiffIndex: number;
|
||||
diffView: HTMLDivElement;
|
||||
diffNavIndicator: HTMLSpanElement;
|
||||
constructor(app: App, filename: string, diff: diff_result, pluginPickMode?: boolean, remoteName?: string);
|
||||
appendDiffFragment(container: HTMLDivElement, text: string, cls: string): void;
|
||||
appendVersionInfo(container: HTMLDivElement, cls: string, name: string, date: string): void;
|
||||
navigateDiff(direction: "prev" | "next"): void;
|
||||
resetDiffNavigation(): void;
|
||||
onOpen(): void;
|
||||
sendResponse(result: MergeDialogResult): void;
|
||||
onClose(): void;
|
||||
waitForResult(): Promise<MergeDialogResult>;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import { WorkspaceLeaf } from "@/deps.ts";
|
||||
import type ObsidianLiveSyncPlugin from "@/main.ts";
|
||||
import { SvelteItemView } from "@/common/SvelteItemView.ts";
|
||||
export declare const VIEW_TYPE_LOG = "log-log";
|
||||
export declare class LogPaneView extends SvelteItemView {
|
||||
instantiateComponent(target: HTMLElement): {
|
||||
$on?(type: string, callback: (e: any) => void): () => void;
|
||||
$set?(props: Partial<Record<string, any>>): void;
|
||||
} & Record<string, any>;
|
||||
plugin: ObsidianLiveSyncPlugin;
|
||||
icon: string;
|
||||
title: string;
|
||||
navigation: boolean;
|
||||
getIcon(): string;
|
||||
constructor(leaf: WorkspaceLeaf, plugin: ObsidianLiveSyncPlugin);
|
||||
getViewType(): string;
|
||||
getDisplayText(): import("octagonal-wheels/common/types").TaggedType<string, "logPane.title">;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { AbstractObsidianModule } from "@/modules/AbstractObsidianModule.ts";
|
||||
export declare class ModuleObsidianGlobalHistory extends AbstractObsidianModule {
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
showGlobalHistory(): void;
|
||||
onBindFunction(core: typeof this.core, services: typeof core.services): void;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { FilePathWithPrefix } from "@lib/common/models/db.type";
|
||||
import type { diff_result } from "@lib/common/models/diff.definition";
|
||||
import { AbstractObsidianModule } from "@/modules/AbstractObsidianModule.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare class ModuleInteractiveConflictResolver extends AbstractObsidianModule {
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
_anyResolveConflictByUI(filename: FilePathWithPrefix, conflictCheckResult: diff_result): Promise<boolean>;
|
||||
allConflictCheck(): Promise<void>;
|
||||
pickFileForResolve(): Promise<boolean>;
|
||||
_allScanStat(): Promise<boolean>;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
import { type ReactiveValue } from "octagonal-wheels/dataobject/reactive";
|
||||
import type { LOG_LEVEL } from "@lib/common/logger";
|
||||
import { AbstractObsidianModule } from "@/modules/AbstractObsidianModule.ts";
|
||||
import { Notice } from "@/deps.ts";
|
||||
import { P2PLogCollector } from "@lib/replication/trystero/P2PLogCollector.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare const MARK_DONE = "\u2009\u2009";
|
||||
export declare class ModuleLog extends AbstractObsidianModule {
|
||||
statusBar?: HTMLElement;
|
||||
statusDiv?: HTMLElement;
|
||||
statusLine?: HTMLDivElement;
|
||||
logMessage?: HTMLDivElement;
|
||||
logHistory?: HTMLDivElement;
|
||||
messageArea?: HTMLDivElement;
|
||||
statusBarLabels: ReactiveValue<{
|
||||
message: string;
|
||||
status: string;
|
||||
}>;
|
||||
statusLog: import("octagonal-wheels/dataobject/reactive_v2").ReactiveSource<string>;
|
||||
activeFileStatus: import("octagonal-wheels/dataobject/reactive_v2").ReactiveSource<string>;
|
||||
notifies: {
|
||||
[key: string]: {
|
||||
notice: Notice;
|
||||
count: number;
|
||||
};
|
||||
};
|
||||
p2pLogCollector: P2PLogCollector;
|
||||
observeForLogs(): void;
|
||||
private _everyOnload;
|
||||
adjustStatusDivPosition(): void;
|
||||
getActiveFileStatus(): Promise<string>;
|
||||
setFileStatus(): Promise<void>;
|
||||
updateMessageArea(): Promise<void>;
|
||||
onActiveLeafChange(): void;
|
||||
nextFrameQueue: ReturnType<typeof requestAnimationFrame> | undefined;
|
||||
logLines: {
|
||||
ttl: number;
|
||||
message: string;
|
||||
}[];
|
||||
applyStatusBarText(): void;
|
||||
private _allStartOnUnload;
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
private _everyOnloadAfterLoadSettings;
|
||||
writeLogToTheFile(now: Date, vaultName: string, newMessage: string): void;
|
||||
__addLog(message: unknown, level?: LOG_LEVEL, key?: string): void;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { type TFile } from "@/deps.ts";
|
||||
import type { FilePathWithPrefix, DocumentID } from "@lib/common/models/db.type";
|
||||
import { AbstractObsidianModule } from "@/modules/AbstractObsidianModule.ts";
|
||||
export declare class ModuleObsidianDocumentHistory extends AbstractObsidianModule {
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
showHistory(file: TFile | FilePathWithPrefix, id?: DocumentID): void;
|
||||
fileHistory(): Promise<void>;
|
||||
onBindFunction(core: typeof this.core, services: typeof core.services): void;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
|
||||
import { AbstractModule } from "@/modules/AbstractModule.ts";
|
||||
import type { ServiceContext } from "@lib/services/base/ServiceBase.ts";
|
||||
import type { InjectableServiceHub } from "@lib/services/InjectableServices.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare class ModuleObsidianSettingsAsMarkdown extends AbstractModule {
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
extractSettingFromWholeText(data: string): {
|
||||
preamble: string;
|
||||
body: string;
|
||||
postscript: string;
|
||||
};
|
||||
parseSettingFromMarkdown(filename: string, data?: string): Promise<{
|
||||
preamble: string;
|
||||
body: string;
|
||||
postscript: string;
|
||||
}>;
|
||||
checkAndApplySettingFromMarkdown(filename: string, automated?: boolean): Promise<void>;
|
||||
generateSettingForMarkdown(settings?: ObsidianLiveSyncSettings, keepCredential?: boolean): Partial<ObsidianLiveSyncSettings>;
|
||||
saveSettingToMarkdown(filename: string): Promise<void>;
|
||||
onBindFunction(core: LiveSyncCore, services: InjectableServiceHub<ServiceContext>): void;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { ObsidianLiveSyncSettingTab } from "./SettingDialogue/ObsidianLiveSyncSettingTab.ts";
|
||||
import { AbstractObsidianModule } from "@/modules/AbstractObsidianModule.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare class ModuleObsidianSettingDialogue extends AbstractObsidianModule {
|
||||
settingTab: ObsidianLiveSyncSettingTab;
|
||||
_everyOnloadStart(): Promise<boolean>;
|
||||
openSetting(): void;
|
||||
get appId(): string;
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { Setting, TextComponent, type ToggleComponent, type DropdownComponent, ButtonComponent, type TextAreaComponent, type ValueComponent } from "@/deps.ts";
|
||||
import type { ConfigurationItem } from "@lib/common/models/shared.definition.configNames";
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import { type AllSettingItemKey, type AllSettings, type AllStringItemKey, type AllNumericItemKey, type AllBooleanItemKey } from "./settingConstants.ts";
|
||||
import { type AutoWireOption, type OnUpdateResult } from "./SettingPane.ts";
|
||||
export declare class LiveSyncSetting extends Setting {
|
||||
autoWiredComponent?: TextComponent | ToggleComponent | DropdownComponent | ButtonComponent | TextAreaComponent;
|
||||
applyButtonComponent?: ButtonComponent;
|
||||
selfKey?: AllSettingItemKey;
|
||||
watchDirtyKeys: AllSettingItemKey[];
|
||||
holdValue: boolean;
|
||||
static env: ObsidianLiveSyncSettingTab;
|
||||
descBuf: string | DocumentFragment;
|
||||
nameBuf: string | DocumentFragment;
|
||||
placeHolderBuf: string;
|
||||
hasPassword: boolean;
|
||||
invalidateValue?: () => void;
|
||||
setValue?: (value: unknown) => void;
|
||||
constructor(containerEl: HTMLElement);
|
||||
setDesc(desc: string | DocumentFragment): this;
|
||||
setName(name: string | DocumentFragment): this;
|
||||
setAuto(key: AllSettingItemKey, opt?: AutoWireOption): this;
|
||||
autoWireSetting(key: AllSettingItemKey, opt?: AutoWireOption): {
|
||||
name: string;
|
||||
desc?: string;
|
||||
placeHolder?: string;
|
||||
status?: "BETA" | "ALPHA" | "EXPERIMENTAL";
|
||||
obsolete?: boolean;
|
||||
level?: import("@lib/common/models/shared.definition.configNames").ConfigLevel;
|
||||
isHidden?: boolean;
|
||||
isAdvanced?: boolean;
|
||||
} | undefined;
|
||||
autoWireComponent(component: ValueComponent<any>, conf?: ConfigurationItem, opt?: AutoWireOption): void;
|
||||
commitValue<T extends AllSettingItemKey>(value: AllSettings[T]): Promise<void>;
|
||||
autoWireText(key: AllStringItemKey, opt?: AutoWireOption): this;
|
||||
autoWireTextArea(key: AllStringItemKey, opt?: AutoWireOption): this;
|
||||
autoWireNumeric(key: AllNumericItemKey, opt: AutoWireOption & {
|
||||
clampMin?: number;
|
||||
clampMax?: number;
|
||||
acceptZero?: boolean;
|
||||
}): this;
|
||||
autoWireToggle(key: AllBooleanItemKey, opt?: AutoWireOption): this;
|
||||
autoWireDropDown<T extends string>(key: AllStringItemKey, opt: AutoWireOption & {
|
||||
options: Record<T, string>;
|
||||
}): this;
|
||||
addApplyButton(keys: AllSettingItemKey[], text?: string): this;
|
||||
addOnUpdate(func: () => OnUpdateResult): this;
|
||||
updateHandlers: Set<() => OnUpdateResult>;
|
||||
prevStatus: OnUpdateResult;
|
||||
_getComputedStatus(): OnUpdateResult;
|
||||
_applyOnUpdateHandlers(): void;
|
||||
_onUpdate(): void;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
import { App, PluginSettingTab } from "@/deps.ts";
|
||||
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
|
||||
import type ObsidianLiveSyncPlugin from "@/main.ts";
|
||||
import { type AllSettingItemKey, type AllStringItemKey, type AllNumericItemKey, type AllBooleanItemKey, type AllSettings, OnDialogSettingsDefault, type OnDialogSettings } from "./settingConstants.ts";
|
||||
import { LiveSyncSetting as Setting } from "./LiveSyncSetting.ts";
|
||||
import { JournalSyncMinio } from "@lib/replication/journal/objectstore/JournalSyncMinio.ts";
|
||||
import { type OnSavedHandler, type OnUpdateFunc, type OnUpdateResult, type UpdateFunction } from "./SettingPane.ts";
|
||||
export declare class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||
plugin: ObsidianLiveSyncPlugin;
|
||||
get core(): import("@/main.ts").LiveSyncCore;
|
||||
get services(): import("../../../lib/src/services/InjectableServices.ts").InjectableServiceHub<import("../../../lib/src/services/implements/obsidian/ObsidianServiceContext.ts").ObsidianServiceContext>;
|
||||
selectedScreen: string;
|
||||
_editingSettings?: AllSettings;
|
||||
get editingSettings(): AllSettings;
|
||||
set editingSettings(v: AllSettings);
|
||||
initialSettings?: typeof this.editingSettings;
|
||||
/**
|
||||
* Apply editing setting to the plug-in.
|
||||
* @param keys setting keys for applying
|
||||
*/
|
||||
applySetting(keys: AllSettingItemKey[]): void;
|
||||
applyAllSettings(): void;
|
||||
saveLocalSetting(key: keyof typeof OnDialogSettingsDefault): Promise<void>;
|
||||
/**
|
||||
* Apply and save setting to the plug-in.
|
||||
* @param keys setting keys for applying
|
||||
*/
|
||||
saveSettings(keys: AllSettingItemKey[]): Promise<void>;
|
||||
/**
|
||||
* Apply all editing setting to the plug-in.
|
||||
* @param keys setting keys for applying
|
||||
*/
|
||||
saveAllDirtySettings(): Promise<void>;
|
||||
/**
|
||||
* Invalidate buffered value and fetch the latest.
|
||||
*/
|
||||
requestUpdate(): void;
|
||||
reloadAllLocalSettings(): {
|
||||
configPassphrase: string;
|
||||
preset: "" | "PERIODIC" | "LIVESYNC" | "DISABLE";
|
||||
syncMode: "ONEVENTS" | "PERIODIC" | "LIVESYNC";
|
||||
dummy: number;
|
||||
deviceAndVaultName: string;
|
||||
};
|
||||
computeAllLocalSettings(): Partial<OnDialogSettings>;
|
||||
/**
|
||||
* Reread all settings and request invalidate
|
||||
*/
|
||||
reloadAllSettings(skipUpdate?: boolean): void;
|
||||
/**
|
||||
* Reread each setting and request invalidate
|
||||
*/
|
||||
refreshSetting(key: AllSettingItemKey): void;
|
||||
isDirty(key: AllSettingItemKey): boolean;
|
||||
isSomeDirty(keys: AllSettingItemKey[]): boolean;
|
||||
isConfiguredAs(key: AllStringItemKey, value: string): boolean;
|
||||
isConfiguredAs(key: AllNumericItemKey, value: number): boolean;
|
||||
isConfiguredAs(key: AllBooleanItemKey, value: boolean): boolean;
|
||||
settingComponents: Setting[];
|
||||
controlledElementFunc: UpdateFunction[];
|
||||
onSavedHandlers: OnSavedHandler<any>[];
|
||||
inWizard: boolean;
|
||||
constructor(app: App, plugin: ObsidianLiveSyncPlugin);
|
||||
testConnection(settingOverride?: Partial<ObsidianLiveSyncSettings>): Promise<void>;
|
||||
closeSetting(): void;
|
||||
handleElement(element: HTMLElement, func: OnUpdateFunc): void;
|
||||
createEl<T extends keyof HTMLElementTagNameMap>(el: HTMLElement, tag: T, o?: string | DomElementInfo, callback?: (el: HTMLElementTagNameMap[T]) => void, func?: OnUpdateFunc): HTMLElementTagNameMap[T];
|
||||
addEl<T extends keyof HTMLElementTagNameMap>(el: HTMLElement, tag: T, o?: string | DomElementInfo, callback?: (el: HTMLElementTagNameMap[T]) => void, func?: OnUpdateFunc): Promise<Awaited<HTMLElementTagNameMap[T]>>;
|
||||
addOnSaved<T extends AllSettingItemKey>(key: T, func: (value: AllSettings[T]) => Promise<void> | void): void;
|
||||
resetEditingSettings(): void;
|
||||
hide(): void;
|
||||
isShown: boolean;
|
||||
requestReload(): void;
|
||||
manifestVersion: string;
|
||||
lastVersion: number;
|
||||
screenElements: {
|
||||
[key: string]: HTMLElement[];
|
||||
};
|
||||
changeDisplay(screen: string): void;
|
||||
enableMinimalSetup(): Promise<void>;
|
||||
menuEl?: HTMLElement;
|
||||
addScreenElement(key: string, element: HTMLElement): void;
|
||||
selectPane(event: Event): void;
|
||||
isNeedRebuildLocal(): boolean;
|
||||
isNeedRebuildRemote(): boolean;
|
||||
isAnySyncEnabled(): boolean;
|
||||
enableOnlySyncDisabled: OnUpdateFunc;
|
||||
onlyOnP2POrCouchDB: () => OnUpdateResult;
|
||||
onlyOnCouchDB: () => OnUpdateResult;
|
||||
onlyOnMinIO: () => OnUpdateResult;
|
||||
onlyOnOnlyP2P: () => OnUpdateResult;
|
||||
onlyOnCouchDBOrMinIO: () => OnUpdateResult;
|
||||
checkWorkingPassphrase: () => Promise<boolean>;
|
||||
isPassphraseValid: () => Promise<boolean>;
|
||||
rebuildDB: (method: "localOnly" | "remoteOnly" | "rebuildBothByThisDevice" | "localOnlyWithChunks") => Promise<void>;
|
||||
confirmRebuild(): Promise<void>;
|
||||
display(): void;
|
||||
getMinioJournalSyncClient(): JournalSyncMinio;
|
||||
resetRemoteBucket(): Promise<void>;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function paneAdvanced(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel }: PageFunctions): void;
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
export declare function paneChangeLog(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function paneCustomisationSync(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel }: PageFunctions): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function paneGeneral(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel, addPane }: PageFunctions): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function paneHatch(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel }: PageFunctions): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab";
|
||||
import { type PageFunctions } from "./SettingPane";
|
||||
export declare function paneMaintenance(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel }: PageFunctions): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function panePatches(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel }: PageFunctions): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function panePowerUsers(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel }: PageFunctions): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function paneRemoteConfig(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel, addPane }: PageFunctions): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function paneSelector(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel }: PageFunctions): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function paneSetup(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel, addPane }: PageFunctions): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||
import type { PageFunctions } from "./SettingPane.ts";
|
||||
export declare function paneSyncSettings(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, { addPanel, addPane }: PageFunctions): void;
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { ConfigLevel } from "@lib/common/models/shared.definition.configNames";
|
||||
import type { AllSettingItemKey, AllSettings } from "./settingConstants";
|
||||
export declare const combineOnUpdate: (func1: OnUpdateFunc, func2: OnUpdateFunc) => OnUpdateFunc;
|
||||
export declare const setLevelClass: (el: HTMLElement, level?: ConfigLevel) => void;
|
||||
export declare function setStyle(el: HTMLElement, styleHead: string, condition: () => boolean): void;
|
||||
export declare function visibleOnly(cond: () => boolean): OnUpdateFunc;
|
||||
export declare function enableOnly(cond: () => boolean): OnUpdateFunc;
|
||||
export type OnUpdateResult = {
|
||||
visibility?: boolean;
|
||||
disabled?: boolean;
|
||||
classes?: string[];
|
||||
isCta?: boolean;
|
||||
isWarning?: boolean;
|
||||
};
|
||||
export type OnUpdateFunc = () => OnUpdateResult;
|
||||
export type UpdateFunction = () => void;
|
||||
export type OnSavedHandlerFunc<T extends AllSettingItemKey> = (value: AllSettings[T]) => Promise<void> | void;
|
||||
export type OnSavedHandler<T extends AllSettingItemKey> = {
|
||||
key: T;
|
||||
handler: OnSavedHandlerFunc<T>;
|
||||
};
|
||||
export declare function getLevelStr(level: ConfigLevel): "" | import("octagonal-wheels/common/types").TaggedType<string, "obsidianLiveSyncSettingTab.levelPowerUser"> | import("octagonal-wheels/common/types").TaggedType<string, "obsidianLiveSyncSettingTab.levelAdvanced"> | import("octagonal-wheels/common/types").TaggedType<string, "obsidianLiveSyncSettingTab.levelEdgeCase">;
|
||||
export type AutoWireOption = {
|
||||
placeHolder?: string;
|
||||
holdValue?: boolean;
|
||||
isPassword?: boolean;
|
||||
invert?: boolean;
|
||||
onUpdate?: OnUpdateFunc;
|
||||
obsolete?: boolean;
|
||||
};
|
||||
export declare function findAttrFromParent(el: HTMLElement, attr: string): string;
|
||||
export declare function wrapMemo<T>(func: (arg: T) => void): (arg: T) => void;
|
||||
export type PageFunctions = {
|
||||
addPane: (parentEl: HTMLElement, title: string, icon: string, order: number, wizardHidden: boolean, level?: ConfigLevel) => Promise<HTMLDivElement>;
|
||||
addPanel: (parentEl: HTMLElement, title: string, callback?: (el: HTMLDivElement) => void, func?: OnUpdateFunc, level?: ConfigLevel) => Promise<HTMLDivElement>;
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
import { type Component } from "svelte";
|
||||
import { type Writable } from "svelte/store";
|
||||
/**
|
||||
* Props passed to Svelte panels, containing a writable port
|
||||
* to communicate with the panel
|
||||
*/
|
||||
export type SveltePanelProps<T = unknown> = {
|
||||
port: Writable<T | undefined>;
|
||||
};
|
||||
/**
|
||||
* A class to manage a Svelte panel within Obsidian
|
||||
* Especially useful for settings panels
|
||||
*/
|
||||
export declare class SveltePanel<T = unknown> {
|
||||
private _mountedComponent;
|
||||
private _componentValue;
|
||||
/**
|
||||
* Creates a Svelte panel instance
|
||||
* @param component Component to mount
|
||||
* @param mountTo HTMLElement to mount the component to
|
||||
* @param valueStore Optional writable store to bind to the component's port, if not provided a new one will be created
|
||||
* @returns The SveltePanel instance
|
||||
*/
|
||||
constructor(component: Component<SveltePanelProps<T>>, mountTo: HTMLElement, valueStore?: Writable<T>);
|
||||
/**
|
||||
* Destroys the Svelte panel instance by unmounting the component
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* Gets or sets the current value of the component's port
|
||||
*/
|
||||
get componentValue(): T | undefined;
|
||||
set componentValue(value: T | undefined);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
|
||||
export declare function syncActivatedRemoteSettings(target: Partial<ObsidianLiveSyncSettings>, source: ObsidianLiveSyncSettings): void;
|
||||
@@ -0,0 +1 @@
|
||||
export * from "@lib/common/settingConstants.ts";
|
||||
@@ -0,0 +1,57 @@
|
||||
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
|
||||
/**
|
||||
* Generates a summary of P2P configuration settings
|
||||
* @param setting Settings object
|
||||
* @param additional Additional summary information to include
|
||||
* @param showAdvanced Whether to include advanced settings
|
||||
* @returns Summary object
|
||||
*/
|
||||
export declare function getP2PConfigSummary(setting: ObsidianLiveSyncSettings, additional?: Record<string, string>, showAdvanced?: boolean): {
|
||||
[x: string]: string;
|
||||
};
|
||||
/**
|
||||
* Generates a summary of Object Storage configuration settings
|
||||
* @param setting Settings object
|
||||
* @param showAdvanced Whether to include advanced settings
|
||||
* @returns Summary object
|
||||
*/
|
||||
export declare function getBucketConfigSummary(setting: ObsidianLiveSyncSettings, showAdvanced?: boolean): Record<string, string>;
|
||||
/**
|
||||
* Generates a summary of CouchDB configuration settings
|
||||
* @param setting Settings object
|
||||
* @param showAdvanced Whether to include advanced settings
|
||||
* @returns Summary object
|
||||
*/
|
||||
export declare function getCouchDBConfigSummary(setting: ObsidianLiveSyncSettings, showAdvanced?: boolean): Record<string, string>;
|
||||
/**
|
||||
* Generates a summary of E2EE configuration settings
|
||||
* @param setting Settings object
|
||||
* @param showAdvanced Whether to include advanced settings
|
||||
* @returns Summary object
|
||||
*/
|
||||
export declare function getE2EEConfigSummary(setting: ObsidianLiveSyncSettings, showAdvanced?: boolean): Record<string, string>;
|
||||
/**
|
||||
* Converts partial settings into a summary object
|
||||
* @param setting Partial settings object
|
||||
* @param showAdvanced Whether to include advanced settings
|
||||
* @returns Summary object
|
||||
*/
|
||||
export declare function getSummaryFromPartialSettings(setting: Partial<ObsidianLiveSyncSettings>, showAdvanced?: boolean): Record<string, string>;
|
||||
/**
|
||||
* Copy document from one database to another for migration purposes
|
||||
* @param docName document ID
|
||||
* @param dbFrom source database
|
||||
* @param dbTo destination database
|
||||
* @returns
|
||||
*/
|
||||
export declare function copyMigrationDocs(docName: string, dbFrom: PouchDB.Database, dbTo: PouchDB.Database): Promise<void>;
|
||||
type PouchDBOpenFunction = () => Promise<PouchDB.Database> | PouchDB.Database;
|
||||
/**
|
||||
* Migrate databases from one to another
|
||||
* @param operationName Name of the migration operation
|
||||
* @param from source database
|
||||
* @param openTo function to open destination database
|
||||
* @returns True if migration succeeded
|
||||
*/
|
||||
export declare function migrateDatabases(operationName: string, from: PouchDB.Database, openTo: PouchDBOpenFunction): Promise<boolean>;
|
||||
export {};
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
|
||||
import { AbstractModule } from "@/modules/AbstractModule.ts";
|
||||
/**
|
||||
* User modes for onboarding and setup
|
||||
*/
|
||||
export declare const enum UserMode {
|
||||
/**
|
||||
* New User Mode - for users who are new to the plugin
|
||||
*/
|
||||
NewUser = "new-user",
|
||||
/**
|
||||
* Existing User Mode - for users who have used the plugin before, or just configuring again
|
||||
*/
|
||||
ExistingUser = "existing-user",
|
||||
/**
|
||||
* Unknown User Mode - for cases where the user mode is not determined
|
||||
*/
|
||||
Unknown = "unknown",
|
||||
/**
|
||||
* Update User Mode - for users who are updating configuration. May be `existing-user` as well, but possibly they want to treat it differently.
|
||||
*/
|
||||
Update = "unknown"
|
||||
}
|
||||
/**
|
||||
* Setup Manager to handle onboarding and configuration setup
|
||||
*/
|
||||
export declare class SetupManager extends AbstractModule {
|
||||
get dialogManager(): import("../../lib/src/UI/svelteDialog.ts").SvelteDialogManagerBase<import("../../lib/src/services/base/ServiceBase.ts").ServiceContext>;
|
||||
/**
|
||||
* Starts the onboarding process
|
||||
* @returns Promise that resolves to true if onboarding completed successfully, false otherwise
|
||||
*/
|
||||
startOnBoarding(): Promise<boolean>;
|
||||
/**
|
||||
* Handles the onboarding process based on user mode
|
||||
* @param userMode
|
||||
* @returns Promise that resolves to true if onboarding completed successfully, false otherwise
|
||||
*/
|
||||
onOnboard(userMode: UserMode): Promise<boolean>;
|
||||
/**
|
||||
* Handles setup using a setup URI
|
||||
* @param userMode
|
||||
* @param setupURI
|
||||
* @returns Promise that resolves to true if onboarding completed successfully, false otherwise
|
||||
*/
|
||||
onUseSetupURI(userMode: UserMode, setupURI?: string): Promise<boolean>;
|
||||
/**
|
||||
* Handles manual setup for CouchDB
|
||||
* @param userMode
|
||||
* @param currentSetting
|
||||
* @param activate Whether to activate the CouchDB as remote type
|
||||
* @returns Promise that resolves to true if setup completed successfully, false otherwise
|
||||
*/
|
||||
onCouchDBManualSetup(userMode: UserMode, currentSetting: ObsidianLiveSyncSettings, activate?: boolean): Promise<boolean>;
|
||||
/**
|
||||
* Handles manual setup for S3-compatible bucket
|
||||
* @param userMode
|
||||
* @param currentSetting
|
||||
* @param activate Whether to activate the Bucket as remote type
|
||||
* @returns Promise that resolves to true if setup completed successfully, false otherwise
|
||||
*/
|
||||
onBucketManualSetup(userMode: UserMode, currentSetting: ObsidianLiveSyncSettings, activate?: boolean): Promise<boolean>;
|
||||
/**
|
||||
* Handles manual setup for P2P
|
||||
* @param userMode
|
||||
* @param currentSetting
|
||||
* @param activate Whether to activate the P2P as remote type (as P2P Only setup)
|
||||
* @returns Promise that resolves to true if setup completed successfully, false otherwise
|
||||
*/
|
||||
onP2PManualSetup(userMode: UserMode, currentSetting: ObsidianLiveSyncSettings, activate?: boolean): Promise<boolean>;
|
||||
/**
|
||||
* Handles only E2EE configuration
|
||||
* @param userMode
|
||||
* @param currentSetting
|
||||
* @returns
|
||||
*/
|
||||
onlyE2EEConfiguration(userMode: UserMode, currentSetting: ObsidianLiveSyncSettings): Promise<boolean>;
|
||||
/**
|
||||
* Handles manual configuration flow (E2EE + select server)
|
||||
* @param originalSetting
|
||||
* @param userMode
|
||||
* @returns
|
||||
*/
|
||||
onConfigureManually(originalSetting: ObsidianLiveSyncSettings, userMode: UserMode): Promise<boolean>;
|
||||
/**
|
||||
* Handles server selection during manual configuration
|
||||
* @param currentSetting
|
||||
* @param userMode
|
||||
* @returns
|
||||
*/
|
||||
onSelectServer(currentSetting: ObsidianLiveSyncSettings, userMode: UserMode): Promise<boolean>;
|
||||
/**
|
||||
* Confirms and applies settings obtained from the wizard
|
||||
* @param newConf
|
||||
* @param _userMode
|
||||
* @param activate Whether to activate the remote type in the new settings
|
||||
* @param extra Extra function to run before applying settings
|
||||
* @returns Promise that resolves to true if settings applied successfully, false otherwise
|
||||
*/
|
||||
onConfirmApplySettingsFromWizard(newConf: ObsidianLiveSyncSettings, _userMode: UserMode, activate?: boolean, extra?: () => void): Promise<boolean>;
|
||||
/**
|
||||
* Prompts the user with QR code scanning instructions
|
||||
* @returns Promise that resolves to false as QR code instruction dialog does not yield settings directly
|
||||
*/
|
||||
onPromptQRCodeInstruction(): Promise<boolean>;
|
||||
/**
|
||||
* Decodes settings from a QR code string and applies them
|
||||
* @param qr QR code string containing encoded settings
|
||||
* @returns Promise that resolves to true if settings applied successfully, false otherwise
|
||||
*/
|
||||
decodeQR(qr: string): Promise<boolean>;
|
||||
/**
|
||||
* Applies the new settings to the core settings and saves them
|
||||
* @param newConf
|
||||
* @param userMode
|
||||
* @returns Promise that resolves to true if settings applied successfully, false otherwise
|
||||
*/
|
||||
applySetting(newConf: ObsidianLiveSyncSettings, userMode: UserMode): Promise<boolean>;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import type { BucketSyncSetting, CouchDBConnection, EncryptionSettings, ObsidianLiveSyncSettings, P2PConnectionInfo } from "@lib/common/models/setting.type";
|
||||
export declare const TYPE_IDENTICAL = "identical";
|
||||
export declare const TYPE_INDEPENDENT = "independent";
|
||||
export declare const TYPE_UNBALANCED = "unbalanced";
|
||||
export declare const TYPE_CANCEL = "cancelled";
|
||||
export declare const TYPE_BACKUP_DONE = "backup_done";
|
||||
export declare const TYPE_BACKUP_SKIPPED = "backup_skipped";
|
||||
export declare const TYPE_UNABLE_TO_BACKUP = "unable_to_backup";
|
||||
export declare const TYPE_NEW_USER = "new-user";
|
||||
export declare const TYPE_EXISTING_USER = "existing-user";
|
||||
export declare const TYPE_CANCELLED = "cancelled";
|
||||
export declare const TYPE_EXISTING = "existing-user";
|
||||
export declare const TYPE_NEW = "new-user";
|
||||
export declare const TYPE_COMPATIBLE_EXISTING = "compatible-existing-user";
|
||||
export declare const TYPE_APPLY = "apply";
|
||||
export declare const TYPE_USE_SETUP_URI = "use-setup-uri";
|
||||
export declare const TYPE_SCAN_QR_CODE = "scan-qr-code";
|
||||
export declare const TYPE_CONFIGURE_MANUALLY = "configure-manually";
|
||||
export declare const TYPE_CLOSE = "close";
|
||||
export declare const TYPE_COUCHDB = "couchdb";
|
||||
export declare const TYPE_BUCKET = "bucket";
|
||||
export declare const TYPE_P2P = "p2p";
|
||||
export type ResultTypeVault = typeof TYPE_IDENTICAL | typeof TYPE_INDEPENDENT | typeof TYPE_UNBALANCED | typeof TYPE_CANCEL;
|
||||
export type ResultTypeBackup = typeof TYPE_BACKUP_DONE | typeof TYPE_BACKUP_SKIPPED | typeof TYPE_UNABLE_TO_BACKUP | typeof TYPE_CANCEL;
|
||||
export type ResultTypeExtra = {
|
||||
preventFetchingConfig: boolean;
|
||||
};
|
||||
export type FetchEverythingResult = {
|
||||
vault: ResultTypeVault;
|
||||
backup: ResultTypeBackup;
|
||||
extra: ResultTypeExtra;
|
||||
} | typeof TYPE_CANCEL;
|
||||
export type RebuildEverythingResult = {
|
||||
backup: ResultTypeBackup;
|
||||
extra: ResultTypeExtra;
|
||||
} | typeof TYPE_CANCEL;
|
||||
export type IntroResultType = typeof TYPE_NEW_USER | typeof TYPE_EXISTING_USER | typeof TYPE_CANCELLED;
|
||||
export type OutroAskUserModeResultType = typeof TYPE_EXISTING | typeof TYPE_NEW | typeof TYPE_COMPATIBLE_EXISTING | typeof TYPE_CANCELLED;
|
||||
export type OutroExistingUserResultType = typeof TYPE_APPLY | typeof TYPE_CANCELLED;
|
||||
export type OutroNewUserResultType = typeof TYPE_APPLY | typeof TYPE_CANCELLED;
|
||||
export type SelectMethodNewUserResultType = typeof TYPE_USE_SETUP_URI | typeof TYPE_CONFIGURE_MANUALLY | typeof TYPE_CANCELLED;
|
||||
export type SelectMethodExistingResultType = typeof TYPE_USE_SETUP_URI | typeof TYPE_SCAN_QR_CODE | typeof TYPE_CONFIGURE_MANUALLY | typeof TYPE_CANCELLED;
|
||||
export type SetupRemoteResultType = typeof TYPE_COUCHDB | typeof TYPE_BUCKET | typeof TYPE_P2P | typeof TYPE_CANCELLED;
|
||||
export type UseSetupURIResultType = typeof TYPE_CANCELLED | ObsidianLiveSyncSettings;
|
||||
export type SetupRemoteE2EEResultType = typeof TYPE_CANCELLED | EncryptionSettings;
|
||||
export type SetupRemoteBucketResultType = typeof TYPE_CANCELLED | BucketSyncSetting;
|
||||
export type SetupRemoteCouchDBResultType = typeof TYPE_CANCELLED | CouchDBConnection;
|
||||
export type SetupRemoteP2PResultType = typeof TYPE_CANCELLED | P2PConnectionInfo;
|
||||
export type ScanQRCodeResultType = typeof TYPE_CLOSE;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import { AbstractModule } from "@/modules/AbstractModule.ts";
|
||||
import type { InjectableServiceHub } from "@lib/services/implements/injectable/InjectableServiceHub.ts";
|
||||
import type { LiveSyncCore } from "@/main.ts";
|
||||
export declare class ModuleLiveSyncMain extends AbstractModule {
|
||||
_onLiveSyncReady(): Promise<boolean>;
|
||||
_wireUpEvents(): Promise<boolean>;
|
||||
_onLiveSyncLoad(): Promise<boolean>;
|
||||
onBindFunction(core: LiveSyncCore, services: InjectableServiceHub): void;
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { InjectableAPIService } from "@lib/services/implements/injectable/InjectableAPIService";
|
||||
import type { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
import { type Command, type ViewCreator } from "obsidian";
|
||||
import { ObsHttpHandler } from "@/modules/essentialObsidian/APILib/ObsHttpHandler";
|
||||
import type { Confirm } from "@lib/interfaces/Confirm";
|
||||
declare module "obsidian" {
|
||||
interface App {
|
||||
appId?: string;
|
||||
isMobile?: boolean;
|
||||
}
|
||||
}
|
||||
export declare class ObsidianAPIService extends InjectableAPIService<ObsidianServiceContext> {
|
||||
_customHandler: ObsHttpHandler | undefined;
|
||||
_confirmInstance: Confirm;
|
||||
constructor(context: ObsidianServiceContext);
|
||||
getCustomFetchHandler(): ObsHttpHandler;
|
||||
showWindow(viewType: string): Promise<void>;
|
||||
showWindowOnRight(viewType: string): Promise<void>;
|
||||
private get app();
|
||||
getPlatform(): string;
|
||||
isMobile(): boolean;
|
||||
getAppID(): string;
|
||||
getSystemVaultName(): string;
|
||||
getAppVersion(): string;
|
||||
getPluginVersion(): string;
|
||||
get confirm(): Confirm;
|
||||
addCommand<TCommand extends Command>(command: TCommand): TCommand;
|
||||
registerWindow(type: string, factory: ViewCreator): void;
|
||||
addRibbonIcon(icon: string, title: string, callback: (evt: MouseEvent) => void): HTMLElement;
|
||||
registerProtocolHandler(action: string, handler: (params: Record<string, string>) => void): void;
|
||||
/**
|
||||
* In Obsidian, we will use the native `requestUrl` function as the default fetch handler,
|
||||
* to address unavoidable CORS issues.
|
||||
*/
|
||||
nativeFetch(req: string | Request, opts?: RequestInit): Promise<Response>;
|
||||
addStatusBarItem(): HTMLElement | undefined;
|
||||
setInterval(handler: () => void, timeout: number): number;
|
||||
getSystemConfigDir(): string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { AppLifecycleServiceBase } from "@lib/services/implements/injectable/InjectableAppLifecycleService";
|
||||
import type { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
declare module "obsidian" {
|
||||
interface App {
|
||||
commands: {
|
||||
executeCommandById: (id: string) => Promise<void>;
|
||||
};
|
||||
}
|
||||
}
|
||||
export declare class ObsidianAppLifecycleService<T extends ObsidianServiceContext> extends AppLifecycleServiceBase<T> {
|
||||
performRestart(): void;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { type App, type Plugin } from "@/deps";
|
||||
import type { Confirm } from "@lib/interfaces/Confirm";
|
||||
import type { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
export declare class ObsidianConfirm<T extends ObsidianServiceContext = ObsidianServiceContext> implements Confirm {
|
||||
private _context;
|
||||
get _app(): App;
|
||||
get _plugin(): Plugin;
|
||||
constructor(context: T);
|
||||
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<T extends readonly string[]>(message: string, buttons: T, opt: {
|
||||
title?: string;
|
||||
defaultAction: T[number];
|
||||
timeout?: number;
|
||||
}): Promise<T[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>;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
import { DatabaseService, type DatabaseServiceDependencies } from "@lib/services/base/DatabaseService.ts";
|
||||
export declare class ObsidianDatabaseService<T extends ObsidianServiceContext> extends DatabaseService<T> {
|
||||
private __onOpenDatabase;
|
||||
constructor(context: T, dependencies: DatabaseServiceDependencies);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
import { PathService } from "@lib/services/base/PathService";
|
||||
import { type BASE_IS_NEW, type TARGET_IS_NEW, type EVEN } from "@/common/utils";
|
||||
import type { UXFileInfo, UXFileInfoStub } from "@lib/common/models/fileaccess.type";
|
||||
import type { AnyEntry, FilePathWithPrefix } from "@lib/common/models/db.type";
|
||||
export declare class ObsidianPathService extends PathService<ObsidianServiceContext> {
|
||||
markChangesAreSame(old: UXFileInfo | AnyEntry | FilePathWithPrefix, newMtime: number, oldMtime: number): boolean | undefined;
|
||||
unmarkChanges(file: AnyEntry | FilePathWithPrefix | UXFileInfoStub): void;
|
||||
compareFileFreshness(baseFile: UXFileInfoStub | AnyEntry | undefined, checkTarget: UXFileInfo | AnyEntry | undefined): typeof BASE_IS_NEW | typeof TARGET_IS_NEW | typeof EVEN;
|
||||
isMarkedAsSameChanges(file: UXFileInfoStub | AnyEntry | FilePathWithPrefix, mtimes: number[]): undefined | typeof EVEN;
|
||||
protected normalizePath(path: string): string;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { InjectableServiceHub } from "@lib/services/implements/injectable/InjectableServiceHub";
|
||||
import { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
import type ObsidianLiveSyncPlugin from "@/main";
|
||||
export declare class ObsidianServiceHub extends InjectableServiceHub<ObsidianServiceContext> {
|
||||
constructor(plugin: ObsidianLiveSyncPlugin);
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import { InjectableConflictService } from "@lib/services/implements/injectable/InjectableConflictService";
|
||||
import { InjectableDatabaseEventService } from "@lib/services/implements/injectable/InjectableDatabaseEventService";
|
||||
import { InjectableFileProcessingService } from "@lib/services/implements/injectable/InjectableFileProcessingService";
|
||||
import { InjectableRemoteService } from "@lib/services/implements/injectable/InjectableRemoteService";
|
||||
import { InjectableReplicationService } from "@lib/services/implements/injectable/InjectableReplicationService";
|
||||
import { InjectableReplicatorService } from "@lib/services/implements/injectable/InjectableReplicatorService";
|
||||
import { InjectableTestService } from "@lib/services/implements/injectable/InjectableTestService";
|
||||
import { InjectableTweakValueService } from "@lib/services/implements/injectable/InjectableTweakValueService";
|
||||
import { ConfigServiceBrowserCompat } from "@lib/services/implements/browser/ConfigServiceBrowserCompat";
|
||||
import type { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext.ts";
|
||||
import { KeyValueDBService } from "@lib/services/base/KeyValueDBService";
|
||||
import { ControlService } from "@lib/services/base/ControlService";
|
||||
export declare class ObsidianDatabaseEventService extends InjectableDatabaseEventService<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianReplicatorService extends InjectableReplicatorService<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianFileProcessingService extends InjectableFileProcessingService<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianReplicationService extends InjectableReplicationService<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianRemoteService extends InjectableRemoteService<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianConflictService extends InjectableConflictService<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianTweakValueService extends InjectableTweakValueService<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianTestService extends InjectableTestService<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianConfigService extends ConfigServiceBrowserCompat<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianKeyValueDBService extends KeyValueDBService<ObsidianServiceContext> {
|
||||
}
|
||||
export declare class ObsidianControlService extends ControlService<ObsidianServiceContext> {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
|
||||
import { SettingService, type SettingServiceDependencies } from "@lib/services/base/SettingService";
|
||||
import type { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
export declare class ObsidianSettingService<T extends ObsidianServiceContext> extends SettingService<T> {
|
||||
constructor(context: T, dependencies: SettingServiceDependencies);
|
||||
protected setItem(key: string, value: string): void;
|
||||
protected getItem(key: string): string;
|
||||
protected deleteItem(key: string): void;
|
||||
protected saveData(data: ObsidianLiveSyncSettings): Promise<void>;
|
||||
protected loadData(): Promise<ObsidianLiveSyncSettings | undefined>;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import type { ConfigService } from "@lib/services/base/ConfigService";
|
||||
import type { AppLifecycleService } from "@lib/services/base/AppLifecycleService";
|
||||
import type { ReplicatorService } from "@lib/services/base/ReplicatorService";
|
||||
import { UIService } from "@lib/services//implements/base/UIService";
|
||||
import { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
import type { IAPIService, IControlService } from "@lib/services/base/IService";
|
||||
export type ObsidianUIServiceDependencies<T extends ObsidianServiceContext = ObsidianServiceContext> = {
|
||||
appLifecycle: AppLifecycleService<T>;
|
||||
config: ConfigService<T>;
|
||||
replicator: ReplicatorService<T>;
|
||||
APIService: IAPIService;
|
||||
control: IControlService;
|
||||
};
|
||||
export declare class ObsidianUIService extends UIService<ObsidianServiceContext> {
|
||||
get dialogToCopy(): import("svelte/legacy").LegacyComponentType;
|
||||
constructor(context: ObsidianServiceContext, dependents: ObsidianUIServiceDependencies<ObsidianServiceContext>);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { InjectableVaultService } from "@lib/services/implements/injectable/InjectableVaultService";
|
||||
import type { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
import type { FilePath } from "@lib/common/models/db.type";
|
||||
declare module "obsidian" {
|
||||
interface DataAdapter {
|
||||
insensitive?: boolean;
|
||||
}
|
||||
}
|
||||
export declare class ObsidianVaultService extends InjectableVaultService<ObsidianServiceContext> {
|
||||
vaultName(): string;
|
||||
getActiveFilePath(): FilePath | undefined;
|
||||
isStorageInsensitive(): boolean;
|
||||
shouldCheckCaseInsensitively(): boolean;
|
||||
isValidPath(path: string): boolean;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { SvelteDialogManagerBase, type ComponentHasResult, type SvelteDialogManagerDependencies } from "@lib/services/implements/base/SvelteDialog";
|
||||
import type { ObsidianServiceContext } from "@lib/services/implements/obsidian/ObsidianServiceContext";
|
||||
export declare const SvelteDialogBase: any;
|
||||
export declare class SvelteDialogObsidian<T, U, C extends ObsidianServiceContext = ObsidianServiceContext> extends SvelteDialogBase<T, U, C> {
|
||||
constructor(context: C, dependents: SvelteDialogManagerDependencies<C>, component: ComponentHasResult<T, U>, initialData?: U);
|
||||
}
|
||||
export declare class ObsidianSvelteDialogManager<T extends ObsidianServiceContext> extends SvelteDialogManagerBase<T> {
|
||||
openSvelteDialog<TT, TU>(component: ComponentHasResult<TT, TU>, initialData?: TU): Promise<TT | undefined>;
|
||||
}
|
||||
Reference in New Issue
Block a user