Compare commits

..

22 Commits

Author SHA1 Message Date
vorotamoroz 8764f447f9 fix a bit some, node-importing is now barrelled into one file. 2026-06-12 10:13:10 +01:00
vorotamoroz edb857f50d add eslint-disabled-line (testing) 2026-06-12 09:18:01 +01:00
vorotamoroz f91b38d4ab refactor (okay, i know that this cannot be merged ; too large diff. I will pick some cheery). 2026-06-12 09:14:10 +01:00
vorotamoroz b62a565c8a trial: monoreponised
some trivial fix
2026-06-12 05:10:18 +01:00
vorotamoroz 1e7c1db1c4 fix generated type path 2026-06-11 09:37:20 +01:00
vorotamoroz 8df9a1b53b fix paths 2026-06-11 07:57:04 +01:00
vorotamoroz 32c9f76c93 add type defs for community automatic review 2026-06-11 06:14:58 +01:00
vorotamoroz 7e65e5dc68 fix imports 2026-06-11 06:12:39 +01:00
vorotamoroz c03fa5213f fix imports 2026-06-11 04:28:07 +01:00
vorotamoroz 3b538a143a fix tool 2026-06-11 04:20:26 +01:00
vorotamoroz 3c6ec75c00 fix imports 2026-06-11 04:09:43 +01:00
vorotamoroz 27e9b68510 (chore): Resolving circular references 2026-06-10 11:45:41 +01:00
vorotamoroz e4b36602ec (chore): split utils 2026-06-10 11:22:34 +01:00
vorotamoroz 36827d4799 update submodule 2026-06-10 10:38:59 +01:00
vorotamoroz f596e7dd68 (chore): fix import paths 2026-06-10 10:33:41 +01:00
vorotamoroz b0ac01e52f append exclude 2026-06-10 10:31:40 +01:00
vorotamoroz b4077bd1f5 (chore): add utility for refactoring 2026-06-10 10:29:56 +01:00
vorotamoroz 675de883e9 (chore): fix import paths 2026-06-10 09:40:55 +01:00
vorotamoroz 4b8de7c915 Add importAlias 2026-06-10 09:40:43 +01:00
vorotamoroz 4f8a74107c remove unnecessary package 2026-06-09 08:11:05 +01:00
vorotamoroz 42ed0d8795 update dir notation 2026-06-09 07:25:41 +01:00
vorotamoroz 54c2b1c6db reduce no-explicit-any 2026-06-09 05:59:02 +01:00
575 changed files with 4923 additions and 6742 deletions
+12 -40
View File
@@ -8,21 +8,8 @@ name: Build and Push CLI Docker Image
on:
push:
branches:
- main
tags:
- "*.*.*-cli"
paths-ignore:
- "docs/**"
- "*.md"
- "images/**"
- "assets/**"
- "instruction_images/**"
- "src/apps/webapp/**"
- "src/apps/webpeer/**"
- ".github/workflows/release.yml"
- ".github/workflows/unit-ci.yml"
- ".github/workflows/harness-ci.yml"
workflow_dispatch:
inputs:
dry_run:
@@ -54,32 +41,14 @@ jobs:
id: meta
run: |
VERSION=$(jq -r '.version' manifest.json)
SHORT_SHA=$(git rev-parse --short HEAD)
EPOCH=$(date +%s)
TAG="${VERSION}-${EPOCH}-cli"
IMAGE="ghcr.io/${{ github.repository_owner }}/livesync-cli"
# Build tag list based on the event and git ref
TAGS=""
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
# Stable release builds
TAGS="${IMAGE}:${VERSION}-cli,${IMAGE}:latest,${IMAGE}:${VERSION}-sha-${SHORT_SHA}-cli"
elif [[ "${{ github.ref }}" == refs/heads/main ]]; then
# Bleeding-edge / nightly builds
TAGS="${IMAGE}:edge,${IMAGE}:${VERSION}-dev-sha-${SHORT_SHA}-cli"
else
# Other branches / manual run fallback
TAGS="${IMAGE}:${VERSION}-dev-sha-${SHORT_SHA}-cli"
fi
# Determine if the image should be pushed
PUSH="true"
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
PUSH="false"
fi
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "push=${PUSH}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
echo "full=${IMAGE}:${TAG}" >> $GITHUB_OUTPUT
echo "version=${IMAGE}:${VERSION}-cli" >> $GITHUB_OUTPUT
echo "latest=${IMAGE}:latest" >> $GITHUB_OUTPUT
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
@@ -123,7 +92,10 @@ jobs:
with:
context: .
file: src/apps/cli/Dockerfile
push: ${{ steps.meta.outputs.push }}
tags: ${{ steps.meta.outputs.tags }}
push: ${{ !(github.event_name == 'workflow_dispatch' && inputs.dry_run) }}
tags: |
${{ steps.meta.outputs.full }}
${{ steps.meta.outputs.version }}
${{ steps.meta.outputs.latest }}
cache-from: type=gha
cache-to: type=gha,mode=max
-1
View File
@@ -4,7 +4,6 @@ on:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching any tag format, i.e. 1.0, 20.15.10
- '!*-cli' # Exclude command-line interface tags
workflow_dispatch:
jobs:
+6 -49
View File
@@ -35,8 +35,7 @@ permissions:
contents: read
jobs:
unit-test:
name: Unit Tests
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
@@ -54,6 +53,10 @@ jobs:
- name: Install dependencies
run: npm ci
# unit tests do not require Playwright, so we can skip installing its dependencies to save time
# - name: Install test dependencies (Playwright Chromium)
# run: npm run test:install-dependencies
- name: Run unit tests suite with coverage
run: npm run test:unit:coverage
@@ -61,51 +64,5 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-coverage-report
name: coverage-report
path: coverage/**
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Create environment configuration files
run: |
cat <<EOF > .env
BUILD_MODE=dev
PATHS_TEST_INSTALL=
EOF
cat <<EOF > .test.env
hostname=http://127.0.0.1:5989/
dbname=livesync-test-db2
username=admin
password=testpassword
minioEndpoint=http://127.0.0.1:9000
accessKey=minioadmin
secretKey=minioadmin
bucketName=livesync-test-bucket
EOF
- name: Start CouchDB container
run: npm run test:docker-couchdb:start
- name: Run integration tests
run: npm run test:integration
- name: Stop CouchDB container
if: always()
run: npm run test:docker-couchdb:stop || true
+1 -2
View File
@@ -1,4 +1,3 @@
pouchdb-browser.js
main_org.js
main.js
_types/**
_types
+3 -5
View File
@@ -1,7 +1,6 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { SimpleStore } from "octagonal-wheels/databases/SimpleStoreBase";
import type { HasSettings, ObsidianLiveSyncSettings, EntryDoc } from "@lib/common/types";
import type { HasSettings, ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
import type { EntryDoc } from "@lib/common/models/db.definition";
import type { Confirm } from "@lib/interfaces/Confirm";
import type { DatabaseFileAccess } from "@lib/interfaces/DatabaseFileAccess";
import type { Rebuilder } from "@lib/interfaces/DatabaseRebuilder";
@@ -16,7 +15,6 @@ import type { ServiceContext } from "@lib/services/base/ServiceBase";
import type { InjectableServiceHub } from "@lib/services/InjectableServices";
import { AbstractModule } from "./modules/AbstractModule";
import type { ServiceModules } from "@lib/interfaces/ServiceModule";
import type { Constructor } from "@lib/common/utils.type";
export declare class LiveSyncBaseCore<T extends ServiceContext = ServiceContext, TCommands extends IMinimumLiveSyncCommands = IMinimumLiveSyncCommands> implements LiveSyncLocalDBEnv, LiveSyncReplicatorEnv, LiveSyncJournalReplicatorEnv, LiveSyncCouchDBReplicatorEnv, HasSettings<ObsidianLiveSyncSettings> {
addOns: TCommands[];
/**
@@ -52,7 +50,7 @@ export declare class LiveSyncBaseCore<T extends ServiceContext = ServiceContext,
* @param constructor
* @returns
*/
getModule<T extends AbstractModule>(constructor: Constructor<T>): T;
getModule<T extends AbstractModule>(constructor: new (...args: any[]) => T): T; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Register a module to the plug-in.
* @param module The module to register.
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { KeyValueDatabase } from "@lib/interfaces/KeyValueDatabase.ts";
export { OpenKeyValueDatabase } from "./KeyValueDBv2.ts";
export declare const _OpenKeyValueDatabase: (dbKey: string) => Promise<KeyValueDatabase>;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { KeyValueDatabase } from "@lib/interfaces/KeyValueDatabase";
import { type IDBPDatabase } from "idb";
export declare function OpenKeyValueDatabase(dbKey: string): Promise<KeyValueDatabase>;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { NecessaryServices } from "@lib/interfaces/ServiceModule";
type PeriodicProcessorHost = NecessaryServices<"API" | "control", never>;
export declare class PeriodicProcessor {
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { ItemView } from "@/deps.ts";
import { type mount } from "svelte";
export declare abstract class SvelteItemView extends ItemView {
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { eventHub } from "@lib/hub/hub";
export declare const EVENT_PLUGIN_LOADED = "plugin-loaded";
export declare const EVENT_PLUGIN_UNLOADED = "plugin-unloaded";
+1 -3
View File
@@ -1,7 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { TFile } from "@/deps";
import type { FilePathWithPrefix, LoadedEntry } from "@lib/common/types";
import type { FilePathWithPrefix, LoadedEntry } from "@lib/common/models/db.type";
export declare const EVENT_REQUEST_SHOW_HISTORY = "show-history";
declare global {
interface LSEvents {
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore";
export declare function generateReport(settings: ObsidianLiveSyncSettings, core: LiveSyncBaseCore): Promise<{
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { PersistentMap } from "octagonal-wheels/dataobject/PersistentMap";
export declare let sameChangePairs: PersistentMap<number[]>;
export declare function initializeStores(vaultName: string): void;
+2 -3
View File
@@ -1,7 +1,6 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type PluginManifest, TFile } from "@/deps.ts";
import { type DatabaseEntry, type EntryBody, type FilePath } from "@lib/common/types.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;
+4 -4
View File
@@ -1,7 +1,7 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { TAbstractFile } from "@/deps.ts";
import { type AnyEntry, type CouchDBCredentials, type DocumentID, type EntryHasPath, type FilePath, type FilePathWithPrefix, type UXFileInfo, type UXFileInfoStub } from "@lib/common/types.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";
@@ -26,7 +26,7 @@ export declare const requestToCouchDB: (baseUri: string, username: string, passw
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.ts";
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;
+3 -5
View File
@@ -1,8 +1,6 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type FilePath } from "@lib/common/types.ts";
export { addIcon, App, debounce, Editor, FuzzySuggestModal, MarkdownRenderer, MarkdownView, Modal, Notice, Platform, Plugin, PluginSettingTab, requestUrl, sanitizeHTMLToDom, Setting, stringifyYaml, TAbstractFile, TextAreaComponent, TFile, TFolder, parseYaml, ItemView, WorkspaceLeaf, Menu, request, getLanguage, ButtonComponent, TextComponent, ToggleComponent, DropdownComponent, Component, } from "obsidian";
export type { DataWriteOptions, PluginManifest, RequestUrlParam, RequestUrlResponse, MarkdownFileInfo, ListedFiles, ValueComponent, Stat, Command, ViewCreator, } from "obsidian";
import type { FilePath } from "@lib/common/models/db.type";
export { addIcon, App, debounce, Editor, FuzzySuggestModal, MarkdownRenderer, MarkdownView, Modal, Notice, Platform, Plugin, PluginSettingTab, requestUrl, sanitizeHTMLToDom, Setting, stringifyYaml, TAbstractFile, TextAreaComponent, TFile, TFolder, parseYaml, ItemView, WorkspaceLeaf, Menu, request, getLanguage, ButtonComponent, TextComponent, ToggleComponent, DropdownComponent, } from "obsidian";
export type { DataWriteOptions, PluginManifest, RequestUrlParam, RequestUrlResponse, MarkdownFileInfo, ListedFiles, ValueComponent, Stat, } from "obsidian";
declare const normalizePath: <T extends string | FilePath>(from: T) => T;
export { normalizePath };
export { type Diff, DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, diff_match_patch } from "diff-match-patch";
+7 -7
View File
@@ -1,12 +1,11 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type PluginManifest } from "@/deps.ts";
import type { EntryDoc, LoadedEntry, FilePathWithPrefix, FilePath, AnyEntry } from "@lib/common/types.ts";
import { type PluginManifest, type App } from "@/deps.ts";
import type { EntryDoc } from "@lib/common/models/db.definition";
import type { LoadedEntry, FilePathWithPrefix, FilePath, AnyEntry } from "@lib/common/models/db.type";
import { LiveSyncCommands } from "@/features/LiveSyncCommands.ts";
import { PeriodicProcessor } from "@/common/PeriodicProcessor.ts";
import { QueueProcessor } from "octagonal-wheels/concurrency/processor";
import type ObsidianLiveSyncPlugin from "@/main.ts";
import { PluginDialogModal } from "./PluginDialogModal.ts";
import type { PluginDialogModal } from "./PluginDialogModal.ts";
import type { InjectableServiceHub } from "@lib/services/InjectableServices.ts";
import type { LiveSyncCore } from "@/main.ts";
declare global {
@@ -79,7 +78,8 @@ export type PluginDataEx = {
mtime: number;
};
export declare class ConfigSync extends LiveSyncCommands {
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore);
pluginDialogClass: new (app: App, plugin: ObsidianLiveSyncPlugin) => PluginDialogModal;
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore, pluginDialogClass: new (app: App, plugin: ObsidianLiveSyncPlugin) => PluginDialogModal);
get configDir(): string;
get kvDB(): import("../../lib/src/interfaces/KeyValueDatabase.ts").KeyValueDatabase;
get useV2(): boolean;
@@ -91,7 +91,7 @@ export declare class ConfigSync extends LiveSyncCommands {
showPluginSyncModal(): void;
hidePluginSyncModal(): void;
onunload(): void;
addRibbonIcon: (icon: string, title: string, callback: (evt: MouseEvent) => unknown) => HTMLElement;
addRibbonIcon: (icon: string, title: string, callback: (evt: MouseEvent) => any) => HTMLElement; // eslint-disable-line @typescript-eslint/no-explicit-any
onload(): void;
getFileCategory(filePath: string): "CONFIG" | "THEME" | "SNIPPET" | "PLUGIN_MAIN" | "PLUGIN_ETC" | "PLUGIN_DATA" | "";
isTargetPath(filePath: string): boolean;
+1 -3
View File
@@ -1,8 +1,6 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { mount } from "svelte";
import { App, Modal } from "@/deps.ts";
import ObsidianLiveSyncPlugin from "@/main.ts";
import type ObsidianLiveSyncPlugin from "@/main.ts";
export declare class PluginDialogModal extends Modal {
plugin: ObsidianLiveSyncPlugin;
component: ReturnType<typeof mount> | undefined;
+1 -3
View File
@@ -1,7 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { App, Modal } from "@/deps.ts";
import { type FilePath, type LoadedEntry } from "@lib/common/types.ts";
import type { FilePath, LoadedEntry } from "@lib/common/models/db.type";
import { mount } from "svelte";
export declare class JsonResolveModal extends Modal {
filename: FilePath;
+4 -5
View File
@@ -1,8 +1,7 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type LoadedEntry, type FilePathWithPrefix, type FilePath, type DocumentID, type UXFileInfo, type UXStat, type MetaEntry, type UXDataWriteOptions } from "@lib/common/types.ts";
import type { LoadedEntry, FilePathWithPrefix, FilePath, DocumentID, MetaEntry } from "@lib/common/models/db.type";
import type { UXFileInfo, UXStat, UXDataWriteOptions } from "@lib/common/models/fileaccess.type";
import { type InternalFileInfo } from "@/common/types.ts";
import { type CustomRegExp } from "@lib/common/utils.ts";
import type { CustomRegExp } from "@lib/common/utils.regexp.ts";
import { type MapLike } from "@/common/utils.ts";
import { PeriodicProcessor } from "@/common/PeriodicProcessor.ts";
import { LiveSyncCommands } from "@/features/LiveSyncCommands.ts";
@@ -22,7 +21,7 @@ export declare class HiddenFileSync extends LiveSyncCommands {
isThisModuleEnabled(): boolean;
periodicInternalFileScanProcessor: PeriodicProcessor;
get kvDB(): import("../../lib/src/interfaces/KeyValueDatabase").KeyValueDatabase;
getConflictedDoc(path: FilePathWithPrefix, rev: string): Promise<false | import("@lib/common/types.ts").diff_result_leaf>;
getConflictedDoc(path: FilePathWithPrefix, rev: string): Promise<false | import("../../lib/src/common/types").diff_result_leaf>;
onunload(): void;
onload(): void;
private _everyOnDatabaseInitialized;
+5 -6
View File
@@ -1,6 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type AnyEntry, type DocumentID, type FilePath, type FilePathWithPrefix, type LOG_LEVEL } from "@lib/common/types.ts";
import type { AnyEntry, DocumentID, FilePath, FilePathWithPrefix } from "@lib/common/models/db.type";
import type { LOG_LEVEL } from "@lib/common/logger";
import type ObsidianLiveSyncPlugin from "@/main.ts";
import type { LiveSyncCore } from "@/main.ts";
import { createInstanceLogFunction } from "@lib/services/lib/logUtils.ts";
@@ -11,7 +10,7 @@ export declare abstract class LiveSyncCommands {
plugin: ObsidianLiveSyncPlugin;
core: LiveSyncCore;
get app(): import("obsidian").App;
get settings(): import("@lib/common/types.ts").ObsidianLiveSyncSettings;
get settings(): import("../lib/src/common/types").ObsidianLiveSyncSettings;
get localDatabase(): import("../lib/src/pouchdb/LiveSyncLocalDB").LiveSyncLocalDB;
get services(): import("../lib/src/services/InjectableServices").InjectableServiceHub<import("../lib/src/services/implements/obsidian/ObsidianServiceContext").ObsidianServiceContext>;
path2id(filename: FilePathWithPrefix | FilePath, prefix?: string): Promise<DocumentID>;
@@ -27,8 +26,8 @@ export declare abstract class LiveSyncCommands {
_info: (msg: unknown, key?: string) => void;
_notice: (msg: unknown, key?: string) => void;
_progress: (prefix?: string, level?: LOG_LEVEL) => {
log: (msg: string) => void;
once: (msg: string) => void;
log: (msg: unknown) => void;
once: (msg: unknown) => void;
done: (msg?: string) => void;
};
_debug: (msg: unknown, key?: string) => void;
@@ -1,6 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type DocumentID, type EntryDoc, type EntryLeaf } from "@lib/common/types";
import type { DocumentID, EntryLeaf } from "@lib/common/models/db.type";
import type { EntryDoc } from "@lib/common/models/db.definition";
import { LiveSyncCommands } from "@/features/LiveSyncCommands";
type ChunkID = DocumentID;
type NoteDocumentID = DocumentID;
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { App, Modal } from "@/deps.ts";
import { mount } from "svelte";
import type { LiveSyncTrysteroReplicator } from "@lib/replication/trystero/LiveSyncTrysteroReplicator";
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { App } from "@/deps.ts";
import type { LiveSyncTrysteroReplicator } from "@lib/replication/trystero/LiveSyncTrysteroReplicator";
/**
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { Menu, WorkspaceLeaf } from "@/deps.ts";
import { SvelteItemView } from "@/common/SvelteItemView.ts";
import { type PeerStatus } from "@lib/replication/trystero/P2PReplicatorPaneCommon.ts";
@@ -24,7 +22,7 @@ export declare class P2PReplicatorPaneView extends SvelteItemView {
getDisplayText(): string;
onClose(): Promise<void>;
instantiateComponent(target: HTMLElement): {
$on?(type: string, callback: (e: any) => void): () => void; // eslint-disable-line @typescript-eslint/no-explicit-any -- Only type declaration
$set?(props: Partial<Record<string, any>>): void; // eslint-disable-line @typescript-eslint/no-explicit-any -- Only type declaration
} & Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any -- Only type declaration
$on?(type: string, callback: (e: any) => void): () => void; // eslint-disable-line @typescript-eslint/no-explicit-any
$set?(props: Partial<Record<string, any>>): void; // eslint-disable-line @typescript-eslint/no-explicit-any
} & Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
}
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { WorkspaceLeaf } from "@/deps.ts";
import { SvelteItemView } from "@/common/SvelteItemView.ts";
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore.ts";
@@ -15,7 +13,7 @@ export declare class P2PServerStatusPaneView extends SvelteItemView {
getViewType(): string;
getDisplayText(): string;
instantiateComponent(target: HTMLElement): {
$on?(type: string, callback: (e: any) => void): () => void; // eslint-disable-line @typescript-eslint/no-explicit-any -- Only type declaration
$set?(props: Partial<Record<string, any>>): void; // eslint-disable-line @typescript-eslint/no-explicit-any -- Only type declaration
} & Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any -- Only type declaration
$on?(type: string, callback: (e: any) => void): () => void; // eslint-disable-line @typescript-eslint/no-explicit-any
$set?(props: Partial<Record<string, any>>): void; // eslint-disable-line @typescript-eslint/no-explicit-any
} & Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
}
-2
View File
@@ -1,4 +1,2 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export { DirectFileManipulator } from "./DirectFileManipulatorV2.ts";
export type { DirectFileManipulatorOptions } from "./DirectFileManipulatorV2.ts";
+1 -3
View File
@@ -1,6 +1,4 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type ObsidianLiveSyncSettings } from "@lib/common/types";
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
/**
* Encode settings to a tiny array to encode in QRCode,
* Due to size limitation of QR code, we encode settings as an array instead of object.
+1 -7
View File
@@ -1,10 +1,4 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
/**
* Content-Splitter for Self-hosted LiveSync.
* Splits content into manageable chunks for efficient storage and synchronisation.
*/
import { type FilePathWithPrefix } from "@lib/common/types.ts";
import type { FilePathWithPrefix } from "@lib/common/models/db.type";
import type { ISettingService } from "@lib/services/base/IService.ts";
/**
* ContentSplitter interface for splitting content into chunks.
@@ -1,6 +1,4 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type SavingEntry } from "@lib/common/types.ts";
import type { SavingEntry } from "@lib/common/models/db.type";
import { type ContentSplitterOptions, type SplitOptions } from "./ContentSplitter.ts";
export declare abstract class ContentSplitterCore {
/**
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ContentSplitterOptions, SplitOptions } from "./ContentSplitter.ts";
import { ContentSplitterBase } from "./ContentSplitterBase.ts";
/**
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ContentSplitterOptions, SplitOptions } from "./ContentSplitter";
import { ContentSplitterBase } from "./ContentSplitterBase";
/**
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ContentSplitterOptions, SplitOptions } from "./ContentSplitter.ts";
import { ContentSplitterBase } from "./ContentSplitterBase.ts";
/**
+1 -3
View File
@@ -1,6 +1,4 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { SavingEntry } from "@lib/common/types";
import type { SavingEntry } from "@lib/common/models/db.type";
import type { ContentSplitterOptions } from "./ContentSplitter";
import { ContentSplitterCore, type ContentSplitterBase } from "./ContentSplitterBase";
/**
-2
View File
@@ -1,4 +1,2 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export type { HasSetResult, HasGetInitialData, ComponentHasResult, GuestDialogProps, DialogSvelteComponentBaseProps, DialogControlBase, } from "@lib/services/implements/base/SvelteDialog.ts";
export { CONTEXT_DIALOG_CONTROLS, setupDialogContext, getDialogContext, SvelteDialogManagerBase, } from "@lib/services/implements/base/SvelteDialog.ts";
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type SlipBoard } from "octagonal-wheels/bureau/SlipBoard";
declare global {
interface Slips extends LSSlips {
+1 -3
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { CouchDBConnection, BucketSyncSetting, P2PConnectionInfo } from "./models/setting.type";
export type RemoteConfigurationResult = {
type: "couchdb";
@@ -12,7 +10,7 @@ export type RemoteConfigurationResult = {
settings: P2PConnectionInfo;
} | {
type: "webdav";
settings: never;
settings: any; // eslint-disable-line @typescript-eslint/no-explicit-any
};
export declare class ConnectionStringParser {
/**
+1 -4
View File
@@ -1,6 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { Constructor } from "@lib/common/utils.type";
interface ErrorWithCause extends Error {
cause?: unknown;
}
@@ -37,7 +34,7 @@ export declare class LiveSyncError extends Error implements ErrorWithCause {
* @example
* LiveSyncError.isCausedBy(someSyncParamsFetchError, SyncParamsNotFoundError); // Returns true if the error is caused by SyncParamsNotFoundError; this is usually represented as SyncParamsFetchError at the uppermost layer.
*/
static isCausedBy<T extends LiveSyncError>(error: unknown, errorClass: Constructor<T>): boolean;
static isCausedBy<T extends LiveSyncError>(error: unknown, errorClass: new (...args: any[]) => T): boolean; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Creates a new instance of the error class from an existing error.
* @param error The error to wrap.
+5 -6
View File
@@ -1,7 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { Confirm } from "@lib/interfaces/Confirm";
import { type ObsidianLiveSyncSettings } from "./types";
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
declare enum ConditionType {
PLATFORM_CASE_INSENSITIVE = "platform-case-insensitive",
PLATFORM_CASE_SENSITIVE = "platform-case-sensitive",
@@ -27,7 +25,7 @@ type BaseRule<TType extends string, TValue> = {
valueDisplayFunc?: (settings: Partial<ObsidianLiveSyncSettings>) => string;
obsoleteValues?: TValue[];
};
type NumberRuleExact = BaseRule<"number", number> & {}; // eslint-disable-line @typescript-eslint/no-empty-object-type, @typescript-eslint/ban-types -- Empty object type
type NumberRuleExact = BaseRule<"number", number> & {};
type NumberRuleRange = BaseRule<"number", number> & {
min?: number;
max?: number;
@@ -38,9 +36,10 @@ type StringRangeRule = BaseRule<"string", string> & {
maxLength?: number;
regexp?: string;
};
type StringRule = BaseRule<"string", string> & {}; // eslint-disable-line @typescript-eslint/no-empty-object-type, @typescript-eslint/ban-types -- Empty object type
type BooleanRule = BaseRule<"boolean", boolean> & {}; // eslint-disable-line @typescript-eslint/no-empty-object-type, @typescript-eslint/ban-types -- Empty object type
type StringRule = BaseRule<"string", string> & {};
type BooleanRule = BaseRule<"boolean", boolean> & {};
export type RuleForType<T> = T extends number ? NumberRuleExact | NumberRuleRange : T extends string ? StringRule | StringRangeRule : T extends boolean ? BooleanRule : never;
export type AnyRule = NumberRuleExact | NumberRuleRange | StringRule | StringRangeRule | BooleanRule;
type DoctorCheckSettings = Omit<Partial<ObsidianLiveSyncSettings>, "remoteConfigurations" | "pluginSyncExtendedSetting">;
export type DoctorRegulation = {
version: string;
+16
View File
@@ -0,0 +1,16 @@
declare class Context<T extends Record<string | number | symbol, any> = object> { // eslint-disable-line @typescript-eslint/no-explicit-any
_data: Partial<T>;
children: WeakRef<Context<T>>[];
parent?: Context<T>;
constructor(base?: Context<T>, data?: Partial<T>);
set<V extends keyof T>(key: V, value: T[V]): void;
get<V extends keyof T>(key: V): T[V] | undefined;
setInGlobalContext<V extends keyof T>(key: V, value: T[V]): void;
setInNearestContext<V extends keyof T>(key: V, value: T[V]): void;
spawnContext<V extends Record<string, any>>(data?: V): Context<V & T>; // eslint-disable-line @typescript-eslint/no-explicit-any
_disposeChild(child: Context<any>): void; // eslint-disable-line @typescript-eslint/no-explicit-any
dispose(): void;
}
export declare function getContext<T extends U, U extends Record<string, any> = object>(data?: T): Context<T & object>; // eslint-disable-line @typescript-eslint/no-explicit-any
export declare function getIndependentContext<T extends U, U extends Record<string, any> = object>(data?: T): Context<T>; // eslint-disable-line @typescript-eslint/no-explicit-any
export {};
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { getLanguage as ObsidianGetLanguage } from "obsidian";
export declare function setGetLanguage(func: typeof ObsidianGetLanguage): void;
export declare function getLanguage(): string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
declare const manifestVersion: string;
declare const packageVersion: string;
export { manifestVersion, packageVersion };
+1 -3
View File
@@ -1,7 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { AllMessageKeys, I18N_LANGS } from "./rosetta";
import type { TaggedType } from "./types";
import type { TaggedType } from "@lib/common/models/shared.type.util";
export declare let currentLang: I18N_LANGS;
export declare function getResolvedLang(lang?: I18N_LANGS): I18N_LANGS;
export declare function isAutoDisplayLanguage(lang: I18N_LANGS): boolean;
-2
View File
@@ -1,4 +1,2 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export * from "octagonal-wheels/common/logger";
export type * from "octagonal-wheels/common/logger";
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { PartialMessages as def } from "./def.ts";
import { type MESSAGE } from "@lib/common/rosetta.ts";
type MessageKeys = keyof typeof def.def;
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const allMessages: {
readonly "(Active)": {
readonly def: "(Active)";
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly de: {
"(Active)": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly def: {
"(Active)": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly es: {
"(Active)": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly fr: {
"(BETA) Always overwrite with a newer file": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly he: {
"(BETA) Always overwrite with a newer file": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly ja: {
"(Active)": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly ko: {
"(Active)": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly ru: {
"(Active)": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly "zh-tw": {
"(Active)": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly zh: {
"(Active)": string;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export type CouchDBCredentials = BasicCredentials | JWTCredentials;
export type JWTAlgorithm = "HS256" | "HS512" | "ES256" | "ES512" | "";
export type Credential = {
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { DocumentID } from "./db.type";
export declare const VERSIONING_DOCID: DocumentID;
export declare const MILESTONE_DOCID: DocumentID;
+2 -4
View File
@@ -1,7 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { MILESTONE_DOCID, NODEINFO_DOCID } from "./db.const";
import type { AnyEntry, ChunkVersionRange, DatabaseEntry, EntryChunkPack, EntryLeaf, EntryTypes, EntryVersionInfo, InternalFileEntry, LoadedEntry, MetaEntry, NewEntry, NoteEntry, PlainEntry } from "./db.type";
import type { AnyEntry, ChunkVersionRange, DatabaseEntry, EntryChunkPack, EntryLeaf, EntryTypes, EntryVersionInfo, LoadedEntry, MetaEntry } from "./db.type";
import type { TweakValues } from "./tweak.definition";
export type NodeKey = string;
export interface DeviceInfo {
@@ -52,7 +50,7 @@ export interface EntryNodeInfo extends DatabaseEntry {
nodeid: string;
v20220607?: boolean;
}
export type EntryBody = NoteEntry | NewEntry | PlainEntry | InternalFileEntry;
export type EntryBody = AnyEntry;
export type EntryDoc = EntryBody | LoadedEntry | EntryLeaf | EntryVersionInfo | EntryMilestoneInfo | EntryNodeInfo | EntryChunkPack;
export type EntryDocResponse = EntryDoc & PouchDB.Core.IdMeta & PouchDB.Core.GetMeta;
export declare function isMetaEntry(entry: AnyEntry): entry is MetaEntry;
+74 -43
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { TaggedType } from "octagonal-wheels/common/types";
import type { EntryTypes, SYNCINFO_ID } from "./db.const";
export type FilePath = TaggedType<string, "FilePath">;
@@ -34,7 +32,7 @@ export interface DatabaseEntry {
/**
* Represents the base structure for an entry that represents a file.
*/
export type EntryBase = {
export interface EntryBase {
/**
* The creation time of the file.
*/
@@ -51,7 +49,7 @@ export type EntryBase = {
* Deleted flag.
*/
deleted?: boolean;
};
}
export type EdenChunk = {
data: string;
epoch: number;
@@ -59,72 +57,106 @@ export type EdenChunk = {
export type EntryWithEden = {
eden: Record<DocumentID, EdenChunk>;
};
export type NoteEntry = DatabaseEntry & EntryBase & EntryWithEden & {
/**
* Represents the common fields for all database entries representing physical files.
*/
export interface FileEntryBase extends DatabaseEntry, EntryBase, EntryWithEden {
/**
* The path of the file.
*/
path: FilePathWithPrefix;
}
/**
* Contents of the file.
* Represents an entry that contains children (chunk IDs).
*/
data: string | string[];
export interface EntryWithChildren {
/**
* Chunk IDs indicating the contents of the file.
*/
children: string[];
}
/**
* Represents an entry that contains content data.
*/
export interface EntryWithData<T = string | string[] | Blob> {
/**
* Contents / payload of the entry.
*/
data: T;
}
/**
* Represents an entry that contains document body text.
*/
export type EntryWithBody = EntryWithData<string | string[]>;
/**
* Represents an entry that contains a binary Blob.
*/
export type EntryWithBlob = EntryWithData<Blob>;
/**
* Represents a legacy note entry where file content is stored directly in the metadata.
*/
export interface NoteEntry extends FileEntryBase, EntryWithBody {
/**
* The type of the entry.
*/
type: EntryTypes["NOTE_LEGACY"];
};
export type NewEntry = DatabaseEntry & EntryBase & EntryWithEden & {
}
/**
* The path of the file.
* Represents a chunk-split binary file entry.
*/
path: FilePathWithPrefix;
/**
* Chunk IDs indicating the contents of the file.
*/
children: string[];
export interface NewEntry extends FileEntryBase, EntryWithChildren {
/**
* The type of the entry.
*/
type: EntryTypes["NOTE_BINARY"];
};
export type PlainEntry = DatabaseEntry & EntryBase & EntryWithEden & {
}
/**
* The path of the file.
* Represents a chunk-split plain text file entry.
*/
path: FilePathWithPrefix;
/**
* Chunk IDs indicating the contents of the file.
*/
children: string[];
export interface PlainEntry extends FileEntryBase, EntryWithChildren {
/**
* The type of the entry.
*/
type: EntryTypes["NOTE_PLAIN"];
};
export type InternalFileEntry = DatabaseEntry & NewEntry & EntryBase & {
deleted?: boolean;
};
export type AnyEntry = NoteEntry | NewEntry | PlainEntry | InternalFileEntry;
export type LoadedEntry = AnyEntry & {
data: string | string[];
}
/**
* Represents a customization / configuration file entry.
* @deprecated Use NewEntry or PlainEntry directly.
*/
export type InternalFileEntry = NewEntry;
/**
* Represents any file-related database entry.
*/
export type AnyEntry = NoteEntry | NewEntry | PlainEntry;
/**
* Represents a file entry after its contents have been loaded and assembled.
*/
export type LoadedEntry = AnyEntry & EntryWithBody & {
datatype: EntryTypeNotes;
};
export type SavingEntry = AnyEntry & {
data: Blob;
/**
* Represents a file entry prepared for saving.
*/
export type SavingEntry = AnyEntry & EntryWithBlob & {
datatype: EntryTypeNotes;
};
export type MetaEntry = AnyEntry & {
children: string[];
};
export type EntryLeaf = DatabaseEntry & {
/**
* Represents a metadata entry (chunked file entry) without full content.
*/
export type MetaEntry = NewEntry | PlainEntry;
/**
* Represents a leaf (chunk) document in the database.
*/
export interface EntryLeaf extends DatabaseEntry, EntryWithData<string> {
type: EntryTypes["CHUNK"];
data: string;
isCorrupted?: boolean;
};
export type EntryChunkPack = DatabaseEntry & {
}
/**
* Represents a chunk pack document.
*/
export interface EntryChunkPack extends DatabaseEntry, EntryWithData<string> {
type: EntryTypes["CHUNK_PACK"];
data: string;
};
}
export interface EntryVersionInfo extends DatabaseEntry {
type: EntryTypes["VERSION_INFO"];
version: number;
@@ -137,8 +169,7 @@ export interface ChunkVersionRange {
max: number;
current: number;
}
export interface SyncInfo extends DatabaseEntry {
export interface SyncInfo extends DatabaseEntry, EntryWithData<string> {
_id: typeof SYNCINFO_ID;
type: EntryTypes["SYNC_INFO"];
data: string;
}
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { AUTO_MERGED, CANCELLED, MISSING_OR_ERROR, NOT_CONFLICTED } from "./shared.const.symbols";
export type diff_result_leaf = {
rev: string;
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const CHeader = "h:";
export declare const PSCHeader = "ps:";
export declare const PSCHeaderEnd = "ps;";
+36 -27
View File
@@ -1,41 +1,50 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { FilePath, FilePathWithPrefix } from "./db.type";
export type UXStat = {
export interface UXStat {
size: number;
mtime: number;
ctime: number;
type: "file" | "folder";
};
export type UXFileInfoStub = {
}
/**
* Represents the common base properties for any filesystem object stub.
*/
export interface UXFileSystemStubBase {
name: string;
path: FilePath | FilePathWithPrefix;
stat: UXStat;
deleted?: boolean;
isFolder?: false;
isInternal?: boolean;
};
export type UXFileInfo = UXFileInfoStub & {
}
/**
* Represents a stub for a regular file.
*/
export interface UXFileInfoStub extends UXFileSystemStubBase {
stat: UXStat;
isFolder?: false;
}
/**
* Represents a complete file containing its binary body.
*/
export interface UXFileInfo extends UXFileInfoStub {
body: Blob;
};
}
export type UXAbstractInfoStub = UXFileInfoStub | UXFolderInfo;
export type UXInternalFileInfoStub = {
name: string;
path: FilePath | FilePathWithPrefix;
deleted?: boolean;
/**
* Represents a stub for an internal/hidden file.
*/
export interface UXInternalFileInfoStub extends UXFileSystemStubBase {
isFolder?: false;
isInternal: true;
stat: undefined;
};
export type UXFolderInfo = {
name: string;
path: FilePath | FilePathWithPrefix;
deleted?: boolean;
}
/**
* Represents information about a folder.
*/
export interface UXFolderInfo extends UXFileSystemStubBase {
isFolder: true;
children: UXFileInfoStub[];
parent: FilePath | FilePathWithPrefix | undefined;
};
export type UXDataWriteOptions = {
}
export interface UXDataWriteOptions {
/**
* Time of creation, represented as a unix timestamp, in milliseconds.
* Omit this if you want to keep the default behaviour.
@@ -46,25 +55,25 @@ export type UXDataWriteOptions = {
* Time of last modification, represented as a unix timestamp, in milliseconds.
* Omit this if you want to keep the default behaviour.
* @public
*/
* */
mtime?: number;
};
}
export type CacheData = string | ArrayBuffer;
export type FileEventType = "CREATE" | "DELETE" | "CHANGED" | "INTERNAL";
export type FileEventArgs = {
export interface FileEventArgs {
file: UXFileInfoStub | UXInternalFileInfoStub;
cache?: CacheData;
oldPath?: string;
ctx?: unknown;
};
export type FileEventItem = {
}
export interface FileEventItem {
type: FileEventType;
args: FileEventArgs;
key: string;
skipBatchWait?: boolean;
cancelled?: boolean;
batched?: boolean;
};
}
export interface FileWithFileStat extends Omit<UXStat, "type"> {
path: FilePath;
}
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { FilePath } from "./db.type";
export declare const PREFIXMD_LOGFILE = "livesync_log_";
export declare const PREFIXMD_LOGFILE_UC = "LIVESYNC_LOG_";
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const SETTING_VERSION_INITIAL = 0;
export declare const SETTING_VERSION_SUPPORT_CASE_INSENSITIVE = 10;
export declare const CURRENT_SETTING_VERSION = 10;
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type ObsidianLiveSyncSettings, type P2PSyncSetting } from "./setting.type";
export declare const P2P_DEFAULT_SETTINGS: P2PSyncSetting;
export declare const DEFAULT_SETTINGS: ObsidianLiveSyncSettings;
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ObsidianLiveSyncSettings } from "./setting.type";
export declare const PREFERRED_BASE: Partial<ObsidianLiveSyncSettings>;
export declare const PREFERRED_SETTING_CLOUDANT: Partial<ObsidianLiveSyncSettings>;
@@ -1,4 +1,2 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ObsidianLiveSyncSettings } from "./setting.type";
export declare const KeyIndexOfSettings: Record<keyof ObsidianLiveSyncSettings, number>;
+1 -10
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ChunkAlgorithms, E2EEAlgorithms, HashAlgorithms, MODE_AUTOMATIC, MODE_PAUSED, MODE_SELECTIVE, MODE_SHINY, RemoteTypes } from "./setting.const";
import type { I18N_LANGS } from "@lib/common/rosetta";
import type { CustomRegExpSourceList } from "./shared.type.util";
@@ -97,13 +95,6 @@ interface SyncMethodSettings {
* Different from syncOnSave, this is only reacts to the editor save event.
*/
syncOnEditorSave: boolean;
/**
* Desktop only, opt-in. Keep replication running while the window is hidden or minimised,
* instead of suspending it until the window becomes visible again. The trigger is
* document.hidden, not window focus. Applies to the background-capable sync modes (LiveSync
* and Periodic). Ignored on mobile. Default false.
*/
keepReplicationActiveInBackground: boolean;
/**
* The minimum delay between synchronisation operations (in milliseconds).
* If the operation is triggered before this delay, the operation will be delayed until the delay is over, and executed as a single operation.
@@ -892,7 +883,7 @@ export interface RemoteConfigurations {
*/
P2P_ActiveRemoteConfigurationId: string;
}
interface ObsidianLiveSyncSettings_PluginSetting extends SyncMethodSettings, UISettings, FileHandlingSettings, MergeBehaviourSettings, EncryptedUserSettings, PeriodicReplicationSettings, InternalFileSettings, PluginSyncSettings, ModeSettings, ExtraTweakSettings, BetaTweakSettings, ObsoleteSettings, DebugModeSettings, SettingSyncSettings, SafetyValveSettings, DataOnSettings, RemoteConfigurations { // eslint-disable-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-empty-interface -- Empty interface
interface ObsidianLiveSyncSettings_PluginSetting extends SyncMethodSettings, UISettings, FileHandlingSettings, MergeBehaviourSettings, EncryptedUserSettings, PeriodicReplicationSettings, InternalFileSettings, PluginSyncSettings, ModeSettings, ExtraTweakSettings, BetaTweakSettings, ObsoleteSettings, DebugModeSettings, SettingSyncSettings, SafetyValveSettings, DataOnSettings, RemoteConfigurations {
}
export type RemoteDBSettings = CouchDBConnection & BucketSyncSetting & RemoteTypeSettings & EncryptionSettings & ChunkSettings & EdenSettings & DataOnRemoteDBSettings & ObsoleteRemoteDBSettings & OnDemandChunkSettings & BetaRemoteDBSettings & ReplicationSetting & RemoteDBTweakSettings & FileHandlingSettings & ProcessingBehaviourSettings & OptionalAndNotExposedRemoteDBSettings & CrossPlatformInteroperabilitySettings & ConflictHandlingSettings & EdgeCaseHandlingSettings & DeletedFileMetadataSettings & P2PSyncSetting & RemoteConfigurations;
export type ObsidianLiveSyncSettings = ObsidianLiveSyncSettings_PluginSetting & RemoteDBSettings & LocalDBSettings;
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const MAX_DOC_SIZE = 1000;
export declare const MAX_DOC_SIZE_BIN = 102400;
export declare const VER = 12;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const SETTING_KEY_P2P_DEVICE_NAME = "p2p_device_name";
export declare const configURIBase = "obsidian://setuplivesync?settings=";
export declare const configURIBaseQR = "obsidian://setuplivesync?settingsQR=";
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const CANCELLED: unique symbol;
export declare const AUTO_MERGED: unique symbol;
export declare const NOT_CONFLICTED: unique symbol;
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ObsidianLiveSyncSettings } from "./setting.type";
export declare const LEVEL_ADVANCED = "ADVANCED";
export declare const LEVEL_POWER_USER = "POWER_USER";
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const DatabaseConnectingStatuses: {
readonly STARTED: "STARTED";
readonly NOT_CONNECTED: "NOT_CONNECTED";
+1 -3
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { TaggedType } from "octagonal-wheels/common/types";
export type { TaggedType };
export type CustomRegExpSource = TaggedType<string, "CustomRegExp">;
@@ -7,4 +5,4 @@ export type CustomRegExpSourceList<D extends string = ","> = TaggedType<string,
export type ParsedCustomRegExp = [isInverted: boolean, pattern: string];
export type Prettify<T> = {
[K in keyof T]: T[K];
} & {}; // eslint-disable-line @typescript-eslint/no-empty-object-type, @typescript-eslint/ban-types -- Empty object type
} & {};
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { EntryTypes } from "./db.const";
import type { DatabaseEntry, DocumentID } from "./db.type";
export declare const ProtocolVersions: {
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ObsidianLiveSyncSettings } from "./setting.type";
export declare const TweakValuesShouldMatchedTemplate: Partial<ObsidianLiveSyncSettings>;
type TweakKeys = keyof TweakValues;
@@ -26,7 +24,6 @@ export declare const TweakValuesTemplate: {
syncOnStart?: boolean | undefined;
syncOnFileOpen?: boolean | undefined;
syncOnEditorSave?: boolean | undefined;
keepReplicationActiveInBackground?: boolean | undefined;
syncMinimumInterval?: number | undefined;
showVerboseLog?: boolean | undefined;
lessInformationInLog?: boolean | undefined;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
/**
# Rosetta stone
- To localise messages to your language, please write a translation to this file and submit a PR.
+11 -13
View File
@@ -1,6 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type ConfigurationItem, type ObsidianLiveSyncSettings } from "./types.ts";
import type { ConfigurationItem } from "@lib/common/models/shared.definition.configNames";
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
type ExtractPropertiesByType<T, U> = {
[K in keyof T as T[K] extends U ? K : never]: T[K] extends U ? K : never;
};
@@ -35,7 +34,6 @@ export declare const AllSettingDefault: {
syncOnStart: boolean;
syncOnFileOpen: boolean;
syncOnEditorSave: boolean;
keepReplicationActiveInBackground: boolean;
syncMinimumInterval: number;
showVerboseLog: boolean;
lessInformationInLog: boolean;
@@ -61,7 +59,7 @@ export declare const AllSettingDefault: {
resolveConflictsByNewerFile: boolean;
writeDocumentsIfConflicted: boolean;
disableMarkdownAutoMerge: boolean;
configPassphraseStore: import("./types.ts").ConfigPassphraseStore;
configPassphraseStore: import("@lib/common/models/setting.type").ConfigPassphraseStore;
encryptedPassphrase: string;
encryptedCouchDBConnection: string;
periodicReplication: boolean;
@@ -82,7 +80,7 @@ export declare const AllSettingDefault: {
notifyPluginOrSettingUpdated: boolean;
usePluginSyncV2: boolean;
usePluginEtc: boolean;
pluginSyncExtendedSetting: Record<import("./types.ts").PluginSyncSettingEntry["key"], import("./types.ts").PluginSyncSettingEntry>;
pluginSyncExtendedSetting: Record<import("@lib/common/models/setting.type").PluginSyncSettingEntry["key"], import("@lib/common/models/setting.type").PluginSyncSettingEntry>;
useAdvancedMode: boolean;
usePowerUserMode: boolean;
useEdgeCaseMode: boolean;
@@ -107,7 +105,7 @@ export declare const AllSettingDefault: {
isConfigured?: boolean;
lastReadUpdates: number;
doctorProcessedVersion: string;
remoteConfigurations: Record<string, import("./models/setting.type.ts").RemoteConfiguration>;
remoteConfigurations: Record<string, import("@lib/common/models/setting.type").RemoteConfiguration>;
activeConfigurationId: string;
P2P_ActiveRemoteConfigurationId: string;
couchDB_URI: string;
@@ -131,19 +129,19 @@ export declare const AllSettingDefault: {
bucketCustomHeaders: string;
bucketPrefix: string;
forcePathStyle: boolean;
remoteType: import("./types.ts").RemoteType;
remoteType: import("@lib/common/models/setting.type").RemoteType;
encrypt: boolean;
passphrase: string;
usePathObfuscation: boolean;
E2EEAlgorithm: import("./types.ts").E2EEAlgorithm;
hashAlg: import("./types.ts").HashAlgorithm;
E2EEAlgorithm: import("@lib/common/models/setting.type").E2EEAlgorithm;
hashAlg: import("@lib/common/models/setting.type").HashAlgorithm;
minimumChunkSize: number;
customChunkSize: number;
longLineThreshold: number;
useSegmenter: boolean;
enableChunkSplitterV2: boolean;
doNotUseFixedRevisionForChunks: boolean;
chunkSplitterVersion: import("./types.ts").ChunkSplitterVersion;
chunkSplitterVersion: import("@lib/common/models/setting.type").ChunkSplitterVersion;
useEden: boolean;
maxChunksInEden: number;
maxTotalLengthInEden: number;
@@ -176,7 +174,7 @@ export declare const AllSettingDefault: {
useTimeouts: boolean;
deleteMetadataOfDeletedFiles: boolean;
automaticallyDeleteMetadataOfDeletedFiles: number;
P2P_AutoAccepting: import("./types.ts").AutoAccepting;
P2P_AutoAccepting: import("@lib/common/models/setting.type").AutoAccepting;
P2P_AutoSyncPeers: string;
P2P_AutoWatchPeers: string;
P2P_SyncOnReplication: string;
@@ -210,7 +208,7 @@ export declare function getConfig(key: AllSettingItemKey): false | {
placeHolder?: string;
status?: "BETA" | "ALPHA" | "EXPERIMENTAL";
obsolete?: boolean;
level?: import("./types.ts").ConfigLevel;
level?: import("@lib/common/models/shared.definition.configNames").ConfigLevel;
isHidden?: boolean;
isAdvanced?: boolean;
};
+1 -3
View File
@@ -1,7 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { DocumentID, FilePath, FilePathWithPrefix } from "./models/db.type";
import type { UXFileInfoStub } from "./types";
import type { UXFileInfoStub } from "@lib/common/models/fileaccess.type";
/**
* returns is internal chunk of file
* @param id ID
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export type { TaggedType } from "./models/shared.type.util.ts";
export { LOG_LEVEL_DEBUG, LOG_LEVEL_INFO, LOG_LEVEL_NOTICE, LOG_LEVEL_URGENT, LOG_LEVEL_VERBOSE, } from "octagonal-wheels/common/logger";
export type { LOG_LEVEL } from "octagonal-wheels/common/logger";
+10
View File
@@ -0,0 +1,10 @@
export declare function resolveWithIgnoreKnownError<T>(p: Promise<T>, def: T): Promise<T>;
export declare const Parallels: (ps?: Set<Promise<unknown>>) => {
add: (p: Promise<unknown>) => Set<Promise<unknown>>;
wait: (limit: number) => false | Promise<unknown>;
all: () => Promise<unknown[]>;
};
export declare function allSettledWithConcurrencyLimit<T>(processes: Promise<T>[], limit: number): Promise<void>;
export declare const globalConcurrencyController: import("octagonal-wheels/concurrency/semaphore_v2").SemaphoreObject;
export declare function wrapException<T>(func: () => Promise<Awaited<T>>): Promise<Awaited<T> | Error>;
export declare function wrapByDefault<T, U>(func: () => T, onError: (err: Error) => U): T | U;
+8 -114
View File
@@ -1,6 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type AnyEntry, type DatabaseEntry, type EntryLeaf, type SyncInfo, type LoadedEntry, type SavingEntry, type NewEntry, type PlainEntry, type CustomRegExpSource, type ParsedCustomRegExp, type CustomRegExpSourceList, type ObsidianLiveSyncSettings, type RemoteDBSettings, type P2PConnectionInfo, type BucketSyncSetting, type CouchDBConnection, type EncryptionSettings } from "./types.ts";
import { replaceAll, replaceAllPairs } from "octagonal-wheels/string";
export { replaceAll, replaceAllPairs };
import { concatUInt8Array } from "octagonal-wheels/binary";
@@ -16,116 +13,13 @@ export { sendValue, sendSignal, waitForSignal, waitForValue };
import { throttle } from "octagonal-wheels/function";
export { throttle };
import type { SimpleStore } from "octagonal-wheels/databases/SimpleStoreBase";
import { BASE_IS_NEW, EVEN, TARGET_IS_NEW } from "./models/shared.const.symbols.ts";
export type { SimpleStore };
export { sizeToHumanReadable } from "octagonal-wheels/number";
export declare function resolveWithIgnoreKnownError<T>(p: Promise<T>, def: T): Promise<T>;
export declare const Parallels: (ps?: Set<Promise<unknown>>) => {
add: (p: Promise<unknown>) => Set<Promise<unknown>>;
wait: (limit: number) => false | Promise<unknown>;
all: () => Promise<unknown[]>;
};
export declare function allSettledWithConcurrencyLimit<T>(processes: Promise<T>[], limit: number): Promise<void>;
export declare function getDocData(doc: string | string[]): string;
export declare function getDocDataAsArray(doc: string | string[]): string[];
export declare function getDocDataAsArrayBuffer(doc: string | string[] | ArrayBuffer): Uint8Array;
export declare function isTextBlob(blob: Blob): boolean;
export declare function createTextBlob(data: string | string[]): Blob;
export declare function createBinaryBlob(data: Uint8Array | ArrayBuffer): Blob;
export declare function createBlob(data: string | string[] | Uint8Array | ArrayBuffer | Blob): Blob;
export declare function isTextDocument(doc: LoadedEntry): boolean;
export declare function readAsBlob(doc: LoadedEntry): Blob;
export declare function readContent(doc: LoadedEntry): string | ArrayBuffer;
export declare function isDocContentSame(docA: string | string[] | Blob | ArrayBuffer, docB: string | string[] | Blob | ArrayBuffer): Promise<boolean>;
export declare function isObfuscatedEntry(doc: DatabaseEntry): doc is AnyEntry;
export declare function isEncryptedChunkEntry(doc: DatabaseEntry): doc is EntryLeaf;
export declare function isSyncInfoEntry(doc: DatabaseEntry): doc is SyncInfo;
export declare function memorizeFuncWithLRUCache<T, U>(func: (key: T) => U): (key: T) => U | undefined;
export declare function memorizeFuncWithLRUCacheMulti<T extends unknown[], U>(func: (...keys: T) => U): (keys: T) => U | undefined;
/**
*
* @param exclusion return only not exclusion
* @returns
*
* ["something",false,"aaaaa"].filter(onlyNot(false)) => yields ["something","aaaaaa"]. but, as string[].
*/
export declare function onlyNot<A, B>(exclusion: B): (item: A | B) => item is Exclude<A, B>;
/**
* Run task with keeping minimum interval
* @param key waiting key
* @param interval interval (ms)
* @param task task to perform.
* @returns result of task
* @remarks This function is not designed to be concurrent.
*/
export declare function runWithInterval<T>(key: string, interval: number, task: () => Promise<T>): Promise<T>;
/**
* Run task with keeping minimum interval on start
* @param key waiting key
* @param interval interval (ms)
* @param task task to perform.
* @returns result of task
* @remarks This function is not designed to be concurrent.
*/
export declare function runWithStartInterval<T>(key: string, interval: number, task: () => Promise<T>): Promise<T>;
export declare const globalConcurrencyController: import("octagonal-wheels/concurrency/semaphore_v2").SemaphoreObject;
export declare function determineTypeFromBlob(data: Blob): "newnote" | "plain";
export declare function determineType(path: string, data: string | string[] | Uint8Array | ArrayBuffer | Blob): "newnote" | "plain";
export declare function isAnyNote(doc: DatabaseEntry): doc is NewEntry | PlainEntry;
export declare function isLoadedEntry(doc: DatabaseEntry): doc is LoadedEntry;
export declare function isDeletedEntry(doc: LoadedEntry): boolean;
export declare function createSavingEntryFromLoadedEntry(doc: LoadedEntry): SavingEntry;
export declare function setAllItems<T>(set: Set<T>, items: T[]): Set<T>;
export declare function escapeNewLineFromString(str: string): string;
export declare function unescapeNewLineFromString(str: string): string;
export declare function escapeMarkdownValue<T>(value: T): T;
export declare function timeDeltaToHumanReadable(delta: number): string;
export declare function wrapException<T>(func: () => Promise<Awaited<T>>): Promise<Awaited<T> | Error>;
export declare function toRanges(sorted: number[]): string;
export declare function isDirty(key: string, value: unknown): boolean;
export declare function tryParseJSON<T extends object>(str: string, fallbackValue?: T): T | undefined;
export { mergeObject, applyPatch, generatePatchObj, flattenObject, isObjectMargeApplicable, isSensibleMargeApplicable, } from "./utils.patch.ts";
export declare function parseHeaderValues(strHeader: string): Record<string, string>;
/***
* Parse custom regular expression
* @param regexp
* @returns [negate: boolean, regexp: string]
* @example `!!foo` => [true, "foo"]
* @example `foo` => [false, "foo"]
*/
export declare function parseCustomRegExp(regexp: CustomRegExpSource): ParsedCustomRegExp;
export declare function matchRegExp(regexp: CustomRegExpSource, target: string): boolean;
export declare function isValidRegExp(regexp: CustomRegExpSource): boolean;
export declare function isInvertedRegExp(regexp: CustomRegExpSource): boolean;
export declare function constructCustomRegExpList<D extends string>(items: CustomRegExpSource[], delimiter: D): CustomRegExpSourceList<D>;
export declare function splitCustomRegExpList<D extends string>(list: CustomRegExpSourceList<D>, delimiter: D): CustomRegExpSource[];
export declare class CustomRegExp {
regexp: RegExp;
negate: boolean;
pattern: string;
constructor(regexp: CustomRegExpSource, flags?: string);
test(str: string): boolean;
}
type RegExpSettingKey = "syncOnlyRegEx" | "syncIgnoreRegEx" | "syncInternalFilesIgnorePatterns" | "syncInternalFilesTargetPatterns" | "syncInternalFileOverwritePatterns";
export declare function getFileRegExp(settings: ObsidianLiveSyncSettings | RemoteDBSettings, key: RegExpSettingKey): CustomRegExp[];
/**
* Copies properties from the source object to the target object only if they exist in the target.
* @param source The object to copy properties from.
* @param target The object to copy properties to.
*/
export declare function copyTo<T extends object, U extends T>(source: U, target: T): void;
export declare function pickBucketSyncSettings(setting: ObsidianLiveSyncSettings): BucketSyncSetting;
export declare function pickCouchDBSyncSettings(setting: ObsidianLiveSyncSettings): CouchDBConnection;
export declare function pickEncryptionSettings(setting: ObsidianLiveSyncSettings | EncryptionSettings): EncryptionSettings;
export declare function pickP2PSyncSettings(setting: Partial<ObsidianLiveSyncSettings> & P2PConnectionInfo): P2PConnectionInfo;
export declare function wrapByDefault<T, U>(func: () => T, onError: (err: Error) => U): T | U;
export declare function compareMTime(baseMTime: number, targetMTime: number): typeof BASE_IS_NEW | typeof TARGET_IS_NEW | typeof EVEN;
export declare function displayRev(rev: string): string;
/**
* Generate a random P2P Room ID in the format `123-456-789-abc`.
*/
export declare function generateP2PRoomId(): string;
/**
* Extract the stable suffix (last segment) from a Room ID.
*/
export declare function extractP2PRoomSuffix(roomId: string): string;
export * from "./utils.concurrency";
export * from "./utils.timer";
export * from "./utils.notations";
export * from "./utils.database";
export * from "./utils.regexp";
export * from "./utils.settings";
export * from "./utils.patch";
export * from "./utils.misc";
+23
View File
@@ -0,0 +1,23 @@
import type { AnyEntry, DatabaseEntry, EntryLeaf, SyncInfo, LoadedEntry, SavingEntry, NewEntry, PlainEntry } from "@lib/common/models/db.type";
import { BASE_IS_NEW, EVEN, TARGET_IS_NEW } from "./models/shared.const.symbols.ts";
export declare function getDocData(doc: string | string[]): string;
export declare function getDocDataAsArray(doc: string | string[]): string[];
export declare function getDocDataAsArrayBuffer(doc: string | string[] | ArrayBuffer): Uint8Array<ArrayBuffer>;
export declare function isTextBlob(blob: Blob): boolean;
export declare function createTextBlob(data: string | string[]): Blob;
export declare function createBinaryBlob(data: Uint8Array<ArrayBuffer> | ArrayBuffer): Blob;
export declare function createBlob(data: string | string[] | Uint8Array<ArrayBuffer> | ArrayBuffer | Blob): Blob;
export declare function isTextDocument(doc: LoadedEntry): boolean;
export declare function readAsBlob(doc: LoadedEntry): Blob;
export declare function readContent(doc: LoadedEntry): string | ArrayBuffer;
export declare function isDocContentSame(docA: string | string[] | Blob | ArrayBuffer, docB: string | string[] | Blob | ArrayBuffer): Promise<boolean>;
export declare function isObfuscatedEntry(doc: DatabaseEntry): doc is AnyEntry;
export declare function isEncryptedChunkEntry(doc: DatabaseEntry): doc is EntryLeaf;
export declare function isSyncInfoEntry(doc: DatabaseEntry): doc is SyncInfo;
export declare function determineTypeFromBlob(data: Blob): "newnote" | "plain";
export declare function determineType(path: string, data: string | string[] | Uint8Array | ArrayBuffer | Blob): "newnote" | "plain";
export declare function isAnyNote(doc: DatabaseEntry): doc is NewEntry | PlainEntry;
export declare function isLoadedEntry(doc: DatabaseEntry): doc is LoadedEntry;
export declare function isDeletedEntry(doc: LoadedEntry): boolean;
export declare function createSavingEntryFromLoadedEntry(doc: LoadedEntry): SavingEntry;
export declare function compareMTime(baseMTime: number, targetMTime: number): typeof BASE_IS_NEW | typeof TARGET_IS_NEW | typeof EVEN;
-5
View File
@@ -1,6 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare function isErrorOf(ex: unknown, statusCode: number): boolean;
/**
* Checks if the error is effectively a 404 error from CouchDB or PouchDB.
* @param ex some error object, expected to be from CouchDB or PouchDB.
@@ -8,6 +5,4 @@ export declare function isErrorOf(ex: unknown, statusCode: number): boolean;
* @throws if the input is not an object or does not have a numeric "status" property.
*/
export declare function isNotFoundError(ex: unknown): boolean;
export declare function isConflictError(ex: unknown): boolean;
export declare function isUnauthorizedError(ex: unknown): boolean;
export declare function tryGetFilePath(entry: unknown): string | undefined;
+13
View File
@@ -0,0 +1,13 @@
export declare function tryParseJSON<T extends object>(str: string, fallbackValue?: T): T | undefined;
export declare function parseHeaderValues(strHeader: string): Record<string, string>;
export declare function memorizeFuncWithLRUCache<T, U>(func: (key: T) => U): (key: T) => U | undefined;
/**
*
* @param exclusion return only not exclusion
* @returns
*
* ["something",false,"aaaaa"].filter(onlyNot(false)) => yields ["something","aaaaaa"]. but, as string[].
*/
export declare function onlyNot<A, B>(exclusion: B): (item: A | B) => item is Exclude<A, B>;
export declare function isDirty(key: string, value: unknown): boolean;
export declare function setAllItems<T>(set: Set<T>, items: T[]): Set<T>;
+6
View File
@@ -0,0 +1,6 @@
export declare function escapeNewLineFromString(str: string): string;
export declare function unescapeNewLineFromString(str: string): string;
export declare function escapeMarkdownValue<T>(value: T): T;
export declare function timeDeltaToHumanReadable(delta: number): string;
export declare function toRanges(sorted: number[]): string;
export declare function displayRev(rev: string): string;
-2
View File
@@ -1,4 +1,2 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare function asCopy<T>(obj: T): T;
export declare function ensureError(error: unknown): Error;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare function generatePatchObj(from: Record<string | number | symbol, unknown>, to: Record<string | number | symbol, unknown>): Record<string | number | symbol, unknown>;
export declare function applyPatch(from: Record<string | number | symbol, unknown>, patch: Record<string | number | symbol, unknown>): Record<string | number | symbol, unknown>;
export declare function mergeObject(objA: Record<string | number | symbol, unknown> | [unknown], objB: Record<string | number | symbol, unknown> | [unknown]): unknown[] | {
+25
View File
@@ -0,0 +1,25 @@
import type { CustomRegExpSource, ParsedCustomRegExp, CustomRegExpSourceList } from "@lib/common/models/shared.type.util";
import type { ObsidianLiveSyncSettings, RemoteDBSettings } from "@lib/common/models/setting.type";
/***
* Parse custom regular expression
* @param regexp
* @returns [negate: boolean, regexp: string]
* @example `!!foo` => [true, "foo"]
* @example `foo` => [false, "foo"]
*/
export declare function parseCustomRegExp(regexp: CustomRegExpSource): ParsedCustomRegExp;
export declare function matchRegExp(regexp: CustomRegExpSource, target: string): boolean;
export declare function isValidRegExp(regexp: CustomRegExpSource): boolean;
export declare function isInvertedRegExp(regexp: CustomRegExpSource): boolean;
export declare function constructCustomRegExpList<D extends string>(items: CustomRegExpSource[], delimiter: D): CustomRegExpSourceList<D>;
export declare function splitCustomRegExpList<D extends string>(list: CustomRegExpSourceList<D>, delimiter: D): CustomRegExpSource[];
export declare class CustomRegExp {
regexp: RegExp;
negate: boolean;
pattern: string;
constructor(regexp: CustomRegExpSource, flags?: string);
test(str: string): boolean;
}
type RegExpSettingKey = "syncOnlyRegEx" | "syncIgnoreRegEx" | "syncInternalFilesIgnorePatterns" | "syncInternalFilesTargetPatterns" | "syncInternalFileOverwritePatterns";
export declare function getFileRegExp(settings: ObsidianLiveSyncSettings | RemoteDBSettings, key: RegExpSettingKey): CustomRegExp[];
export {};
+19
View File
@@ -0,0 +1,19 @@
import type { ObsidianLiveSyncSettings, P2PConnectionInfo, BucketSyncSetting, CouchDBConnection, EncryptionSettings } from "@lib/common/models/setting.type";
/**
* Copies properties from the source object to the target object only if they exist in the target.
* @param source The object to copy properties from.
* @param target The object to copy properties to.
*/
export declare function copyTo<T extends object, U extends T>(source: U, target: T): void;
export declare function pickBucketSyncSettings(setting: ObsidianLiveSyncSettings): BucketSyncSetting;
export declare function pickCouchDBSyncSettings(setting: ObsidianLiveSyncSettings): CouchDBConnection;
export declare function pickEncryptionSettings(setting: ObsidianLiveSyncSettings | EncryptionSettings): EncryptionSettings;
export declare function pickP2PSyncSettings(setting: Partial<ObsidianLiveSyncSettings> & P2PConnectionInfo): P2PConnectionInfo;
/**
* Generate a random P2P Room ID in the format `123-456-789-abc`.
*/
export declare function generateP2PRoomId(): string;
/**
* Extract the stable suffix (last segment) from a Room ID.
*/
export declare function extractP2PRoomSuffix(roomId: string): string;
+18
View File
@@ -0,0 +1,18 @@
/**
* Run task with keeping minimum interval
* @param key waiting key
* @param interval interval (ms)
* @param task task to perform.
* @returns result of task
* @remarks This function is not designed to be concurrent.
*/
export declare function runWithInterval<T>(key: string, interval: number, task: () => Promise<T>): Promise<T>;
/**
* Run task with keeping minimum interval on start
* @param key waiting key
* @param interval interval (ms)
* @param task task to perform.
* @returns result of task
* @remarks This function is not designed to be concurrent.
*/
export declare function runWithStartInterval<T>(key: string, interval: number, task: () => Promise<T>): Promise<T>;
-3
View File
@@ -1,3 +0,0 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export type Constructor<T> = new (...args: any[]) => T; // eslint-disable-line @typescript-eslint/no-explicit-any -- Only type declaration
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { SimpleStore } from "octagonal-wheels/databases/SimpleStoreBase";
export declare class StoredMapLike<U> {
_store: SimpleStore<U>;
+4 -6
View File
@@ -1,7 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
interface InstanceHaveOnBindFunction<T> {
onBindFunction: (...params: T[]) => void;
}
export declare function __$checkInstanceBinding<T extends InstanceHaveOnBindFunction<any>>(instance: T): void; // eslint-disable-line @typescript-eslint/no-explicit-any -- Only type declaration
type InstanceHaveOnBindFunction = {
onBindFunction: (core: any, services: any) => void; // eslint-disable-line @typescript-eslint/no-explicit-any
} & Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
export declare function __$checkInstanceBinding<T extends InstanceHaveOnBindFunction>(instance: T): void;
export {};
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { encryptHKDFWorker, decryptHKDFWorker } from "@lib/worker/bgWorker.ts";
export declare const encryptHKDF: typeof encryptHKDFWorker;
export declare const decryptHKDF: typeof decryptHKDFWorker;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
/**
* Encrypts a string using a passphrase, unless the string is already encrypted.
*
+11 -3
View File
@@ -1,6 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { FilePathWithPrefix, ObsidianLiveSyncSettings } from "@lib/common/types";
import type { FilePathWithPrefix } from "@lib/common/models/db.type";
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
export declare const EVENT_LAYOUT_READY = "layout-ready";
export declare const EVENT_PLUGIN_LOADED = "plugin-loaded";
export declare const EVENT_PLUGIN_UNLOADED = "plugin-unloaded";
@@ -16,6 +15,7 @@ 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_FILE_CHANGED = "event-file-changed";
export declare const EVENT_DOCUMENT_STUB_CREATED = "document-stub-created";
export declare const EVENT_REQUEST_OPEN_P2P_SETTINGS = "request-open-p2p-settings";
export declare const EVENT_REQUEST_OPEN_P2P = "request-open-p2p";
export declare const EVENT_REQUEST_CLOSE_P2P = "request-close-p2p";
@@ -31,6 +31,14 @@ declare global {
file: FilePathWithPrefix;
automated: boolean;
};
[EVENT_DOCUMENT_STUB_CREATED]: {
toc: Set<string>;
stub: {
[key: string]: {
[key: string]: Map<string, Record<string, string>>;
};
};
};
[EVENT_FILE_RENAMED]: {
newPath: FilePathWithPrefix;
old: FilePathWithPrefix;
-2
View File
@@ -1,5 +1,3 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { EventHub } from "octagonal-wheels/events";
declare global {
interface LSEvents {
-2
View File
@@ -1,3 +1 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export { DirectFileManipulator, type DirectFileManipulatorOptions } from "./API/DirectFileManipulator.ts";

Some files were not shown because too many files have changed in this diff Show More