@vrtmrz/livesync-commonlib 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -2
- package/dist/API/DirectFileManipulatorV2.d.ts +1 -0
- package/dist/API/DirectFileManipulatorV2.js +3 -1
- package/dist/API/processSetting.d.ts +1 -0
- package/dist/API/processSetting.js +3 -0
- package/dist/common/models/setting.const.defaults.js +1 -0
- package/dist/common/models/setting.const.qr.js +2 -1
- package/dist/common/models/setting.encryption.d.ts +2 -0
- package/dist/common/models/setting.encryption.js +6 -0
- package/dist/common/models/setting.lifecycle.js +7 -2
- package/dist/common/models/setting.policy.d.ts +4 -0
- package/dist/common/models/setting.policy.js +9 -0
- package/dist/common/models/setting.type.d.ts +2 -0
- package/dist/common/models/shared.definition.configNames.js +5 -0
- package/dist/common/models/tweak.definition.d.ts +1 -0
- package/dist/common/settingConstants.d.ts +1 -0
- package/dist/common/utils.js +5 -4
- package/dist/diagnostics/couchdb.js +4 -2
- package/dist/interfaces/FileHandler.d.ts +59 -0
- package/dist/interfaces/FileReflectionProvenance.d.ts +15 -1
- package/dist/interfaces/FileReflectionProvenance.js +11 -1
- package/dist/managers/ChunkFetcher.js +27 -4
- package/dist/managers/chunkFetcher.helper.js +1 -1
- package/dist/pouchdb/StreamingFetch.d.ts +1 -2
- package/dist/pouchdb/encryption.d.ts +5 -10
- package/dist/pouchdb/encryption.eden.d.ts +11 -0
- package/dist/pouchdb/encryption.eden.js +37 -0
- package/dist/pouchdb/encryption.js +67 -63
- package/dist/pouchdb/encryption.policy.d.ts +9 -0
- package/dist/pouchdb/encryption.policy.js +125 -0
- package/dist/replication/UnencryptedContentRejectedError.d.ts +16 -0
- package/dist/replication/UnencryptedContentRejectedError.js +44 -0
- package/dist/replication/couchdb/LiveSyncReplicator.js +41 -4
- package/dist/replication/index.d.ts +2 -0
- package/dist/replication/index.js +3 -0
- package/dist/replication/trystero/TrysteroReplicator.d.ts +2 -0
- package/dist/replication/unencryptedContentMessages.d.ts +8 -0
- package/dist/replication/unencryptedContentMessages.js +12 -0
- package/dist/serviceFeatures/offlineScanner/fileStatus.d.ts +61 -0
- package/dist/serviceFeatures/offlineScanner/fileStatus.js +85 -0
- package/dist/serviceFeatures/offlineScanner/files.d.ts +47 -0
- package/dist/serviceFeatures/offlineScanner/files.js +218 -0
- package/dist/serviceFeatures/offlineScanner/metadata.d.ts +56 -0
- package/dist/serviceFeatures/offlineScanner/metadata.js +320 -0
- package/dist/serviceFeatures/offlineScanner/paths.d.ts +20 -0
- package/dist/serviceFeatures/offlineScanner/paths.js +16 -0
- package/dist/serviceFeatures/offlineScanner/scan.d.ts +35 -0
- package/dist/serviceFeatures/offlineScanner/scan.js +358 -0
- package/dist/serviceFeatures/offlineScanner/types.d.ts +134 -0
- package/dist/serviceFeatures/offlineScanner/types.js +66 -0
- package/dist/serviceFeatures/offlineScanner.d.ts +25 -251
- package/dist/serviceFeatures/offlineScanner.js +36 -860
- package/dist/serviceModules/Rebuilder.js +28 -4
- package/dist/serviceModules/ServiceFileHandlerBase/deletionRecovery.d.ts +13 -0
- package/dist/serviceModules/ServiceFileHandlerBase/deletionRecovery.js +194 -0
- package/dist/serviceModules/ServiceFileHandlerBase.d.ts +22 -1
- package/dist/serviceModules/ServiceFileHandlerBase.js +29 -0
- package/dist/services/base/KeyValueDBService.d.ts +9 -0
- package/dist/services/base/KeyValueDBService.js +11 -1
- package/dist/services/base/RemoteConnection.d.ts +2 -0
- package/dist/services/base/RemoteService.js +2 -1
- package/dist/services/base/SettingService.js +2 -0
- package/dist/settings.d.ts +2 -1
- package/dist/settings.js +2 -0
- package/dist/worker/bgWorker.js +1 -1
- package/docs/development.md +4 -0
- package/docs/offline-scanner.md +22 -0
- package/docs/settings-lifecycle.md +4 -0
- package/docs/storage-events-and-reflection.md +16 -10
- package/package.json +1 -1
package/docs/development.md
CHANGED
|
@@ -53,6 +53,7 @@ not add consumer entry points.
|
|
|
53
53
|
| `provenance.ts`, `scanning.ts` | Track the displayed revision and content evidence, classify storage, revalidate snapshots, and inspect scan hints. |
|
|
54
54
|
| `saving.ts` | Save ordinary or reconciled storage content and handle explicit base-revision selection. |
|
|
55
55
|
| `deletion.ts`, `renaming.ts` | Apply deletion, revision removal, and source-preserving rename operations. |
|
|
56
|
+
| `deletionRecovery.ts` | Recover retained logical deletions and interrupted cleanup under opt-in provenance and shared file admission. |
|
|
56
57
|
| `reflection.ts`, `protection.ts` | Reflect database revisions while protecting unsynchronised storage content. |
|
|
57
58
|
| `events.ts`, `selection.ts` | Interpret ordinary, restored, retried, and replicated events against current selection and storage. |
|
|
58
59
|
| `chunks.ts` | Repair chunks through the host's save method with bounded concurrency. |
|
|
@@ -307,3 +308,6 @@ The shared value extraction uses the declared Octagonal Wheels dependency. Its
|
|
|
307
308
|
package's public duration and delimiter helpers; source tests cover the
|
|
308
309
|
internal JSON copy adapter. When testing a future unpublished dependency, keep
|
|
309
310
|
these checks tied to the same Octagonal Wheels tarball used by the downstream consumer.
|
|
311
|
+
|
|
312
|
+
The opt-in ordinary deletion recovery contract, runtime budgets, and restart
|
|
313
|
+
cleanup ownership are recorded in [Deletion recovery](deletion-recovery.md).
|
package/docs/offline-scanner.md
CHANGED
|
@@ -7,6 +7,12 @@ status: unreleased
|
|
|
7
7
|
|
|
8
8
|
# Full offline scan
|
|
9
9
|
|
|
10
|
+
The public entry remains `serviceFeatures/offlineScanner`. Internally,
|
|
11
|
+
`src/serviceFeatures/offlineScanner/` separates shared types, path comparison,
|
|
12
|
+
Metadata inspection and repair, last-seen persistence, file collection and
|
|
13
|
+
reflection, and scan orchestration. The entry module retains lifecycle integration
|
|
14
|
+
and re-exports its existing public functions; callers do not need to change imports.
|
|
15
|
+
|
|
10
16
|
Implementation note: the settings-controlled strict comparison correction for [Self-hosted LiveSync #1329](https://github.com/vrtmrz/obsidian-livesync/issues/1329) is implemented but unreleased. The original reviewed-version fields above retain their historical baseline.
|
|
11
17
|
|
|
12
18
|
This document defines the developer contract for `synchroniseAllFilesBetweenDBandStorage`. It describes how the scanner classifies each selected path, chooses an action, and records a database-to-storage reflection. Host-specific setup dialogue and recovery choices remain outside this contract.
|
|
@@ -179,3 +185,19 @@ Identity coverage verifies early quarantine when no consistent target exists, co
|
|
|
179
185
|
Stored-event coverage verifies that current storage content replaces saved observations, a recreated path suppresses a stale deletion, distinct-ID rename halves are admitted independently from current path state, and a same-ID rename never performs a separate deletion. It also verifies that a storage-inspection failure does not become evidence for a destructive operation, that failed work remains pending, and that an individual replay failure does not prevent the full scan from running.
|
|
180
186
|
|
|
181
187
|
Maintain that interaction boundary when changing file-handler results, last-seen persistence, Fast Setup reflection, or offline deletion detection.
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## Opt-in recovery of retained logical deletions
|
|
191
|
+
|
|
192
|
+
The base action matrix remains the policy for hosts without deletion recovery.
|
|
193
|
+
A host whose handler reports `supportsDeletionRecovery()` may recover a
|
|
194
|
+
conflict-free, newer `both-db-deleted` pair during ordinary `NEWER_WINS` without
|
|
195
|
+
extra policies. This guarded operation does not use `update-storage` or direct
|
|
196
|
+
`delete-local`. Existing explicit policies retain their choices.
|
|
197
|
+
|
|
198
|
+
For `db-only-deleted` pairs, one optional provenance key enumeration identifies
|
|
199
|
+
stale bookkeeping. Cleanup-only work precedes new deletions and never reads file
|
|
200
|
+
bodies or invokes physical deletion. All affected paths are revalidated by their
|
|
201
|
+
handler. See [Deletion recovery](deletion-recovery.md) for completion, error,
|
|
202
|
+
concurrency, and cost contracts. This opt-in extension is published in
|
|
203
|
+
[Commonlib 0.4.2](https://github.com/vrtmrz/livesync-commonlib/releases/tag/0.4.2).
|
|
@@ -8,6 +8,10 @@ Commonlib separates three values which older integrations commonly treated as on
|
|
|
8
8
|
|
|
9
9
|
`DEFAULT_SETTINGS` remains an alias of `SETTINGS_SCHEMA_DEFAULTS` for compatibility. New code should choose the named contract which matches its operation.
|
|
10
10
|
|
|
11
|
+
## Unreleased: plaintext acceptance setting
|
|
12
|
+
|
|
13
|
+
The unreleased `acceptUnencryptedContent` setting defaults to `false`; only the boolean value `true` enables it. With E2EE enabled, it permits receipt of unencrypted file content from third-party tools which do not use the E2EE passphrase. Content sent by the plug-in remains encrypted. Complete Setup URI and QR imports normalise a missing or invalid value to `false`. Settings Markdown includes the value regardless of credential-sharing choice; a partial Markdown import preserves the current value when the field is absent and treats an explicitly invalid value as `false`.
|
|
14
|
+
|
|
11
15
|
## Starting a new Vault
|
|
12
16
|
|
|
13
17
|
Use `createNewVaultSettings()` only when the settings store is absent or empty, or when the user explicitly requests a factory reset. `NEW_VAULT_SETTINGS` exposes the values for inspection, while the factory prevents mutable nested settings from being shared between clients:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
date: 2026-10-26
|
|
3
3
|
commonlib-version: "0.2.1"
|
|
4
4
|
self-hosted-livesync-version: "1.0.40"
|
|
5
|
-
status:
|
|
5
|
+
status: published
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Storage events and database-to-storage reflection
|
|
@@ -11,8 +11,13 @@ This note separates storage-to-database event handling from
|
|
|
11
11
|
database-to-storage reflection. It documents the current guard against a stale
|
|
12
12
|
`DELETE` notification logically deleting Metadata while the same file is still
|
|
13
13
|
present in storage, and the accepted local completion contract for queued file
|
|
14
|
-
operations. The version fields identify the reviewed source versions
|
|
15
|
-
|
|
14
|
+
operations. The version fields identify the original reviewed source versions.
|
|
15
|
+
|
|
16
|
+
> Publication note (9th November, 2026): This implementation, including the
|
|
17
|
+
> [ordinary-file retry extension](#retrying-ordinary-file-operations), is included
|
|
18
|
+
> in published [Commonlib 0.4.1](https://github.com/vrtmrz/livesync-commonlib/releases/tag/0.4.1).
|
|
19
|
+
> The original review date and version baseline are retained above. Host
|
|
20
|
+
> applications adopt this package through their own dependency updates.
|
|
16
21
|
|
|
17
22
|
## Event-manager terminology
|
|
18
23
|
|
|
@@ -249,12 +254,13 @@ current content for processing.
|
|
|
249
254
|
|
|
250
255
|
## Retrying ordinary file operations
|
|
251
256
|
|
|
252
|
-
The following extension is
|
|
253
|
-
`DELETE`, or `RENAME` remains pending, while its attempt has
|
|
254
|
-
result. A later finite `commitPendingFileEvents()` request
|
|
255
|
-
attempt. A subsequent event for the same path or related rename
|
|
256
|
-
re-evaluate failed predecessors before proceeding. These paths
|
|
257
|
-
manager's ownership and use the existing current-state
|
|
257
|
+
The following extension is available in Commonlib 0.4.1. A failed ordinary
|
|
258
|
+
`CREATE`, `CHANGED`, `DELETE`, or `RENAME` remains pending, while its attempt has
|
|
259
|
+
a completed failure result. A later finite `commitPendingFileEvents()` request
|
|
260
|
+
can start a new attempt. A subsequent event for the same path or related rename
|
|
261
|
+
paths can also re-evaluate failed predecessors before proceeding. These paths
|
|
262
|
+
share the event manager's ownership and use the existing current-state
|
|
263
|
+
reconciliation rules.
|
|
258
264
|
|
|
259
265
|
Each request captures a finite set of operations and attempts. It may retry an
|
|
260
266
|
existing failure once, shares an attempt already running, and reports failures
|
|
@@ -286,7 +292,7 @@ Runtime retries reuse its file-reconciliation rules without replacing the
|
|
|
286
292
|
running manager through `restoreState()`. The saved format, handler return
|
|
287
293
|
contracts, and optional-provider retry policy remain unchanged. Hosts can use
|
|
288
294
|
their existing flush and lifecycle calls; no retry timer or new callback is
|
|
289
|
-
required. See the [retry decision](https://github.com/vrtmrz/obsidian-livesync/blob/
|
|
295
|
+
required. See the [reviewed retry decision](https://github.com/vrtmrz/obsidian-livesync/blob/09c17e90dde3b1a2000c8a2e13301245107b915b/docs/adr/2026_11_local_file_operation_retry.md)
|
|
290
296
|
for the operation matrix and considered alternatives.
|
|
291
297
|
|
|
292
298
|
## Optional file handlers
|
package/package.json
CHANGED