mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-06-22 18:17:35 +03:00
Compare commits
22 Commits
refactor_j
...
address_wa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8764f447f9 | ||
|
|
edb857f50d | ||
|
|
f91b38d4ab | ||
|
|
b62a565c8a | ||
|
|
1e7c1db1c4 | ||
|
|
8df9a1b53b | ||
|
|
32c9f76c93 | ||
|
|
7e65e5dc68 | ||
|
|
c03fa5213f | ||
|
|
3b538a143a | ||
|
|
3c6ec75c00 | ||
|
|
27e9b68510 | ||
|
|
e4b36602ec | ||
|
|
36827d4799 | ||
|
|
f596e7dd68 | ||
|
|
b0ac01e52f | ||
|
|
b4077bd1f5 | ||
|
|
675de883e9 | ||
|
|
4b8de7c915 | ||
|
|
4f8a74107c | ||
|
|
42ed0d8795 | ||
|
|
54c2b1c6db |
23
.gitattributes
vendored
23
.gitattributes
vendored
@@ -1,24 +1 @@
|
||||
# Always checkout shell scripts with LF line endings (never CRLF)
|
||||
*.sh text eol=lf
|
||||
|
||||
# Standard text files — auto normalize on checkout
|
||||
*.md text eol=lf
|
||||
*.yml text eol=lf
|
||||
*.yaml text eol=lf
|
||||
*.ini text eol=lf
|
||||
*.env text eol=lf
|
||||
*.json text eol=lf
|
||||
*.ts text eol=lf
|
||||
*.js text eol=lf
|
||||
*.mjs text eol=lf
|
||||
*.css text eol=lf
|
||||
|
||||
# Binary files — no line ending conversion
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.jpeg binary
|
||||
*.gif binary
|
||||
*.ico binary
|
||||
*.woff2 binary
|
||||
*.woff binary
|
||||
*.sh text eol=lf
|
||||
|
||||
52
.github/workflows/cli-docker.yml
vendored
52
.github/workflows/cli-docker.yml
vendored
@@ -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
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@@ -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:
|
||||
|
||||
179
.github/workflows/unit-ci.yml
vendored
179
.github/workflows/unit-ci.yml
vendored
@@ -1,111 +1,68 @@
|
||||
# Run Unit test without Harnesses
|
||||
name: unit-ci
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- beta
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'test/**'
|
||||
- 'package.json'
|
||||
- 'package-lock.json'
|
||||
- 'tsconfig.json'
|
||||
- 'vite.config.ts'
|
||||
- 'vitest.config*.ts'
|
||||
- 'esbuild.config.mjs'
|
||||
- 'eslint.config.mjs'
|
||||
- '.github/workflows/unit-ci.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'test/**'
|
||||
- 'package.json'
|
||||
- 'package-lock.json'
|
||||
- 'tsconfig.json'
|
||||
- 'vite.config.ts'
|
||||
- 'vitest.config*.ts'
|
||||
- 'esbuild.config.mjs'
|
||||
- 'eslint.config.mjs'
|
||||
- '.github/workflows/unit-ci.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
unit-test:
|
||||
name: Unit 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: Run unit tests suite with coverage
|
||||
run: npm run test:unit:coverage
|
||||
|
||||
- name: Upload coverage report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
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
|
||||
# Run Unit test without Harnesses
|
||||
name: unit-ci
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- beta
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'test/**'
|
||||
- 'package.json'
|
||||
- 'package-lock.json'
|
||||
- 'tsconfig.json'
|
||||
- 'vite.config.ts'
|
||||
- 'vitest.config*.ts'
|
||||
- 'esbuild.config.mjs'
|
||||
- 'eslint.config.mjs'
|
||||
- '.github/workflows/unit-ci.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'test/**'
|
||||
- 'package.json'
|
||||
- 'package-lock.json'
|
||||
- 'tsconfig.json'
|
||||
- 'vite.config.ts'
|
||||
- 'vitest.config*.ts'
|
||||
- 'esbuild.config.mjs'
|
||||
- 'eslint.config.mjs'
|
||||
- '.github/workflows/unit-ci.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
- name: Upload coverage report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage-report
|
||||
path: coverage/**
|
||||
@@ -1,4 +1,3 @@
|
||||
pouchdb-browser.js
|
||||
main_org.js
|
||||
main.js
|
||||
_types/**
|
||||
_types
|
||||
@@ -1,27 +0,0 @@
|
||||
# Code of Conduct
|
||||
|
||||
We wish to maintain an open, welcoming, and collaborative environment for all contributors.
|
||||
|
||||
## Our Standard
|
||||
|
||||
Our core principle is mutual respect. We encourage open discussion, diverse perspectives, and constructive feedback.
|
||||
|
||||
## The Limit of Tolerance
|
||||
|
||||
To preserve a tolerant and open community, we do not tolerate intolerance. Actions that aim to harass, exclude, or silence others are not welcome. Specifically, we do not accept personal attacks, breaches of privacy, or sustained disruption of discussions. We prioritise protecting the community's capacity for open, peaceful collaboration.
|
||||
|
||||
## Resolution
|
||||
|
||||
If any issue arises, the project maintainers will resolve it in a fair, minimal, and constructive manner, aiming to restore a cooperative environment. Depending on the nature of the behaviour, actions may range from a simple warning to temporary or permanent suspension of repository access.
|
||||
|
||||
## Contact
|
||||
|
||||
You can contact the project maintainer via email at `vrtmrz@proton.me` or via Nostr at `npub1azzj0dzw8evwtgyjeucyfz5cs8k0eg7rd0x4qvggcg3s7lx0dmaqv9sfka`.
|
||||
|
||||
## Criticism of the Maintainer
|
||||
|
||||
To ensure open and transparent governance, criticism of the maintainer will not be deleted as long as it is clearly framed as a constructive objection. However, spamming duplicate issues on the same topic or resorting to personal attacks will result in closure or removal.
|
||||
|
||||
## Revisions
|
||||
|
||||
This Code of Conduct is maintained by the project maintainers and may be updated to address new challenges. While the final decision rests with the maintainers, we welcome constructive suggestions and feedback through issues or pull requests.
|
||||
@@ -1,70 +0,0 @@
|
||||
# Contributing to Self-hosted LiveSync
|
||||
|
||||
Thank you for your interest in contributing to Self-hosted LiveSync! We welcome all contributions, including bug reports, feature requests, documentation improvements, translations, and pull requests.
|
||||
|
||||
## Getting Started
|
||||
|
||||
To set up the development environment, please follow these steps:
|
||||
|
||||
1. Clone the repository recursively to ensure all Git submodules are loaded:
|
||||
```bash
|
||||
git clone --recursive https://github.com/vrtmrz/obsidian-livesync
|
||||
```
|
||||
If you have already cloned the repository without submodules, run the following command:
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
2. Install the package dependencies:
|
||||
```bash
|
||||
npm ci
|
||||
```
|
||||
|
||||
3. Build the plug-in:
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
For a more comprehensive guide on development workflows, testing configurations, and subrepos, please refer to [devs.md](devs.md).
|
||||
|
||||
## Guidelines for Contributions
|
||||
|
||||
### 1. Code Style and Verification
|
||||
|
||||
Before submitting a pull request, you must run verification scripts locally to ensure that there are no syntax, type, or linting errors:
|
||||
|
||||
- Run type checking and linting:
|
||||
```bash
|
||||
npm run check
|
||||
```
|
||||
- Run unit tests:
|
||||
```bash
|
||||
npm run test:unit
|
||||
```
|
||||
|
||||
If you have the capability and a suitable environment (such as Linux and Docker), running the CLI End-to-End (E2E) tests is also highly appreciated. Instructions are detailed in [devs.md](devs.md). If you cannot run E2E tests locally, please explicitly ask to run the tests on the CI by stating 'Please run CI tests' in your pull request description.
|
||||
|
||||
### 2. Documentation and UI Text Style
|
||||
|
||||
To maintain consistency across the project, we ask that you follow the established writing style and conventions of the codebase when contributing documentation or user-facing messages:
|
||||
|
||||
- **Spelling**: Prioritise region-independent, neutral spelling if a suitable word exists. If there is no such word, please use British English spelling to align with the codebase's style (for example: preferring '-ise' and '-isation' suffixes over '-ize' and '-ization'). However, we do not treat alternative spellings as errors.
|
||||
- **Oxford Comma**: Use the serial (Oxford) comma to separate items in lists of three or more (for example: 'settings, snippets, and themes').
|
||||
- **Logical Punctuation**: Place punctuation marks outside quotation marks unless they are part of the quoted text itself (for example: write 'dialogue', not 'dialogue,').
|
||||
- **No Contractions**: Avoid using contractions in general text or documentation (for example: write "do not" instead of "don't", and "cannot" instead of "can't").
|
||||
- **Affirmative Phrasing**: Avoid asking questions using negative forms in user-facing dialogue. Use affirmative questions to prevent translation and interpretation discrepancies.
|
||||
- **Specific Words**: Use 'dialogue' for documentation and user-facing messages (use 'dialog' only inside source code). Use the hyphenated form 'plug-in' in user-facing text (use 'plugin' only in configuration settings or technical contexts).
|
||||
|
||||
For a detailed list of vocabulary conventions and terms, please refer to [docs/terms.md](docs/terms.md).
|
||||
|
||||
### 3. Translations
|
||||
|
||||
To add or update translations, please refer to [docs/adding_translations.md](docs/adding_translations.md) for detailed instructions.
|
||||
|
||||
### 4. Git Submodules
|
||||
|
||||
The `src/lib` directory is a Git submodule pointing to the shared library `livesync-commonlib`. If you wish to propose changes to the shared library, do not modify `src/lib` directly. Instead, please submit a separate pull request to the [livesync-commonlib repository](https://github.com/vrtmrz/livesync-commonlib).
|
||||
|
||||
## License
|
||||
|
||||
By contributing, you agree that your contributions will be licensed under the MIT License.
|
||||
8
_types/src/LiveSyncBaseCore.d.ts
vendored
8
_types/src/LiveSyncBaseCore.d.ts
vendored
@@ -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
_types/src/common/KeyValueDB.d.ts
vendored
2
_types/src/common/KeyValueDB.d.ts
vendored
@@ -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
_types/src/common/KeyValueDBv2.d.ts
vendored
2
_types/src/common/KeyValueDBv2.d.ts
vendored
@@ -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
_types/src/common/PeriodicProcessor.d.ts
vendored
2
_types/src/common/PeriodicProcessor.d.ts
vendored
@@ -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
_types/src/common/SvelteItemView.d.ts
vendored
2
_types/src/common/SvelteItemView.d.ts
vendored
@@ -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
_types/src/common/events.d.ts
vendored
2
_types/src/common/events.d.ts
vendored
@@ -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";
|
||||
|
||||
4
_types/src/common/obsidianEvents.d.ts
vendored
4
_types/src/common/obsidianEvents.d.ts
vendored
@@ -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
_types/src/common/reportTool.d.ts
vendored
2
_types/src/common/reportTool.d.ts
vendored
@@ -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
_types/src/common/stores.d.ts
vendored
2
_types/src/common/stores.d.ts
vendored
@@ -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;
|
||||
|
||||
5
_types/src/common/types.d.ts
vendored
5
_types/src/common/types.d.ts
vendored
@@ -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;
|
||||
|
||||
8
_types/src/common/utils.d.ts
vendored
8
_types/src/common/utils.d.ts
vendored
@@ -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;
|
||||
|
||||
8
_types/src/deps.d.ts
vendored
8
_types/src/deps.d.ts
vendored
@@ -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";
|
||||
|
||||
@@ -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,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,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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
11
_types/src/features/LiveSyncCommands.d.ts
vendored
11
_types/src/features/LiveSyncCommands.d.ts
vendored
@@ -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
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
4
_types/src/lib/src/API/processSetting.d.ts
vendored
4
_types/src/lib/src/API/processSetting.d.ts
vendored
@@ -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,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,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
_types/src/lib/src/UI/svelteDialog.d.ts
vendored
2
_types/src/lib/src/UI/svelteDialog.d.ts
vendored
@@ -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
_types/src/lib/src/bureau/bureau.d.ts
vendored
2
_types/src/lib/src/bureau/bureau.d.ts
vendored
@@ -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,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 {
|
||||
/**
|
||||
|
||||
5
_types/src/lib/src/common/LSError.d.ts
vendored
5
_types/src/lib/src/common/LSError.d.ts
vendored
@@ -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.
|
||||
|
||||
11
_types/src/lib/src/common/configForDoc.d.ts
vendored
11
_types/src/lib/src/common/configForDoc.d.ts
vendored
@@ -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
_types/src/lib/src/common/context.d.ts
vendored
Normal file
16
_types/src/lib/src/common/context.d.ts
vendored
Normal 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 {};
|
||||
@@ -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
_types/src/lib/src/common/coreEnvVars.d.ts
vendored
2
_types/src/lib/src/common/coreEnvVars.d.ts
vendored
@@ -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 };
|
||||
|
||||
4
_types/src/lib/src/common/i18n.d.ts
vendored
4
_types/src/lib/src/common/i18n.d.ts
vendored
@@ -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
_types/src/lib/src/common/logger.d.ts
vendored
2
_types/src/lib/src/common/logger.d.ts
vendored
@@ -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
_types/src/lib/src/common/messages/de.d.ts
vendored
2
_types/src/lib/src/common/messages/de.d.ts
vendored
@@ -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
_types/src/lib/src/common/messages/def.d.ts
vendored
2
_types/src/lib/src/common/messages/def.d.ts
vendored
@@ -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
_types/src/lib/src/common/messages/es.d.ts
vendored
2
_types/src/lib/src/common/messages/es.d.ts
vendored
@@ -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
_types/src/lib/src/common/messages/fr.d.ts
vendored
2
_types/src/lib/src/common/messages/fr.d.ts
vendored
@@ -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
_types/src/lib/src/common/messages/he.d.ts
vendored
2
_types/src/lib/src/common/messages/he.d.ts
vendored
@@ -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
_types/src/lib/src/common/messages/ja.d.ts
vendored
2
_types/src/lib/src/common/messages/ja.d.ts
vendored
@@ -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
_types/src/lib/src/common/messages/ko.d.ts
vendored
2
_types/src/lib/src/common/messages/ko.d.ts
vendored
@@ -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
_types/src/lib/src/common/messages/ru.d.ts
vendored
2
_types/src/lib/src/common/messages/ru.d.ts
vendored
@@ -1,5 +1,3 @@
|
||||
// @ts-nocheck
|
||||
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
|
||||
export declare const PartialMessages: {
|
||||
readonly ru: {
|
||||
"(Active)": string;
|
||||
|
||||
@@ -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
_types/src/lib/src/common/messages/zh.d.ts
vendored
2
_types/src/lib/src/common/messages/zh.d.ts
vendored
@@ -1,5 +1,3 @@
|
||||
// @ts-nocheck
|
||||
// REPO: https://github.com/vrtmrz/livesync-commonlib Commit hash: 90de158
|
||||
export declare const PartialMessages: {
|
||||
readonly zh: {
|
||||
"(Active)": string;
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
125
_types/src/lib/src/common/models/db.type.d.ts
vendored
125
_types/src/lib/src/common/models/db.type.d.ts
vendored
@@ -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;
|
||||
}
|
||||
/**
|
||||
* Represents an entry that contains children (chunk IDs).
|
||||
*/
|
||||
export interface EntryWithChildren {
|
||||
/**
|
||||
* Contents of the file.
|
||||
* Chunk IDs indicating the contents of the file.
|
||||
*/
|
||||
data: string | string[];
|
||||
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.
|
||||
*/
|
||||
path: FilePathWithPrefix;
|
||||
/**
|
||||
* Chunk IDs indicating the contents of the file.
|
||||
*/
|
||||
children: string[];
|
||||
}
|
||||
/**
|
||||
* Represents a chunk-split binary file entry.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
path: FilePathWithPrefix;
|
||||
/**
|
||||
* Chunk IDs indicating the contents of the file.
|
||||
*/
|
||||
children: string[];
|
||||
}
|
||||
/**
|
||||
* Represents a chunk-split plain text file entry.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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;";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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_";
|
||||
|
||||
@@ -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,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;
|
||||
|
||||
@@ -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,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
|
||||
} & {};
|
||||
|
||||
@@ -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
_types/src/lib/src/common/rosetta.d.ts
vendored
2
_types/src/lib/src/common/rosetta.d.ts
vendored
@@ -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.
|
||||
|
||||
24
_types/src/lib/src/common/settingConstants.d.ts
vendored
24
_types/src/lib/src/common/settingConstants.d.ts
vendored
@@ -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;
|
||||
};
|
||||
|
||||
4
_types/src/lib/src/common/typeUtils.d.ts
vendored
4
_types/src/lib/src/common/typeUtils.d.ts
vendored
@@ -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
_types/src/lib/src/common/types.d.ts
vendored
2
_types/src/lib/src/common/types.d.ts
vendored
@@ -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
_types/src/lib/src/common/utils.concurrency.d.ts
vendored
Normal file
10
_types/src/lib/src/common/utils.concurrency.d.ts
vendored
Normal 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;
|
||||
122
_types/src/lib/src/common/utils.d.ts
vendored
122
_types/src/lib/src/common/utils.d.ts
vendored
@@ -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
_types/src/lib/src/common/utils.database.d.ts
vendored
Normal file
23
_types/src/lib/src/common/utils.database.d.ts
vendored
Normal 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
_types/src/lib/src/common/utils.doc.d.ts
vendored
5
_types/src/lib/src/common/utils.doc.d.ts
vendored
@@ -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
_types/src/lib/src/common/utils.misc.d.ts
vendored
Normal file
13
_types/src/lib/src/common/utils.misc.d.ts
vendored
Normal 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
_types/src/lib/src/common/utils.notations.d.ts
vendored
Normal file
6
_types/src/lib/src/common/utils.notations.d.ts
vendored
Normal 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
_types/src/lib/src/common/utils.object.d.ts
vendored
2
_types/src/lib/src/common/utils.object.d.ts
vendored
@@ -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
_types/src/lib/src/common/utils.patch.d.ts
vendored
2
_types/src/lib/src/common/utils.patch.d.ts
vendored
@@ -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
_types/src/lib/src/common/utils.regexp.d.ts
vendored
Normal file
25
_types/src/lib/src/common/utils.regexp.d.ts
vendored
Normal 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
_types/src/lib/src/common/utils.settings.d.ts
vendored
Normal file
19
_types/src/lib/src/common/utils.settings.d.ts
vendored
Normal 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
_types/src/lib/src/common/utils.timer.d.ts
vendored
Normal file
18
_types/src/lib/src/common/utils.timer.d.ts
vendored
Normal 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
_types/src/lib/src/common/utils.type.d.ts
vendored
3
_types/src/lib/src/common/utils.type.d.ts
vendored
@@ -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
_types/src/lib/src/dataobject/StoredMap.d.ts
vendored
2
_types/src/lib/src/dataobject/StoredMap.d.ts
vendored
@@ -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>;
|
||||
|
||||
10
_types/src/lib/src/dev/checks.d.ts
vendored
10
_types/src/lib/src/dev/checks.d.ts
vendored
@@ -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 {};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user