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
+3
View File
@@ -0,0 +1,3 @@
import type { KeyValueDatabase } from "@lib/interfaces/KeyValueDatabase.ts";
export { OpenKeyValueDatabase } from "./KeyValueDBv2.ts";
export declare const _OpenKeyValueDatabase: (dbKey: string) => Promise<KeyValueDatabase>;
+24
View File
@@ -0,0 +1,24 @@
import type { KeyValueDatabase } from "@lib/interfaces/KeyValueDatabase";
import { type IDBPDatabase } from "idb";
export declare function OpenKeyValueDatabase(dbKey: string): Promise<KeyValueDatabase>;
export declare class IDBKeyValueDatabase implements KeyValueDatabase {
protected _dbPromise: Promise<IDBPDatabase<unknown>> | null;
protected dbKey: string;
protected storeKey: string;
protected _isDestroyed: boolean;
protected destroyedPromise: Promise<void> | null;
get isDestroyed(): boolean;
get ensuredDestroyed(): Promise<void>;
getIsReady(): Promise<boolean>;
protected ensureDB(): Promise<IDBPDatabase<unknown>>;
protected closeDB(setDestroyed?: boolean): Promise<void>;
get DB(): Promise<IDBPDatabase<unknown>>;
constructor(dbKey: string);
get<U>(key: IDBValidKey): Promise<U>;
set<U>(key: IDBValidKey, value: U): Promise<IDBValidKey>;
del(key: IDBValidKey): Promise<void>;
clear(): Promise<void>;
keys(query?: IDBValidKey | IDBKeyRange, count?: number): Promise<IDBValidKey[]>;
close(): Promise<void>;
destroy(): Promise<void>;
}
+12
View File
@@ -0,0 +1,12 @@
import type { NecessaryServices } from "@lib/interfaces/ServiceModule";
type PeriodicProcessorHost = NecessaryServices<"API" | "control", never>;
export declare class PeriodicProcessor {
_process: () => Promise<unknown>;
_timer?: number;
_core: PeriodicProcessorHost;
constructor(core: PeriodicProcessorHost, process: () => Promise<unknown>);
process(): Promise<void>;
enable(interval: number): void;
disable(): void;
}
export {};
+9
View File
@@ -0,0 +1,9 @@
import { ItemView } from "@/deps.ts";
import { type mount } from "svelte";
export declare abstract class SvelteItemView extends ItemView {
abstract instantiateComponent(target: HTMLElement): ReturnType<typeof mount> | Promise<ReturnType<typeof mount>>;
component?: ReturnType<typeof mount>;
onOpen(): Promise<void>;
_dismountComponent(): Promise<void>;
onClose(): Promise<void>;
}
+36
View File
@@ -0,0 +1,36 @@
import { eventHub } from "@lib/hub/hub";
export declare const EVENT_PLUGIN_LOADED = "plugin-loaded";
export declare const EVENT_PLUGIN_UNLOADED = "plugin-unloaded";
export declare const EVENT_FILE_SAVED = "file-saved";
export declare const EVENT_LEAF_ACTIVE_CHANGED = "leaf-active-changed";
export declare const EVENT_REQUEST_OPEN_SETTINGS = "request-open-settings";
export declare const EVENT_REQUEST_OPEN_SETTING_WIZARD = "request-open-setting-wizard";
export declare const EVENT_REQUEST_OPEN_SETUP_URI = "request-open-setup-uri";
export declare const EVENT_REQUEST_COPY_SETUP_URI = "request-copy-setup-uri";
export declare const EVENT_REQUEST_SHOW_SETUP_QR = "request-show-setup-qr";
export declare const EVENT_REQUEST_RELOAD_SETTING_TAB = "reload-setting-tab";
export declare const EVENT_REQUEST_OPEN_PLUGIN_SYNC_DIALOG = "request-open-plugin-sync-dialog";
export declare const EVENT_REQUEST_RUN_DOCTOR = "request-run-doctor";
export declare const EVENT_REQUEST_RUN_FIX_INCOMPLETE = "request-run-fix-incomplete";
export declare const EVENT_ANALYSE_DB_USAGE = "analyse-db-usage";
export declare const EVENT_REQUEST_PERFORM_GC_V3 = "request-perform-gc-v3";
declare global {
interface LSEvents {
[EVENT_PLUGIN_LOADED]: undefined;
[EVENT_PLUGIN_UNLOADED]: undefined;
[EVENT_REQUEST_OPEN_PLUGIN_SYNC_DIALOG]: undefined;
[EVENT_REQUEST_OPEN_SETTINGS]: undefined;
[EVENT_REQUEST_OPEN_SETTING_WIZARD]: undefined;
[EVENT_REQUEST_RELOAD_SETTING_TAB]: undefined;
[EVENT_LEAF_ACTIVE_CHANGED]: undefined;
[EVENT_REQUEST_OPEN_SETUP_URI]: undefined;
[EVENT_REQUEST_COPY_SETUP_URI]: undefined;
[EVENT_REQUEST_SHOW_SETUP_QR]: undefined;
[EVENT_REQUEST_RUN_DOCTOR]: string;
[EVENT_REQUEST_RUN_FIX_INCOMPLETE]: undefined;
[EVENT_ANALYSE_DB_USAGE]: undefined;
[EVENT_REQUEST_PERFORM_GC_V3]: undefined;
}
}
export * from "@lib/events/coreEvents.ts";
export { eventHub };
+14
View File
@@ -0,0 +1,14 @@
import type { TFile } from "@/deps";
import type { FilePathWithPrefix, LoadedEntry } from "@lib/common/models/db.type";
export declare const EVENT_REQUEST_SHOW_HISTORY = "show-history";
declare global {
interface LSEvents {
[EVENT_REQUEST_SHOW_HISTORY]: {
file: TFile;
fileOnDB: LoadedEntry;
} | {
file: FilePathWithPrefix;
fileOnDB: LoadedEntry;
};
}
}
+12
View File
@@ -0,0 +1,12 @@
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore";
export declare function generateReport(settings: ObsidianLiveSyncSettings, core: LiveSyncBaseCore): Promise<{
obsidianInfo: {
navigator: string;
fileSystem: string;
};
responseConfig: Record<string, unknown>;
pluginConfig: ObsidianLiveSyncSettings;
manifestVersion: string;
packageVersion: string;
}>;
+3
View File
@@ -0,0 +1,3 @@
import { PersistentMap } from "octagonal-wheels/dataobject/PersistentMap";
export declare let sameChangePairs: PersistentMap<number[]>;
export declare function initializeStores(vaultName: string): void;
+47
View File
@@ -0,0 +1,47 @@
import { type PluginManifest, TFile } from "@/deps.ts";
import type { DatabaseEntry, FilePath } from "@lib/common/models/db.type";
import type { EntryBody } from "@lib/common/models/db.definition";
export type { CacheData, FileEventItem } from "@lib/common/types.ts";
export interface PluginDataEntry extends DatabaseEntry {
deviceVaultName: string;
mtime: number;
manifest: PluginManifest;
mainJs: string;
manifestJson: string;
styleCss?: string;
dataJson?: string;
_conflicts?: string[];
type: "plugin";
}
export interface PluginList {
[key: string]: PluginDataEntry[];
}
export interface DevicePluginList {
[key: string]: PluginDataEntry;
}
export declare const PERIODIC_PLUGIN_SWEEP = 60;
export interface InternalFileInfo {
path: FilePath;
mtime: number;
ctime: number;
size: number;
deleted?: boolean;
}
export interface FileInfo {
path: FilePath;
mtime: number;
ctime: number;
size: number;
deleted?: boolean;
file: TFile;
}
export type queueItem = {
entry: EntryBody;
missingChildren: string[];
timeout?: number;
done?: boolean;
warned?: boolean;
};
export declare const FileWatchEventQueueMax = 10;
export { configURIBase, configURIBaseQR } from "@lib/common/types.ts";
export { CHeader, PSCHeader, PSCHeaderEnd, ICHeader, ICHeaderEnd, ICHeaderLength, ICXHeader, } from "@lib/common/models/fileaccess.const.ts";
+61
View File
@@ -0,0 +1,61 @@
import { TAbstractFile } from "@/deps.ts";
import type { AnyEntry, DocumentID, EntryHasPath, FilePath, FilePathWithPrefix } from "@lib/common/models/db.type";
import type { CouchDBCredentials } from "@lib/common/models/auth.type";
import type { UXFileInfo, UXFileInfoStub } from "@lib/common/models/fileaccess.type";
export { ICHeader, ICXHeader } from "./types.ts";
import type { KeyValueDatabase } from "@lib/interfaces/KeyValueDatabase.ts";
export { scheduleTask, cancelTask, cancelAllTasks } from "octagonal-wheels/concurrency/task";
export declare function path2id(filename: FilePathWithPrefix | FilePath, obfuscatePassphrase: string | false, caseInsensitive: boolean): Promise<DocumentID>;
export declare function id2path(id: DocumentID, entry?: EntryHasPath): FilePathWithPrefix;
export declare function getPathFromTFile(file: TAbstractFile): FilePath;
import { isInternalFile, getPathFromUXFileInfo, getStoragePathFromUXFileInfo, getDatabasePathFromUXFileInfo } from "@lib/common/typeUtils.ts";
export { isInternalFile, getPathFromUXFileInfo, getStoragePathFromUXFileInfo, getDatabasePathFromUXFileInfo };
export declare function memoObject<T>(key: string, obj: T): T;
export declare function memoIfNotExist<T>(key: string, func: () => T | Promise<T>): Promise<T>;
export declare function retrieveMemoObject<T>(key: string): T | false;
export declare function disposeMemoObject(key: string): void;
export declare function isValidPath(filename: string): boolean;
export declare function trimPrefix(target: string, prefix: string): string;
export { isInternalMetadata, id2InternalMetadataId, isChunk, isCustomisationSyncMetadata, isPluginMetadata, stripInternalMetadataPrefix, } from "@lib/common/typeUtils.ts";
export declare const _requestToCouchDBFetch: (baseUri: string, username: string, password: string, path?: string, body?: unknown, method?: string) => Promise<Response>;
export declare const _requestToCouchDB: (baseUri: string, credentials: CouchDBCredentials, origin: string, path?: string, body?: unknown, method?: string, customHeaders?: Record<string, string>) => Promise<import("obsidian").RequestUrlResponse>;
/**
* @deprecated Use requestToCouchDBWithCredentials instead.
*/
export declare const requestToCouchDB: (baseUri: string, username: string, password: string, origin?: string, key?: string, body?: string, method?: string, customHeaders?: Record<string, string>) => Promise<import("obsidian").RequestUrlResponse>;
export declare function requestToCouchDBWithCredentials(baseUri: string, credentials: CouchDBCredentials, origin?: string, key?: string, body?: string, method?: string, customHeaders?: Record<string, string>): Promise<import("obsidian").RequestUrlResponse>;
import { BASE_IS_NEW, EVEN, TARGET_IS_NEW } from "@lib/common/models/shared.const.symbols.ts";
export { BASE_IS_NEW, EVEN, TARGET_IS_NEW };
import { compareMTime } from "@lib/common/utils.database.ts";
export { compareMTime };
export declare function markChangesAreSame(file: AnyEntry | string | UXFileInfoStub, mtime1: number, mtime2: number): true | undefined;
export declare function unmarkChanges(file: AnyEntry | string | UXFileInfoStub): void;
export declare function isMarkedAsSameChanges(file: UXFileInfoStub | AnyEntry | string, mtimes: number[]): typeof EVEN | undefined;
export declare function compareFileFreshness(baseFile: UXFileInfoStub | AnyEntry | undefined, checkTarget: UXFileInfo | AnyEntry | undefined): typeof BASE_IS_NEW | typeof TARGET_IS_NEW | typeof EVEN;
export type MemoOption = {
key: string;
forceUpdate?: boolean;
validator?: (context: Map<string, unknown>) => boolean;
};
export declare function useMemo<T>({ key, forceUpdate, validator }: MemoOption, updateFunc: (context: Map<string, unknown>, prev: T) => T): T;
export declare function useStatic<T>(key: string): {
value: T | undefined;
};
export declare function useStatic<T>(key: string, initial: T): {
value: T;
};
export declare function disposeMemo(key: string): void;
export declare function disposeAllMemo(): void;
export declare function getLogLevel(showNotice: boolean): 32 | 64;
export type MapLike<K, V> = {
set(key: K, value: V): Map<K, V>;
clear(): void;
delete(key: K): boolean;
get(key: K): V | undefined;
has(key: K): boolean;
keys: () => IterableIterator<K>;
get size(): number;
};
export declare function autosaveCache<K, V>(db: KeyValueDatabase, mapKey: string): Promise<MapLike<K, V>>;
export declare function onlyInNTimes(n: number, proc: (progress: number) => unknown): () => void;
export { displayRev } from "@lib/common/utils.ts";