Compare commits

..

55 Commits

Author SHA1 Message Date
vorotamoroz becff6eba9 track sub-repo 2026-06-19 09:37:54 +01:00
vorotamoroz 6c07f0ca64 - Reduce unnecessary log
- Move old entries (updates)
2026-06-19 09:31:40 +01:00
vorotamoroz 18f1fce3e8 bump 2026-06-19 09:15:30 +01:00
vorotamoroz efb6a0a814 Update type fallback and tools. 2026-06-19 08:45:37 +01:00
vorotamoroz 874164ecf5 Fix more typings 2026-06-19 08:43:36 +01:00
vorotamoroz 42954fcf68 Fix types 2026-06-19 07:52:04 +01:00
vorotamoroz b2c6916ac7 more tweaks 2026-06-19 06:28:34 +01:00
vorotamoroz 21f47cf48d update some style 2026-06-19 06:12:49 +01:00
vorotamoroz 21796b6651 update some style 2026-06-19 06:08:06 +01:00
vorotamoroz f468758c75 Repo boundary breach detection on import normalise 2026-06-19 06:04:44 +01:00
vorotamoroz 2ee6a2c09f Repo boundary breach detection on import normalise 2026-06-19 06:03:53 +01:00
vorotamoroz 463c0c0bc8 import normalisation 2026-06-19 05:53:23 +01:00
vorotamoroz 641488de1f add type declarations (automatically generated) 2026-06-19 05:21:04 +01:00
vorotamoroz 5cb76bba72 Add annotations and fix some. 2026-06-18 11:57:33 +01:00
vorotamoroz 866a49204c fix lifecycle 2026-06-18 11:15:45 +01:00
vorotamoroz fb93511ae7 Improve typings
Remove `DEV` blocks
2026-06-18 11:09:07 +01:00
vorotamoroz 72033472f3 add dependency explicitly 2026-06-17 10:36:38 +01:00
vorotamoroz 93dc03e86f remove unused dependencies, update some dependencies 2026-06-17 10:05:45 +01:00
vorotamoroz dae8443fe8 update more deps 2026-06-17 06:35:14 +01:00
vorotamoroz 88a8bcbd5a barrel node specific modules to summarise the warnings 2026-06-17 06:15:25 +01:00
vorotamoroz 4a5283543d for automatic review 2026-06-17 06:10:30 +01:00
vorotamoroz 7895336189 revert deno test 2026-06-17 06:08:40 +01:00
vorotamoroz 2d5cdccf7d for automatic review 2026-06-17 05:51:01 +01:00
vorotamoroz 497fd04081 fix global references 2026-06-17 05:29:45 +01:00
vorotamoroz ae9c46f8f0 Fix import paths 2026-06-17 04:39:39 +01:00
vorotamoroz dcd10cd690 Fix dependency management 2026-06-17 04:24:55 +01:00
vorotamoroz 5a35b71339 define workspace 2026-06-17 04:01:45 +01:00
vorotamoroz 18a59219f7 add ignore paths 2026-06-15 12:25:50 +01:00
vorotamoroz c9095738e6 (chore): limit tags 2026-06-15 12:21:58 +01:00
vorotamoroz bed415fc6b (chore): add missing release date 2026-06-15 12:21:11 +01:00
vorotamoroz 4eeb93b9e4 Merge pull request #961 from vrtmrz/0_25_76
Releasing 0.25.76
2026-06-15 20:18:37 +09:00
vorotamoroz 0fc233686b prettify and bump 2026-06-15 11:54:41 +01:00
vorotamoroz def1d297f5 Merge pull request #958 from vrtmrz/fix_875
Fix S3 client with custom headers and strict server
2026-06-15 19:41:31 +09:00
vorotamoroz e7cf2a6fba Merge branch 'main' into fix_875 2026-06-15 19:41:18 +09:00
vorotamoroz 2da2fd7671 Merge pull request #960 from vrtmrz/fix_956
Fix configuration serialisation
2026-06-15 19:40:37 +09:00
vorotamoroz d5175969e7 Update notes. 2026-06-15 11:39:38 +01:00
vorotamoroz 46f9630999 track merged submodule 2026-06-15 11:39:13 +01:00
vorotamoroz 75adcf0ff0 track merged submodule 2026-06-15 11:38:50 +01:00
vorotamoroz 866dd49ba3 ### Fixed
- No longer connection information of the P2P synchronisation is broken on the specific platform (#956).
2026-06-15 11:34:25 +01:00
vorotamoroz d0a84d07aa (chore) typo 2026-06-15 10:43:27 +01:00
vorotamoroz 089a4c0f8b ### Fixed
- Now S3 connection with custom headers works properly.
2026-06-15 10:41:26 +01:00
vorotamoroz 1a1f816872 Merge pull request #957 from vrtmrz/v0_25_75
Releasing v0.25.75
2026-06-13 12:05:16 +09:00
vorotamoroz 9d86c2828b Update dependency, and bump 2026-06-13 11:58:40 +09:00
vorotamoroz 3b6d3beaa7 Merge pull request #955 from vrtmrz/fix_953
Fix an issue where using fast synchronisation caused a TypeError in some environment
2026-06-13 11:21:19 +09:00
vorotamoroz bb75b6ead8 Merge remote-tracking branch 'origin/main' into fix_953 2026-06-13 11:19:22 +09:00
vorotamoroz fccb2304f6 update submodule pointer 2026-06-13 11:18:03 +09:00
vorotamoroz f00ef5eaae update submodule pointer 2026-06-13 11:15:03 +09:00
vorotamoroz 4e7ee760de Merge pull request #949 from AutoraLabs/feat/keep-livesync-active-in-background
feat: opt-in desktop setting to keep replication active in the background
2026-06-13 11:14:04 +09:00
vorotamoroz c4faade30c Update submodule pointer 2026-06-13 11:13:35 +09:00
vorotamoroz 295dc1392a ### Fixed
- Fixed an issue where using fast synchronisation caused a TypeError in some environments (#953).
2026-06-12 11:33:07 +01:00
Miguel Ferreira 445a8c747c chore(submodule): bump src/lib to commonlib main (#51 merged as e98d929)
vrtmrz/livesync-commonlib#51 is merged into commonlib main as e98d929. Repoint
the gitlink from the PR branch commit to that merge commit so this PR builds
against upstream main.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 10:45:40 +01:00
Miguel Ferreira 292a6b9e1e refactor: detect platform via APIService.isMobile() instead of Platform.isDesktopApp
Address the maintainer review on #949: determine the platform through the
plugin's own service layer (services.API.isMobile()) rather than Obsidian's
Platform API directly, matching the existing call in ObsidianLiveSyncSettingTab.
Applies to both PR-introduced sites: the runtime guard (ModuleObsidianEvents)
and the settings-pane toggle (PaneSyncSettings).

The TFile import becomes type-only so deps.ts is no longer pulled at runtime;
the unit test drives the platform through the services.API.isMobile() mock.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 10:45:40 +01:00
vorotamoroz 0e04e7d31d Merge pull request #951 from vrtmrz/feat_docker_ci_build
feat: Docker CI workflow to enhance image tagging and push logic base…
2026-06-09 18:41:26 +09:00
vorotamoroz 4cf4acf7e9 feat: Docker CI workflow to enhance image tagging and push logic based on branch and event type 2026-06-09 09:00:43 +00:00
Miguel Ferreira c78e583399 feat: opt-in desktop setting to keep replication active in the background
Replication is suspended when the Obsidian window becomes hidden (document.hidden),
so LiveSync and Periodic stop syncing while minimised until the window is focused.

Add keepReplicationActiveInBackground (default off, desktop only). When enabled, the
window-visibility handler no longer suspends on hide, so replication keeps running while
minimised. Becoming visible forces a teardown before reopen (LiveSync only) so a stalled,
half-open channel is always replaced.

Includes the setting definition (src/lib submodule), a desktop-only toggle in the Sync
pane shown for LiveSync and Periodic, a docs/settings.md entry, and unit tests for the
visibility handler.
2026-06-05 00:06:26 +01:00
575 changed files with 6740 additions and 4921 deletions
+40 -12
View File
@@ -8,8 +8,21 @@ 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:
@@ -41,14 +54,32 @@ jobs:
id: meta
run: |
VERSION=$(jq -r '.version' manifest.json)
EPOCH=$(date +%s)
TAG="${VERSION}-${EPOCH}-cli"
SHORT_SHA=$(git rev-parse --short HEAD)
IMAGE="ghcr.io/${{ github.repository_owner }}/livesync-cli"
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
# 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
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
@@ -92,10 +123,7 @@ jobs:
with:
context: .
file: src/apps/cli/Dockerfile
push: ${{ !(github.event_name == 'workflow_dispatch' && inputs.dry_run) }}
tags: |
${{ steps.meta.outputs.full }}
${{ steps.meta.outputs.version }}
${{ steps.meta.outputs.latest }}
push: ${{ steps.meta.outputs.push }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
+1
View File
@@ -4,6 +4,7 @@ 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:
+49 -6
View File
@@ -35,7 +35,8 @@ permissions:
contents: read
jobs:
test:
unit-test:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
@@ -53,10 +54,6 @@ 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
@@ -64,5 +61,51 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
name: unit-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
+2 -1
View File
@@ -1,3 +1,4 @@
pouchdb-browser.js
main_org.js
_types
main.js
_types/**
+5 -3
View File
@@ -1,6 +1,7 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { SimpleStore } from "octagonal-wheels/databases/SimpleStoreBase";
import type { HasSettings, ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
import type { EntryDoc } from "@lib/common/models/db.definition";
import type { HasSettings, ObsidianLiveSyncSettings, EntryDoc } from "@lib/common/types";
import type { Confirm } from "@lib/interfaces/Confirm";
import type { DatabaseFileAccess } from "@lib/interfaces/DatabaseFileAccess";
import type { Rebuilder } from "@lib/interfaces/DatabaseRebuilder";
@@ -15,6 +16,7 @@ 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[];
/**
@@ -50,7 +52,7 @@ export declare class LiveSyncBaseCore<T extends ServiceContext = ServiceContext,
* @param constructor
* @returns
*/
getModule<T extends AbstractModule>(constructor: new (...args: any[]) => T): T; // eslint-disable-line @typescript-eslint/no-explicit-any
getModule<T extends AbstractModule>(constructor: Constructor<T>): T;
/**
* Register a module to the plug-in.
* @param module The module to register.
+2
View File
@@ -1,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @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";
+3 -1
View File
@@ -1,5 +1,7 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { TFile } from "@/deps";
import type { FilePathWithPrefix, LoadedEntry } from "@lib/common/models/db.type";
import type { FilePathWithPrefix, LoadedEntry } from "@lib/common/types";
export declare const EVENT_REQUEST_SHOW_HISTORY = "show-history";
declare global {
interface LSEvents {
+2
View File
@@ -1,3 +1,5 @@
// @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,3 +1,5 @@
// @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;
+3 -2
View File
@@ -1,6 +1,7 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
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";
import { type DatabaseEntry, type EntryBody, type FilePath } from "@lib/common/types.ts";
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, 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";
import { type AnyEntry, type CouchDBCredentials, type DocumentID, type EntryHasPath, type FilePath, type FilePathWithPrefix, type UXFileInfo, type UXFileInfoStub } from "@lib/common/types.ts";
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.database.ts";
import { compareMTime } from "@lib/common/utils.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;
+5 -3
View File
@@ -1,6 +1,8 @@
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";
// @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";
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,11 +1,12 @@
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";
// @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 { 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 type { PluginDialogModal } from "./PluginDialogModal.ts";
import { PluginDialogModal } from "./PluginDialogModal.ts";
import type { InjectableServiceHub } from "@lib/services/InjectableServices.ts";
import type { LiveSyncCore } from "@/main.ts";
declare global {
@@ -78,8 +79,7 @@ export type PluginDataEx = {
mtime: number;
};
export declare class ConfigSync extends LiveSyncCommands {
pluginDialogClass: new (app: App, plugin: ObsidianLiveSyncPlugin) => PluginDialogModal;
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore, pluginDialogClass: new (app: App, plugin: ObsidianLiveSyncPlugin) => PluginDialogModal);
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore);
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) => any) => HTMLElement; // eslint-disable-line @typescript-eslint/no-explicit-any
addRibbonIcon: (icon: string, title: string, callback: (evt: MouseEvent) => unknown) => HTMLElement;
onload(): void;
getFileCategory(filePath: string): "CONFIG" | "THEME" | "SNIPPET" | "PLUGIN_MAIN" | "PLUGIN_ETC" | "PLUGIN_DATA" | "";
isTargetPath(filePath: string): boolean;
+3 -1
View File
@@ -1,6 +1,8 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { mount } from "svelte";
import { App, Modal } from "@/deps.ts";
import type ObsidianLiveSyncPlugin from "@/main.ts";
import ObsidianLiveSyncPlugin from "@/main.ts";
export declare class PluginDialogModal extends Modal {
plugin: ObsidianLiveSyncPlugin;
component: ReturnType<typeof mount> | undefined;
+3 -1
View File
@@ -1,5 +1,7 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { App, Modal } from "@/deps.ts";
import type { FilePath, LoadedEntry } from "@lib/common/models/db.type";
import { type FilePath, type LoadedEntry } from "@lib/common/types.ts";
import { mount } from "svelte";
export declare class JsonResolveModal extends Modal {
filename: FilePath;
+5 -4
View File
@@ -1,7 +1,8 @@
import type { LoadedEntry, FilePathWithPrefix, FilePath, DocumentID, MetaEntry } from "@lib/common/models/db.type";
import type { UXFileInfo, UXStat, UXDataWriteOptions } from "@lib/common/models/fileaccess.type";
// @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 InternalFileInfo } from "@/common/types.ts";
import type { CustomRegExp } from "@lib/common/utils.regexp.ts";
import { type CustomRegExp } from "@lib/common/utils.ts";
import { type MapLike } from "@/common/utils.ts";
import { PeriodicProcessor } from "@/common/PeriodicProcessor.ts";
import { LiveSyncCommands } from "@/features/LiveSyncCommands.ts";
@@ -21,7 +22,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/src/common/types").diff_result_leaf>;
getConflictedDoc(path: FilePathWithPrefix, rev: string): Promise<false | import("@lib/common/types.ts").diff_result_leaf>;
onunload(): void;
onload(): void;
private _everyOnDatabaseInitialized;
+6 -5
View File
@@ -1,5 +1,6 @@
import type { AnyEntry, DocumentID, FilePath, FilePathWithPrefix } from "@lib/common/models/db.type";
import type { LOG_LEVEL } from "@lib/common/logger";
// @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 ObsidianLiveSyncPlugin from "@/main.ts";
import type { LiveSyncCore } from "@/main.ts";
import { createInstanceLogFunction } from "@lib/services/lib/logUtils.ts";
@@ -10,7 +11,7 @@ export declare abstract class LiveSyncCommands {
plugin: ObsidianLiveSyncPlugin;
core: LiveSyncCore;
get app(): import("obsidian").App;
get settings(): import("../lib/src/common/types").ObsidianLiveSyncSettings;
get settings(): import("@lib/common/types.ts").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>;
@@ -26,8 +27,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: unknown) => void;
once: (msg: unknown) => void;
log: (msg: string) => void;
once: (msg: string) => void;
done: (msg?: string) => void;
};
_debug: (msg: unknown, key?: string) => void;
@@ -1,5 +1,6 @@
import type { DocumentID, EntryLeaf } from "@lib/common/models/db.type";
import type { EntryDoc } from "@lib/common/models/db.definition";
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type DocumentID, type EntryDoc, type EntryLeaf } from "@lib/common/types";
import { LiveSyncCommands } from "@/features/LiveSyncCommands";
type ChunkID = DocumentID;
type NoteDocumentID = DocumentID;
@@ -1,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @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";
@@ -22,7 +24,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
$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
$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
}
@@ -1,3 +1,5 @@
// @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";
@@ -13,7 +15,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
$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
$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
}
+2
View File
@@ -1,2 +1,4 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export { DirectFileManipulator } from "./DirectFileManipulatorV2.ts";
export type { DirectFileManipulatorOptions } from "./DirectFileManipulatorV2.ts";
+3 -1
View File
@@ -1,4 +1,6 @@
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type ObsidianLiveSyncSettings } from "@lib/common/types";
/**
* 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.
+7 -1
View File
@@ -1,4 +1,10 @@
import type { FilePathWithPrefix } from "@lib/common/models/db.type";
// @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 { ISettingService } from "@lib/services/base/IService.ts";
/**
* ContentSplitter interface for splitting content into chunks.
@@ -1,4 +1,6 @@
import type { SavingEntry } from "@lib/common/models/db.type";
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type SavingEntry } from "@lib/common/types.ts";
import { type ContentSplitterOptions, type SplitOptions } from "./ContentSplitter.ts";
export declare abstract class ContentSplitterCore {
/**
@@ -1,3 +1,5 @@
// @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 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ContentSplitterOptions, SplitOptions } from "./ContentSplitter";
import { ContentSplitterBase } from "./ContentSplitterBase";
/**
@@ -1,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { ContentSplitterOptions, SplitOptions } from "./ContentSplitter.ts";
import { ContentSplitterBase } from "./ContentSplitterBase.ts";
/**
+3 -1
View File
@@ -1,4 +1,6 @@
import type { SavingEntry } from "@lib/common/models/db.type";
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { SavingEntry } from "@lib/common/types";
import type { ContentSplitterOptions } from "./ContentSplitter";
import { ContentSplitterCore, type ContentSplitterBase } from "./ContentSplitterBase";
/**
+2
View File
@@ -1,2 +1,4 @@
// @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,3 +1,5 @@
// @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 {
+3 -1
View File
@@ -1,3 +1,5 @@
// @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";
@@ -10,7 +12,7 @@ export type RemoteConfigurationResult = {
settings: P2PConnectionInfo;
} | {
type: "webdav";
settings: any; // eslint-disable-line @typescript-eslint/no-explicit-any
settings: never;
};
export declare class ConnectionStringParser {
/**
+4 -1
View File
@@ -1,3 +1,6 @@
// @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;
}
@@ -34,7 +37,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: new (...args: any[]) => T): boolean; // eslint-disable-line @typescript-eslint/no-explicit-any
static isCausedBy<T extends LiveSyncError>(error: unknown, errorClass: Constructor<T>): boolean;
/**
* Creates a new instance of the error class from an existing error.
* @param error The error to wrap.
+6 -5
View File
@@ -1,5 +1,7 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { Confirm } from "@lib/interfaces/Confirm";
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
import { type ObsidianLiveSyncSettings } from "./types";
declare enum ConditionType {
PLATFORM_CASE_INSENSITIVE = "platform-case-insensitive",
PLATFORM_CASE_SENSITIVE = "platform-case-sensitive",
@@ -25,7 +27,7 @@ type BaseRule<TType extends string, TValue> = {
valueDisplayFunc?: (settings: Partial<ObsidianLiveSyncSettings>) => string;
obsoleteValues?: TValue[];
};
type NumberRuleExact = BaseRule<"number", number> & {};
type NumberRuleExact = BaseRule<"number", number> & {}; // eslint-disable-line @typescript-eslint/no-empty-object-type, @typescript-eslint/ban-types -- Empty object type
type NumberRuleRange = BaseRule<"number", number> & {
min?: number;
max?: number;
@@ -36,10 +38,9 @@ type StringRangeRule = BaseRule<"string", string> & {
maxLength?: number;
regexp?: string;
};
type StringRule = BaseRule<"string", string> & {};
type BooleanRule = BaseRule<"boolean", boolean> & {};
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
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
@@ -1,16 +0,0 @@
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,3 +1,5 @@
// @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,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
declare const manifestVersion: string;
declare const packageVersion: string;
export { manifestVersion, packageVersion };
+3 -1
View File
@@ -1,5 +1,7 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { AllMessageKeys, I18N_LANGS } from "./rosetta";
import type { TaggedType } from "@lib/common/models/shared.type.util";
import type { TaggedType } from "./types";
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,2 +1,4 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly de: {
"(Active)": string;
+2
View File
@@ -1,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly def: {
"(Active)": string;
+2
View File
@@ -1,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly es: {
"(Active)": string;
+2
View File
@@ -1,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly ja: {
"(Active)": string;
+2
View File
@@ -1,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly ko: {
"(Active)": string;
+2
View File
@@ -1,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly ru: {
"(Active)": string;
+2
View File
@@ -1,3 +1,5 @@
// @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,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const PartialMessages: {
readonly zh: {
"(Active)": string;
+2
View File
@@ -1,3 +1,5 @@
// @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,3 +1,5 @@
// @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;
+4 -2
View File
@@ -1,5 +1,7 @@
// @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, LoadedEntry, MetaEntry } from "./db.type";
import type { AnyEntry, ChunkVersionRange, DatabaseEntry, EntryChunkPack, EntryLeaf, EntryTypes, EntryVersionInfo, InternalFileEntry, LoadedEntry, MetaEntry, NewEntry, NoteEntry, PlainEntry } from "./db.type";
import type { TweakValues } from "./tweak.definition";
export type NodeKey = string;
export interface DeviceInfo {
@@ -50,7 +52,7 @@ export interface EntryNodeInfo extends DatabaseEntry {
nodeid: string;
v20220607?: boolean;
}
export type EntryBody = AnyEntry;
export type EntryBody = NoteEntry | NewEntry | PlainEntry | InternalFileEntry;
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;
+45 -76
View File
@@ -1,3 +1,5 @@
// @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">;
@@ -32,7 +34,7 @@ export interface DatabaseEntry {
/**
* Represents the base structure for an entry that represents a file.
*/
export interface EntryBase {
export type EntryBase = {
/**
* The creation time of the file.
*/
@@ -49,7 +51,7 @@ export interface EntryBase {
* Deleted flag.
*/
deleted?: boolean;
}
};
export type EdenChunk = {
data: string;
epoch: number;
@@ -57,106 +59,72 @@ export type EdenChunk = {
export type EntryWithEden = {
eden: Record<DocumentID, EdenChunk>;
};
/**
* Represents the common fields for all database entries representing physical files.
*/
export interface FileEntryBase extends DatabaseEntry, EntryBase, EntryWithEden {
export type NoteEntry = DatabaseEntry & EntryBase & EntryWithEden & {
/**
* The path of the file.
*/
path: FilePathWithPrefix;
}
/**
* Represents an entry that contains children (chunk IDs).
*/
export interface EntryWithChildren {
/**
* Chunk IDs indicating the contents of the file.
* 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 {
data: string | string[];
/**
* The type of the entry.
*/
type: EntryTypes["NOTE_LEGACY"];
}
/**
* Represents a chunk-split binary file entry.
};
export type NewEntry = DatabaseEntry & EntryBase & EntryWithEden & {
/**
* The path of the file.
*/
export interface NewEntry extends FileEntryBase, EntryWithChildren {
path: FilePathWithPrefix;
/**
* Chunk IDs indicating the contents of the file.
*/
children: string[];
/**
* The type of the entry.
*/
type: EntryTypes["NOTE_BINARY"];
}
/**
* Represents a chunk-split plain text file entry.
};
export type PlainEntry = DatabaseEntry & EntryBase & EntryWithEden & {
/**
* The path of the file.
*/
export interface PlainEntry extends FileEntryBase, EntryWithChildren {
path: FilePathWithPrefix;
/**
* Chunk IDs indicating the contents of the file.
*/
children: string[];
/**
* The type of the entry.
*/
type: EntryTypes["NOTE_PLAIN"];
}
/**
* 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 & {
};
export type InternalFileEntry = DatabaseEntry & NewEntry & EntryBase & {
deleted?: boolean;
};
export type AnyEntry = NoteEntry | NewEntry | PlainEntry | InternalFileEntry;
export type LoadedEntry = AnyEntry & {
data: string | string[];
datatype: EntryTypeNotes;
};
/**
* Represents a file entry prepared for saving.
*/
export type SavingEntry = AnyEntry & EntryWithBlob & {
export type SavingEntry = AnyEntry & {
data: Blob;
datatype: EntryTypeNotes;
};
/**
* 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> {
export type MetaEntry = AnyEntry & {
children: string[];
};
export type EntryLeaf = DatabaseEntry & {
type: EntryTypes["CHUNK"];
data: string;
isCorrupted?: boolean;
}
/**
* Represents a chunk pack document.
*/
export interface EntryChunkPack extends DatabaseEntry, EntryWithData<string> {
};
export type EntryChunkPack = DatabaseEntry & {
type: EntryTypes["CHUNK_PACK"];
}
data: string;
};
export interface EntryVersionInfo extends DatabaseEntry {
type: EntryTypes["VERSION_INFO"];
version: number;
@@ -169,7 +137,8 @@ export interface ChunkVersionRange {
max: number;
current: number;
}
export interface SyncInfo extends DatabaseEntry, EntryWithData<string> {
export interface SyncInfo extends DatabaseEntry {
_id: typeof SYNCINFO_ID;
type: EntryTypes["SYNC_INFO"];
data: string;
}
+2
View File
@@ -1,3 +1,5 @@
// @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,3 +1,5 @@
// @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;";
+30 -39
View File
@@ -1,50 +1,41 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { FilePath, FilePathWithPrefix } from "./db.type";
export interface UXStat {
export type UXStat = {
size: number;
mtime: number;
ctime: number;
type: "file" | "folder";
}
/**
* Represents the common base properties for any filesystem object stub.
*/
export interface UXFileSystemStubBase {
};
export type UXFileInfoStub = {
name: string;
path: FilePath | FilePathWithPrefix;
stat: UXStat;
deleted?: boolean;
isFolder?: false;
isInternal?: boolean;
};
export type UXFileInfo = UXFileInfoStub & {
body: Blob;
};
export type UXAbstractInfoStub = UXFileInfoStub | UXFolderInfo;
export type UXInternalFileInfoStub = {
name: string;
path: FilePath | FilePathWithPrefix;
deleted?: boolean;
isInternal?: boolean;
}
/**
* 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;
/**
* Represents a stub for an internal/hidden file.
*/
export interface UXInternalFileInfoStub extends UXFileSystemStubBase {
isFolder?: false;
isInternal: true;
stat: undefined;
}
/**
* Represents information about a folder.
*/
export interface UXFolderInfo extends UXFileSystemStubBase {
};
export type UXFolderInfo = {
name: string;
path: FilePath | FilePathWithPrefix;
deleted?: boolean;
isFolder: true;
children: UXFileInfoStub[];
parent: FilePath | FilePathWithPrefix | undefined;
}
export interface UXDataWriteOptions {
};
export type UXDataWriteOptions = {
/**
* Time of creation, represented as a unix timestamp, in milliseconds.
* Omit this if you want to keep the default behaviour.
@@ -55,25 +46,25 @@ export interface 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 interface FileEventArgs {
export type FileEventArgs = {
file: UXFileInfoStub | UXInternalFileInfoStub;
cache?: CacheData;
oldPath?: string;
ctx?: unknown;
}
export interface FileEventItem {
};
export type 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,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @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,2 +1,4 @@
// @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>;
+10 -1
View File
@@ -1,3 +1,5 @@
// @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";
@@ -95,6 +97,13 @@ 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.
@@ -883,7 +892,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 {
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
}
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,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @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,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
export declare const DatabaseConnectingStatuses: {
readonly STARTED: "STARTED";
readonly NOT_CONNECTED: "NOT_CONNECTED";
+3 -1
View File
@@ -1,3 +1,5 @@
// @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">;
@@ -5,4 +7,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,3 +1,5 @@
// @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,3 +1,5 @@
// @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;
@@ -24,6 +26,7 @@ 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,3 +1,5 @@
// @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.
+13 -11
View File
@@ -1,5 +1,6 @@
import type { ConfigurationItem } from "@lib/common/models/shared.definition.configNames";
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import { type ConfigurationItem, type ObsidianLiveSyncSettings } from "./types.ts";
type ExtractPropertiesByType<T, U> = {
[K in keyof T as T[K] extends U ? K : never]: T[K] extends U ? K : never;
};
@@ -34,6 +35,7 @@ export declare const AllSettingDefault: {
syncOnStart: boolean;
syncOnFileOpen: boolean;
syncOnEditorSave: boolean;
keepReplicationActiveInBackground: boolean;
syncMinimumInterval: number;
showVerboseLog: boolean;
lessInformationInLog: boolean;
@@ -59,7 +61,7 @@ export declare const AllSettingDefault: {
resolveConflictsByNewerFile: boolean;
writeDocumentsIfConflicted: boolean;
disableMarkdownAutoMerge: boolean;
configPassphraseStore: import("@lib/common/models/setting.type").ConfigPassphraseStore;
configPassphraseStore: import("./types.ts").ConfigPassphraseStore;
encryptedPassphrase: string;
encryptedCouchDBConnection: string;
periodicReplication: boolean;
@@ -80,7 +82,7 @@ export declare const AllSettingDefault: {
notifyPluginOrSettingUpdated: boolean;
usePluginSyncV2: boolean;
usePluginEtc: boolean;
pluginSyncExtendedSetting: Record<import("@lib/common/models/setting.type").PluginSyncSettingEntry["key"], import("@lib/common/models/setting.type").PluginSyncSettingEntry>;
pluginSyncExtendedSetting: Record<import("./types.ts").PluginSyncSettingEntry["key"], import("./types.ts").PluginSyncSettingEntry>;
useAdvancedMode: boolean;
usePowerUserMode: boolean;
useEdgeCaseMode: boolean;
@@ -105,7 +107,7 @@ export declare const AllSettingDefault: {
isConfigured?: boolean;
lastReadUpdates: number;
doctorProcessedVersion: string;
remoteConfigurations: Record<string, import("@lib/common/models/setting.type").RemoteConfiguration>;
remoteConfigurations: Record<string, import("./models/setting.type.ts").RemoteConfiguration>;
activeConfigurationId: string;
P2P_ActiveRemoteConfigurationId: string;
couchDB_URI: string;
@@ -129,19 +131,19 @@ export declare const AllSettingDefault: {
bucketCustomHeaders: string;
bucketPrefix: string;
forcePathStyle: boolean;
remoteType: import("@lib/common/models/setting.type").RemoteType;
remoteType: import("./types.ts").RemoteType;
encrypt: boolean;
passphrase: string;
usePathObfuscation: boolean;
E2EEAlgorithm: import("@lib/common/models/setting.type").E2EEAlgorithm;
hashAlg: import("@lib/common/models/setting.type").HashAlgorithm;
E2EEAlgorithm: import("./types.ts").E2EEAlgorithm;
hashAlg: import("./types.ts").HashAlgorithm;
minimumChunkSize: number;
customChunkSize: number;
longLineThreshold: number;
useSegmenter: boolean;
enableChunkSplitterV2: boolean;
doNotUseFixedRevisionForChunks: boolean;
chunkSplitterVersion: import("@lib/common/models/setting.type").ChunkSplitterVersion;
chunkSplitterVersion: import("./types.ts").ChunkSplitterVersion;
useEden: boolean;
maxChunksInEden: number;
maxTotalLengthInEden: number;
@@ -174,7 +176,7 @@ export declare const AllSettingDefault: {
useTimeouts: boolean;
deleteMetadataOfDeletedFiles: boolean;
automaticallyDeleteMetadataOfDeletedFiles: number;
P2P_AutoAccepting: import("@lib/common/models/setting.type").AutoAccepting;
P2P_AutoAccepting: import("./types.ts").AutoAccepting;
P2P_AutoSyncPeers: string;
P2P_AutoWatchPeers: string;
P2P_SyncOnReplication: string;
@@ -208,7 +210,7 @@ export declare function getConfig(key: AllSettingItemKey): false | {
placeHolder?: string;
status?: "BETA" | "ALPHA" | "EXPERIMENTAL";
obsolete?: boolean;
level?: import("@lib/common/models/shared.definition.configNames").ConfigLevel;
level?: import("./types.ts").ConfigLevel;
isHidden?: boolean;
isAdvanced?: boolean;
};
+3 -1
View File
@@ -1,5 +1,7 @@
// @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 "@lib/common/models/fileaccess.type";
import type { UXFileInfoStub } from "./types";
/**
* returns is internal chunk of file
* @param id ID
+2
View File
@@ -1,3 +1,5 @@
// @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
@@ -1,10 +0,0 @@
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;
+114 -8
View File
@@ -1,3 +1,6 @@
// @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";
@@ -13,13 +16,116 @@ 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 * 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";
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;
-23
View File
@@ -1,23 +0,0 @@
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,3 +1,6 @@
// @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.
@@ -5,4 +8,6 @@
* @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
@@ -1,13 +0,0 @@
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
@@ -1,6 +0,0 @@
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,2 +1,4 @@
// @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,3 +1,5 @@
// @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
@@ -1,25 +0,0 @@
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
@@ -1,19 +0,0 @@
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
@@ -1,18 +0,0 @@
/**
* 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
@@ -0,0 +1,3 @@
// @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,3 +1,5 @@
// @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>;
+6 -4
View File
@@ -1,5 +1,7 @@
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;
// @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
export {};
+2
View File
@@ -1,3 +1,5 @@
// @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,3 +1,5 @@
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
/**
* Encrypts a string using a passphrase, unless the string is already encrypted.
*
+3 -11
View File
@@ -1,5 +1,6 @@
import type { FilePathWithPrefix } from "@lib/common/models/db.type";
import type { ObsidianLiveSyncSettings } from "@lib/common/models/setting.type";
// @ts-nocheck
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
import type { FilePathWithPrefix, ObsidianLiveSyncSettings } from "@lib/common/types";
export declare const EVENT_LAYOUT_READY = "layout-ready";
export declare const EVENT_PLUGIN_LOADED = "plugin-loaded";
export declare const EVENT_PLUGIN_UNLOADED = "plugin-unloaded";
@@ -15,7 +16,6 @@ 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,14 +31,6 @@ 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,3 +1,5 @@
// @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 +1,3 @@
// @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