@vrtmrz/livesync-commonlib 0.1.0-rc.1 → 0.1.0-rc.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 +87 -19
- package/dist/common/configForDoc.js +6 -3
- package/dist/common/i18n.js +7 -7099
- package/dist/common/messages/combinedMessages.prod.d.ts +12 -0
- package/dist/common/messages/combinedMessages.prod.js +12 -0
- package/dist/common/messages/def.d.ts +4 -0
- package/dist/common/messagesJson/en.json +4 -0
- package/dist/common/models/setting.const.defaults.d.ts +19 -0
- package/dist/common/models/setting.const.defaults.js +21 -2
- package/dist/common/models/setting.lifecycle.d.ts +31 -0
- package/dist/common/models/setting.lifecycle.js +109 -0
- package/dist/common/models/setting.type.d.ts +4 -2
- package/dist/common/settingConstants.js +2 -2
- package/dist/common/types.d.ts +4 -2
- package/dist/common/types.js +16 -1
- package/dist/interfaces/Confirm.d.ts +10 -2
- package/dist/interfaces/DatabaseRebuilder.d.ts +12 -2
- package/dist/remoteConfigurations.d.ts +9 -0
- package/dist/remoteConfigurations.js +14 -0
- package/dist/replication/LiveSyncAbstractReplicator.d.ts +1 -2
- package/dist/replication/couchdb/LiveSyncReplicator.d.ts +0 -1
- package/dist/replication/couchdb/LiveSyncReplicator.js +0 -3
- package/dist/replication/journal/LiveSyncJournalReplicator.d.ts +0 -1
- package/dist/replication/journal/LiveSyncJournalReplicator.js +0 -3
- package/dist/replication/trystero/LiveSyncTrysteroReplicator.d.ts +5 -3
- package/dist/replication/trystero/LiveSyncTrysteroReplicator.js +42 -30
- package/dist/replication/trystero/P2PReplicatorCore.d.ts +2 -6
- package/dist/replication/trystero/P2PReplicatorCore.js +16 -86
- package/dist/replication/trystero/TrysteroReplicator.d.ts +2 -1
- package/dist/replication/trystero/TrysteroReplicator.js +10 -4
- package/dist/replication/trystero/TrysteroReplicatorP2PServer.d.ts +4 -5
- package/dist/replication/trystero/TrysteroReplicatorP2PServer.js +22 -30
- package/dist/replication/trystero/UseP2PReplicatorResult.d.ts +10 -2
- package/dist/replication/trystero/addP2PEventHandlers.d.ts +4 -2
- package/dist/replication/trystero/addP2PEventHandlers.js +8 -6
- package/dist/replication/trystero/types.d.ts +2 -0
- package/dist/replication/trystero/useP2PReplicatorCommands.d.ts +1 -1
- package/dist/replication/trystero/useP2PReplicatorCommands.js +3 -1
- package/dist/replication/trystero/useP2PReplicatorFeature.js +1 -1
- package/dist/rpc/RpcRoom.d.ts +1 -1
- package/dist/rpc/RpcRoom.js +22 -16
- package/dist/rpc/transports/TrysteroTransport.d.ts +2 -0
- package/dist/rpc/transports/TrysteroTransport.js +24 -17
- package/dist/rpc/transports/trysteroRoomEvents.d.ts +14 -0
- package/dist/rpc/transports/trysteroRoomEvents.js +34 -0
- package/dist/serviceFeatures/checkRemoteSize.d.ts +5 -3
- package/dist/serviceFeatures/checkRemoteSize.js +51 -11
- package/dist/serviceFeatures/remoteConfig.d.ts +37 -1
- package/dist/serviceFeatures/remoteConfig.js +90 -0
- package/dist/serviceModules/Rebuilder.d.ts +3 -6
- package/dist/serviceModules/Rebuilder.js +23 -19
- package/dist/services/base/IService.d.ts +13 -6
- package/dist/services/base/ReplicationService.d.ts +4 -2
- package/dist/services/base/ReplicationService.js +11 -16
- package/dist/services/base/SettingService.d.ts +14 -9
- package/dist/services/base/SettingService.js +35 -17
- package/dist/services/implements/headless/HeadlessAPIService.d.ts +3 -3
- package/dist/services/implements/headless/HeadlessAPIService.js +2 -2
- package/dist/services/implements/injectable/InjectableTweakValueService.d.ts +3 -3
- package/dist/settings.d.ts +10 -0
- package/dist/settings.js +32 -0
- package/dist/worker/bgWorker.js +1 -1
- package/docs/development.md +83 -1
- package/docs/p2p-transport-lifecycle.md +52 -0
- package/docs/proven-in-use.md +57 -0
- package/docs/releasing.md +12 -6
- package/docs/remote-configurations.md +63 -0
- package/docs/settings-lifecycle.md +60 -0
- package/package.json +12 -2
|
@@ -49,7 +49,9 @@ export declare abstract class ReplicationService<T extends ServiceContext = Serv
|
|
|
49
49
|
*/
|
|
50
50
|
readonly onBeforeReplicate: import("../lib/HandlerUtils.js").BooleanMultipleHandlerFunction<(showMessage: boolean) => Promise<boolean>>;
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Lightweight, repeatable policy checks shared by every replication entry point.
|
|
53
|
+
* Handlers must remain idempotent because a high-level replication may cross
|
|
54
|
+
* more than one entry point before work begins.
|
|
53
55
|
*/
|
|
54
56
|
readonly onCheckReplicationReady: import("../lib/HandlerUtils.js").BooleanMultipleHandlerFunction<(showMessage: boolean) => Promise<boolean>>;
|
|
55
57
|
/**
|
|
@@ -83,7 +85,7 @@ export declare abstract class ReplicationService<T extends ServiceContext = Serv
|
|
|
83
85
|
storageApplyingCount: import("octagonal-wheels/dataobject/reactive_v2").ReactiveSource<number>;
|
|
84
86
|
replicationResultCount: import("octagonal-wheels/dataobject/reactive_v2").ReactiveSource<number>;
|
|
85
87
|
getActiveReplicatorFor(usage: string): false | LiveSyncAbstractReplicator;
|
|
86
|
-
replicateAllToRemote(showingNotice?: boolean
|
|
88
|
+
replicateAllToRemote(showingNotice?: boolean): Promise<boolean>;
|
|
87
89
|
replicateAllFromRemote(showingNotice?: boolean): Promise<boolean>;
|
|
88
90
|
private _getReplicatorAndPerform;
|
|
89
91
|
markLocked(lockByClean?: boolean): Promise<void>;
|
|
@@ -34,7 +34,10 @@ class ReplicationService extends ServiceBase {
|
|
|
34
34
|
this.fileProcessing = dependencies.fileProcessingService;
|
|
35
35
|
this.databaseService = dependencies.databaseService;
|
|
36
36
|
this._log = createInstanceLogFunction("ReplicationService", dependencies.APIService);
|
|
37
|
-
this._unresolvedErrorManager = new UnresolvedErrorManager(
|
|
37
|
+
this._unresolvedErrorManager = new UnresolvedErrorManager(
|
|
38
|
+
dependencies.appLifecycleService,
|
|
39
|
+
this.context.events
|
|
40
|
+
);
|
|
38
41
|
}
|
|
39
42
|
/**
|
|
40
43
|
* Process a synchronisation result document.
|
|
@@ -60,7 +63,9 @@ class ReplicationService extends ServiceBase {
|
|
|
60
63
|
*/
|
|
61
64
|
onBeforeReplicate = handlers().bailFirstFailure("onBeforeReplicate");
|
|
62
65
|
/**
|
|
63
|
-
*
|
|
66
|
+
* Lightweight, repeatable policy checks shared by every replication entry point.
|
|
67
|
+
* Handlers must remain idempotent because a high-level replication may cross
|
|
68
|
+
* more than one entry point before work begins.
|
|
64
69
|
*/
|
|
65
70
|
onCheckReplicationReady = handlers().bailFirstFailure("onCheckReplicationReady");
|
|
66
71
|
/**
|
|
@@ -72,6 +77,9 @@ class ReplicationService extends ServiceBase {
|
|
|
72
77
|
this._log(`Not ready`);
|
|
73
78
|
return false;
|
|
74
79
|
}
|
|
80
|
+
if (!await this.onCheckReplicationReady(showMessage)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
75
83
|
const currentSettings = this.settingService.currentSettings();
|
|
76
84
|
if (isLockAcquired("cleanup")) {
|
|
77
85
|
this._log(this.context.translate("Replicator.Message.Cleaned"), LOG_LEVEL_NOTICE);
|
|
@@ -178,7 +186,7 @@ class ReplicationService extends ServiceBase {
|
|
|
178
186
|
}
|
|
179
187
|
return activeReplicator;
|
|
180
188
|
}
|
|
181
|
-
async replicateAllToRemote(showingNotice = false
|
|
189
|
+
async replicateAllToRemote(showingNotice = false) {
|
|
182
190
|
if (!this.appLifecycleService.isReady()) return false;
|
|
183
191
|
if (!await this.onBeforeReplicate(showingNotice)) {
|
|
184
192
|
this._log(this.context.translate("Replicator.Message.SomeModuleFailed"), LOG_LEVEL_NOTICE);
|
|
@@ -189,19 +197,6 @@ class ReplicationService extends ServiceBase {
|
|
|
189
197
|
if (!activeReplicator) {
|
|
190
198
|
return false;
|
|
191
199
|
}
|
|
192
|
-
if (!sendChunksInBulkDisabled) {
|
|
193
|
-
if (activeReplicator?.isChunkSendingSupported) {
|
|
194
|
-
if (await this.APIService.confirm.askYesNoDialog(
|
|
195
|
-
"Do you want to send all chunks before replication?",
|
|
196
|
-
{
|
|
197
|
-
defaultOption: "No",
|
|
198
|
-
timeout: 20
|
|
199
|
-
}
|
|
200
|
-
) == "yes") {
|
|
201
|
-
await activeReplicator.sendChunks(currentSettings, void 0, true, 0);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
200
|
const ret = await activeReplicator.replicateAllToServer(currentSettings, showingNotice);
|
|
206
201
|
if (ret) return true;
|
|
207
202
|
const checkResult = await this.checkConnectionFailure();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ObsidianLiveSyncSettings } from "../../common/types.js";
|
|
1
|
+
import { type ObsidianLiveSyncSettings, type SettingsMigrationState } from "../../common/types.js";
|
|
2
2
|
import type { IAPIService, ISettingService } from "./IService.js";
|
|
3
3
|
import { ServiceBase, type ServiceContext } from "./ServiceBase.js";
|
|
4
4
|
import { createInstanceLogFunction } from "../lib/logUtils.js";
|
|
@@ -17,6 +17,8 @@ export declare abstract class SettingService<T extends ServiceContext = ServiceC
|
|
|
17
17
|
protected abstract saveData(setting: ObsidianLiveSyncSettings): Promise<void>;
|
|
18
18
|
protected abstract loadData(): Promise<ObsidianLiveSyncSettings | undefined>;
|
|
19
19
|
private _lastPersistedSettings?;
|
|
20
|
+
private _settingsMigrationState?;
|
|
21
|
+
getSettingsMigrationState(): SettingsMigrationState | undefined;
|
|
20
22
|
_log: ReturnType<typeof createInstanceLogFunction>;
|
|
21
23
|
constructor(context: T, dependencies: SettingServiceDependencies);
|
|
22
24
|
/**
|
|
@@ -37,6 +39,17 @@ export declare abstract class SettingService<T extends ServiceContext = ServiceC
|
|
|
37
39
|
* Save the current device and vault name to settings, aside from the main settings.
|
|
38
40
|
*/
|
|
39
41
|
saveDeviceAndVaultName(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Read an exact key from the host's device-local configuration store.
|
|
44
|
+
*
|
|
45
|
+
* Unlike the main settings document, this state is not synchronised. Callers
|
|
46
|
+
* which need Vault namespacing should normally use {@link getSmallConfig}.
|
|
47
|
+
*/
|
|
48
|
+
getDeviceLocalConfig(key: string): string | null;
|
|
49
|
+
/** Store an exact key in the host's non-synchronised configuration store. */
|
|
50
|
+
setDeviceLocalConfig(key: string, value: string): void;
|
|
51
|
+
/** Delete an exact key from the host's non-synchronised configuration store. */
|
|
52
|
+
deleteDeviceLocalConfig(key: string): void;
|
|
40
53
|
private additionalSuffixOfDatabaseName;
|
|
41
54
|
private getKey;
|
|
42
55
|
setSmallConfig(key: string, value: string): void;
|
|
@@ -69,16 +82,8 @@ export declare abstract class SettingService<T extends ServiceContext = ServiceC
|
|
|
69
82
|
* Suspend extra synchronisation activities, e.g., hidden files sync.
|
|
70
83
|
*/
|
|
71
84
|
readonly suspendExtraSync: import("../lib/HandlerUtils.js").BooleanMultipleHandlerFunction<() => Promise<boolean>>;
|
|
72
|
-
/**
|
|
73
|
-
* Suggest enabling optional features to the user.
|
|
74
|
-
*/
|
|
75
|
-
readonly suggestOptionalFeatures: import("../lib/HandlerUtils.js").BooleanMultipleHandlerFunction<(opt: {
|
|
76
|
-
enableFetch?: boolean;
|
|
77
|
-
enableOverwrite?: boolean;
|
|
78
|
-
}) => Promise<boolean>>;
|
|
79
85
|
/**
|
|
80
86
|
* Enable an optional feature and save to the settings.
|
|
81
|
-
* It may also raised from `handleSuggestOptionalFeatures` if the user agrees.
|
|
82
87
|
* @param mode The optional feature to enable.
|
|
83
88
|
*/
|
|
84
89
|
readonly enableOptionalFeature: import("../lib/HandlerUtils.js").BooleanMultipleHandlerFunction<(mode: keyof OPTIONAL_SYNC_FEATURES) => Promise<boolean>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChunkAlgorithmNames,
|
|
3
|
-
DEFAULT_SETTINGS,
|
|
4
3
|
LOG_LEVEL_NOTICE,
|
|
5
4
|
LOG_LEVEL_URGENT,
|
|
6
5
|
LOG_LEVEL_VERBOSE,
|
|
7
6
|
SALT_OF_PASSPHRASE,
|
|
8
|
-
SETTING_KEY_P2P_DEVICE_NAME
|
|
7
|
+
SETTING_KEY_P2P_DEVICE_NAME,
|
|
8
|
+
prepareSettingsForLoad
|
|
9
9
|
} from "../../common/types.js";
|
|
10
10
|
import { handlers } from "../lib/HandlerUtils.js";
|
|
11
11
|
import { ServiceBase } from "./ServiceBase.js";
|
|
@@ -31,6 +31,10 @@ class SettingService extends ServiceBase {
|
|
|
31
31
|
this._settings = value;
|
|
32
32
|
}
|
|
33
33
|
_lastPersistedSettings;
|
|
34
|
+
_settingsMigrationState;
|
|
35
|
+
getSettingsMigrationState() {
|
|
36
|
+
return this._settingsMigrationState;
|
|
37
|
+
}
|
|
34
38
|
_log;
|
|
35
39
|
constructor(context, dependencies) {
|
|
36
40
|
super(context);
|
|
@@ -88,7 +92,24 @@ class SettingService extends ServiceBase {
|
|
|
88
92
|
*/
|
|
89
93
|
saveDeviceAndVaultName() {
|
|
90
94
|
const lsKey = "obsidian-live-sync-vaultanddevicename-" + this.APIService.getSystemVaultName() + this.additionalSuffixOfDatabaseName();
|
|
91
|
-
this.
|
|
95
|
+
this.setDeviceLocalConfig(lsKey, this.deviceAndVaultName);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Read an exact key from the host's device-local configuration store.
|
|
99
|
+
*
|
|
100
|
+
* Unlike the main settings document, this state is not synchronised. Callers
|
|
101
|
+
* which need Vault namespacing should normally use {@link getSmallConfig}.
|
|
102
|
+
*/
|
|
103
|
+
getDeviceLocalConfig(key) {
|
|
104
|
+
return this.getItem(key);
|
|
105
|
+
}
|
|
106
|
+
/** Store an exact key in the host's non-synchronised configuration store. */
|
|
107
|
+
setDeviceLocalConfig(key, value) {
|
|
108
|
+
this.setItem(key, value);
|
|
109
|
+
}
|
|
110
|
+
/** Delete an exact key from the host's non-synchronised configuration store. */
|
|
111
|
+
deleteDeviceLocalConfig(key) {
|
|
112
|
+
this.deleteItem(key);
|
|
92
113
|
}
|
|
93
114
|
additionalSuffixOfDatabaseName() {
|
|
94
115
|
const suffix = this.settings?.additionalSuffixOfDatabaseName;
|
|
@@ -105,15 +126,15 @@ class SettingService extends ServiceBase {
|
|
|
105
126
|
}
|
|
106
127
|
setSmallConfig(key, value) {
|
|
107
128
|
const dbKey = this.getKey(key);
|
|
108
|
-
this.
|
|
129
|
+
this.setDeviceLocalConfig(dbKey, value);
|
|
109
130
|
}
|
|
110
131
|
getSmallConfig(key) {
|
|
111
132
|
const dbKey = this.getKey(key);
|
|
112
|
-
return this.
|
|
133
|
+
return this.getDeviceLocalConfig(dbKey) ?? "";
|
|
113
134
|
}
|
|
114
135
|
deleteSmallConfig(key) {
|
|
115
136
|
const dbKey = this.getKey(key);
|
|
116
|
-
this.
|
|
137
|
+
this.deleteDeviceLocalConfig(dbKey);
|
|
117
138
|
}
|
|
118
139
|
/**
|
|
119
140
|
* Save the current settings to storage.
|
|
@@ -266,13 +287,8 @@ class SettingService extends ServiceBase {
|
|
|
266
287
|
* Suspend extra synchronisation activities, e.g., hidden files sync.
|
|
267
288
|
*/
|
|
268
289
|
suspendExtraSync = handlers().all("suspendExtraSync");
|
|
269
|
-
/**
|
|
270
|
-
* Suggest enabling optional features to the user.
|
|
271
|
-
*/
|
|
272
|
-
suggestOptionalFeatures = handlers().all("suggestOptionalFeatures");
|
|
273
290
|
/**
|
|
274
291
|
* Enable an optional feature and save to the settings.
|
|
275
|
-
* It may also raised from `handleSuggestOptionalFeatures` if the user agrees.
|
|
276
292
|
* @param mode The optional feature to enable.
|
|
277
293
|
*/
|
|
278
294
|
enableOptionalFeature = handlers().all("enableOptionalFeature");
|
|
@@ -332,7 +348,7 @@ class SettingService extends ServiceBase {
|
|
|
332
348
|
getPassphrase(settings) {
|
|
333
349
|
const methods = {
|
|
334
350
|
"": () => Promise.resolve("*"),
|
|
335
|
-
LOCALSTORAGE: () => Promise.resolve(this.
|
|
351
|
+
LOCALSTORAGE: () => Promise.resolve(this.getDeviceLocalConfig("ls-setting-passphrase") ?? false),
|
|
336
352
|
ASK_AT_LAUNCH: () => this.APIService.confirm.askString("Passphrase", "passphrase", "")
|
|
337
353
|
};
|
|
338
354
|
const method = settings.configPassphraseStore;
|
|
@@ -445,10 +461,12 @@ class SettingService extends ServiceBase {
|
|
|
445
461
|
return settings;
|
|
446
462
|
}
|
|
447
463
|
async loadSettings() {
|
|
448
|
-
const
|
|
464
|
+
const prepared = prepareSettingsForLoad(await this.loadData());
|
|
465
|
+
const { settings, ...migrationState } = prepared;
|
|
466
|
+
this._settingsMigrationState = migrationState;
|
|
449
467
|
const hadRemoteConfigurations = Object.keys(settings.remoteConfigurations ?? {}).length > 0;
|
|
450
468
|
if (typeof settings.isConfigured == "undefined") {
|
|
451
|
-
if (
|
|
469
|
+
if (!prepared.isNewVault) {
|
|
452
470
|
settings.isConfigured = true;
|
|
453
471
|
} else {
|
|
454
472
|
const appId = this.APIService.getAppID();
|
|
@@ -493,7 +511,7 @@ class SettingService extends ServiceBase {
|
|
|
493
511
|
}
|
|
494
512
|
const lsKey = "obsidian-live-sync-vaultanddevicename-" + this.APIService.getSystemVaultName() + this.additionalSuffixOfDatabaseName();
|
|
495
513
|
if (this.settings.deviceAndVaultName != "") {
|
|
496
|
-
if (!this.
|
|
514
|
+
if (!this.getDeviceLocalConfig(lsKey)) {
|
|
497
515
|
this.setDeviceAndVaultName(this.settings.deviceAndVaultName);
|
|
498
516
|
this.saveDeviceAndVaultName();
|
|
499
517
|
this.settings.deviceAndVaultName = "";
|
|
@@ -506,14 +524,14 @@ class SettingService extends ServiceBase {
|
|
|
506
524
|
);
|
|
507
525
|
this.settings.customChunkSize = 0;
|
|
508
526
|
}
|
|
509
|
-
this.setDeviceAndVaultName(this.
|
|
527
|
+
this.setDeviceAndVaultName(this.getDeviceLocalConfig(lsKey) || "");
|
|
510
528
|
if (this.getDeviceAndVaultName() == "") {
|
|
511
529
|
if (this.settings.usePluginSync) {
|
|
512
530
|
this._log("Device name missing. Disabling plug-in sync.", LOG_LEVEL_NOTICE);
|
|
513
531
|
this.settings.usePluginSync = false;
|
|
514
532
|
}
|
|
515
533
|
}
|
|
516
|
-
if (migratedLegacyRemoteConfigurations || migratedP2PActiveRemoteConfiguration) {
|
|
534
|
+
if (!prepared.isFromFutureSchema && (prepared.changed || migratedLegacyRemoteConfigurations || migratedP2PActiveRemoteConfiguration)) {
|
|
517
535
|
await this.saveSettingData();
|
|
518
536
|
}
|
|
519
537
|
this._lastPersistedSettings = this.cloneSettings(this.settings);
|
|
@@ -2,7 +2,7 @@ import type { ServiceContext } from "../../base/ServiceBase.js";
|
|
|
2
2
|
import { InjectableAPIService } from "../injectable/InjectableAPIService.js";
|
|
3
3
|
import type { FetchHttpHandler } from "@smithy/fetch-http-handler";
|
|
4
4
|
import type { ICommandCompat } from "../../base/IService.js";
|
|
5
|
-
import type { Confirm } from "../../../interfaces/Confirm.js";
|
|
5
|
+
import type { Confirm, ConfirmActionLayout } from "../../../interfaces/Confirm.js";
|
|
6
6
|
/**
|
|
7
7
|
* Headless implementation of Confirm that returns sensible defaults instead
|
|
8
8
|
* of throwing. Dialogs are logged to stderr so the prompts are visible in
|
|
@@ -22,8 +22,8 @@ export declare class HeadlessConfirm implements Confirm {
|
|
|
22
22
|
defaultAction: T[number];
|
|
23
23
|
timeout?: number;
|
|
24
24
|
}): Promise<T[number] | false>;
|
|
25
|
-
askInPopup(key: string, dialogText: string, anchorCallback: (anchor: HTMLAnchorElement) => void): void;
|
|
26
|
-
confirmWithMessage(title: string, contentMd: string, buttons: string[], defaultAction: (typeof buttons)[number], timeout?: number): Promise<(typeof buttons)[number] | false>;
|
|
25
|
+
askInPopup(key: string, dialogText: string, anchorCallback: (anchor: HTMLAnchorElement) => void, durationMs?: number): void;
|
|
26
|
+
confirmWithMessage(title: string, contentMd: string, buttons: string[], defaultAction: (typeof buttons)[number], timeout?: number, _actionLayout?: ConfirmActionLayout): Promise<(typeof buttons)[number] | false>;
|
|
27
27
|
}
|
|
28
28
|
export declare class HeadlessAPIService<T extends ServiceContext> extends InjectableAPIService<T> {
|
|
29
29
|
private _confirmInstance;
|
|
@@ -23,10 +23,10 @@ class HeadlessConfirm {
|
|
|
23
23
|
console.error(`[Headless] ${opt.title ?? "Confirm"}: ${message} \u2192 ${String(opt.defaultAction)}`);
|
|
24
24
|
return Promise.resolve(opt.defaultAction);
|
|
25
25
|
}
|
|
26
|
-
askInPopup(key, dialogText, anchorCallback) {
|
|
26
|
+
askInPopup(key, dialogText, anchorCallback, durationMs) {
|
|
27
27
|
console.error(`[Headless] Popup (${key}): ${dialogText}`);
|
|
28
28
|
}
|
|
29
|
-
confirmWithMessage(title, contentMd, buttons, defaultAction, timeout) {
|
|
29
|
+
confirmWithMessage(title, contentMd, buttons, defaultAction, timeout, _actionLayout) {
|
|
30
30
|
console.error(`[Headless] ${title}: ${contentMd} \u2192 ${defaultAction}`);
|
|
31
31
|
return Promise.resolve(defaultAction);
|
|
32
32
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { ServiceContext } from "../../base/ServiceBase.js";
|
|
2
2
|
import { TweakValueService } from "../../base/TweakValueService.js";
|
|
3
3
|
export declare class InjectableTweakValueService<T extends ServiceContext> extends TweakValueService<T> {
|
|
4
|
-
fetchRemotePreferred: import("../../lib/HandlerUtils.js").HandlerFunction<(trialSetting: import("../../../
|
|
4
|
+
fetchRemotePreferred: import("../../lib/HandlerUtils.js").HandlerFunction<(trialSetting: import("../../../settings.js").RemoteDBSettings) => Promise<import("../../../common/types.js").TweakValues | false>, unknown>;
|
|
5
5
|
checkAndAskResolvingMismatched: import("../../lib/HandlerUtils.js").HandlerFunction<(preferred: Partial<import("../../../common/types.js").TweakValues>) => Promise<[import("../../../common/types.js").TweakValues | boolean, boolean]>, unknown>;
|
|
6
6
|
askResolvingMismatched: import("../../lib/HandlerUtils.js").HandlerFunction<(preferredSource: import("../../../common/types.js").TweakValues) => Promise<"OK" | "CHECKAGAIN" | "IGNORE">, unknown>;
|
|
7
|
-
checkAndAskUseRemoteConfiguration: import("../../lib/HandlerUtils.js").HandlerFunction<(settings: import("../../../
|
|
7
|
+
checkAndAskUseRemoteConfiguration: import("../../lib/HandlerUtils.js").HandlerFunction<(settings: import("../../../settings.js").RemoteDBSettings) => Promise<{
|
|
8
8
|
result: false | import("../../../common/types.js").TweakValues;
|
|
9
9
|
requireFetch: boolean;
|
|
10
10
|
}>, unknown>;
|
|
11
|
-
askUseRemoteConfiguration: import("../../lib/HandlerUtils.js").HandlerFunction<(trialSetting: import("../../../
|
|
11
|
+
askUseRemoteConfiguration: import("../../lib/HandlerUtils.js").HandlerFunction<(trialSetting: import("../../../settings.js").RemoteDBSettings, preferred: import("../../../common/types.js").TweakValues) => Promise<{
|
|
12
12
|
result: false | import("../../../common/types.js").TweakValues;
|
|
13
13
|
requireFetch: boolean;
|
|
14
14
|
}>, unknown>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings defaults and migration contracts shared by maintained hosts.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { DEFAULT_SETTINGS, NEW_VAULT_SETTINGS, P2P_DEFAULT_SETTINGS, SETTINGS_SCHEMA_DEFAULTS, createNewVaultSettings, } from "./common/models/setting.const.defaults.js";
|
|
7
|
+
export { PREFERRED_BASE, PREFERRED_JOURNAL_SYNC, PREFERRED_SETTING_CLOUDANT, PREFERRED_SETTING_SELF_HOSTED, } from "./common/models/setting.const.preferred.js";
|
|
8
|
+
export { CURRENT_SETTING_VERSION } from "./common/models/setting.const.js";
|
|
9
|
+
export { prepareSettingsForLoad, SettingsMigrationReviewCodes, type PreparedSettings, type SettingsMigrationReviewCode, type SettingsMigrationReviewReason, type SettingsMigrationState, } from "./common/models/setting.lifecycle.js";
|
|
10
|
+
export type { ObsidianLiveSyncSettings, RemoteDBSettings, RemoteTypeSettings, } from "./common/models/setting.type.js";
|
package/dist/settings.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_SETTINGS,
|
|
3
|
+
NEW_VAULT_SETTINGS,
|
|
4
|
+
P2P_DEFAULT_SETTINGS,
|
|
5
|
+
SETTINGS_SCHEMA_DEFAULTS,
|
|
6
|
+
createNewVaultSettings
|
|
7
|
+
} from "./common/models/setting.const.defaults.js";
|
|
8
|
+
import {
|
|
9
|
+
PREFERRED_BASE,
|
|
10
|
+
PREFERRED_JOURNAL_SYNC,
|
|
11
|
+
PREFERRED_SETTING_CLOUDANT,
|
|
12
|
+
PREFERRED_SETTING_SELF_HOSTED
|
|
13
|
+
} from "./common/models/setting.const.preferred.js";
|
|
14
|
+
import { CURRENT_SETTING_VERSION } from "./common/models/setting.const.js";
|
|
15
|
+
import {
|
|
16
|
+
prepareSettingsForLoad,
|
|
17
|
+
SettingsMigrationReviewCodes
|
|
18
|
+
} from "./common/models/setting.lifecycle.js";
|
|
19
|
+
export {
|
|
20
|
+
CURRENT_SETTING_VERSION,
|
|
21
|
+
DEFAULT_SETTINGS,
|
|
22
|
+
NEW_VAULT_SETTINGS,
|
|
23
|
+
P2P_DEFAULT_SETTINGS,
|
|
24
|
+
PREFERRED_BASE,
|
|
25
|
+
PREFERRED_JOURNAL_SYNC,
|
|
26
|
+
PREFERRED_SETTING_CLOUDANT,
|
|
27
|
+
PREFERRED_SETTING_SELF_HOSTED,
|
|
28
|
+
SETTINGS_SCHEMA_DEFAULTS,
|
|
29
|
+
SettingsMigrationReviewCodes,
|
|
30
|
+
createNewVaultSettings,
|
|
31
|
+
prepareSettingsForLoad
|
|
32
|
+
};
|