@hesprs/sync-engine-sdk 3.0.2 → 3.0.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/dist/dev.spec.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as FolderStat, St as FileStat, f as Request, p as RequestParam, ut as Fs, vt as RootFs, xt as Binary, yt as WrappedFs } from "./index-
|
|
1
|
+
import { Ct as FolderStat, St as FileStat, f as Request, p as RequestParam, ut as Fs, vt as RootFs, xt as Binary, yt as WrappedFs } from "./index-M1OI9qC7.spec.js";
|
|
2
2
|
//#region src/sdk/debug-wrapper.d.ts
|
|
3
3
|
declare function debugWrapper(original: Fs, log: (content: string) => void): WrappedFs;
|
|
4
4
|
//#endregion
|
|
@@ -262,7 +262,7 @@ declare class Storage {
|
|
|
262
262
|
private readonly recordStoreExists;
|
|
263
263
|
readonly root: {
|
|
264
264
|
clearRecordStores: () => Promise<void>;
|
|
265
|
-
deleteRecordStore: (namespace?: string) =>
|
|
265
|
+
deleteRecordStore: (namespace?: string) => MaybePromise<void>;
|
|
266
266
|
getRecordStore: (namespace?: string) => {
|
|
267
267
|
get(key: string): Promise<RecordStat | undefined>;
|
|
268
268
|
set(key: string, value: RecordStat): Promise<void>;
|
|
@@ -292,7 +292,7 @@ declare class Storage {
|
|
|
292
292
|
setMeta<T extends string | number | symbol>(key: T, value: any): void;
|
|
293
293
|
dispose(): void;
|
|
294
294
|
};
|
|
295
|
-
recordStoreExists: (namespace?: string) =>
|
|
295
|
+
recordStoreExists: (namespace?: string) => MaybePromise<boolean>;
|
|
296
296
|
};
|
|
297
297
|
readonly dispose: () => void;
|
|
298
298
|
}
|
|
@@ -799,11 +799,9 @@ type ControlsSettingTranslations = {
|
|
|
799
799
|
//#region src/settings/development.d.ts
|
|
800
800
|
type DevelopmentSettingTranslations = {
|
|
801
801
|
development: string;
|
|
802
|
-
vaultRecordsCleared: string;
|
|
803
|
-
clearVaultRecords: string;
|
|
804
|
-
clearAllRecords: string;
|
|
805
|
-
allRecordsCleared: string;
|
|
806
802
|
clearRecords: string;
|
|
803
|
+
recordsCleared: string;
|
|
804
|
+
clear: string;
|
|
807
805
|
clearRecordsDescription: string;
|
|
808
806
|
export: string;
|
|
809
807
|
exportLogsDescription: string;
|
|
@@ -1058,7 +1056,7 @@ declare class ProgressModal extends Modal {
|
|
|
1058
1056
|
completed: string;
|
|
1059
1057
|
failedTasksDescription: string;
|
|
1060
1058
|
confirmDeleteDescription: string;
|
|
1061
|
-
confirmTasksDescription:
|
|
1059
|
+
confirmTasksDescription: Fragment;
|
|
1062
1060
|
hide: string;
|
|
1063
1061
|
confirm: string;
|
|
1064
1062
|
cancel: string;
|
package/dist/index.spec.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as TranslationResource, A as SyncTerminateReason, B as MoveRemote, C as SelectFromContext, Ct as FolderStat, D as writeWithValue, Dt as RecordStatsMap, E as readWithSize, Et as RecordStat, F as Upload, G as BaseTask, H as Download, I as ResolveConflict, J as TaskNames, K as ConflictResolver, L as RemoveRemote, M as Decider, N as DeciderInput, O as prefixWrapper, Ot as Stat, P as TaskFactory, Q as Translate, R as RemoveRecord, S as ModuleMeta, St as FileStat, T as pipe, Tt as Progress, U as CreateRemoteDir, V as MoveLocal, W as AddRecord, X as Fragment, Y as RecordStore, Z as ObsidianLanguageCode, _ as Events, _t as OutputAtom, a as FsWrapperEntry, at as StoreOperations, b as ExistingMemoryDB, bt as WriteAtom, c as RemoteFsEntry, ct as CustomAtom, d as RemoteRequestMiddlewareEntry, dt as InputAtom, et as Dispatch, f as Request, ft as ListReporter, g as Context, gt as OptimizerOutput, h as SettingEntry, ht as OptimizerInput, i as DeciderEntry, it as StoreAsync, j as CreateLocalDir, k as setNeedMigration, kt as StatsMap, l as RemoteLister, lt as DeleteAtom, m as RequestResponse, mt as MoveAtom, n as CheckConnectionResult, nt as DatabaseAsync, o as LocalRequestMiddlewareEntry, ot as StoreSync, p as RequestParam, pt as MkdirAtom, q as ConflictResolverPayload, r as ConflictResolverEntry, rt as DatabaseSync, s as OptimizerEntry, st as BatchOptimizer, t as VaultRequest, tt as On, u as RemoteListerEntry, ut as Fs, v as Settings, vt as RootFs, w as digOriginal, wt as MaybePromise, x as AugmentedModuleMeta, xt as Binary, y as Translations, yt as WrappedFs, z as RemoveLocal } from "./index-
|
|
1
|
+
import { $ as TranslationResource, A as SyncTerminateReason, B as MoveRemote, C as SelectFromContext, Ct as FolderStat, D as writeWithValue, Dt as RecordStatsMap, E as readWithSize, Et as RecordStat, F as Upload, G as BaseTask, H as Download, I as ResolveConflict, J as TaskNames, K as ConflictResolver, L as RemoveRemote, M as Decider, N as DeciderInput, O as prefixWrapper, Ot as Stat, P as TaskFactory, Q as Translate, R as RemoveRecord, S as ModuleMeta, St as FileStat, T as pipe, Tt as Progress, U as CreateRemoteDir, V as MoveLocal, W as AddRecord, X as Fragment, Y as RecordStore, Z as ObsidianLanguageCode, _ as Events, _t as OutputAtom, a as FsWrapperEntry, at as StoreOperations, b as ExistingMemoryDB, bt as WriteAtom, c as RemoteFsEntry, ct as CustomAtom, d as RemoteRequestMiddlewareEntry, dt as InputAtom, et as Dispatch, f as Request, ft as ListReporter, g as Context, gt as OptimizerOutput, h as SettingEntry, ht as OptimizerInput, i as DeciderEntry, it as StoreAsync, j as CreateLocalDir, k as setNeedMigration, kt as StatsMap, l as RemoteLister, lt as DeleteAtom, m as RequestResponse, mt as MoveAtom, n as CheckConnectionResult, nt as DatabaseAsync, o as LocalRequestMiddlewareEntry, ot as StoreSync, p as RequestParam, pt as MkdirAtom, q as ConflictResolverPayload, r as ConflictResolverEntry, rt as DatabaseSync, s as OptimizerEntry, st as BatchOptimizer, t as VaultRequest, tt as On, u as RemoteListerEntry, ut as Fs, v as Settings, vt as RootFs, w as digOriginal, wt as MaybePromise, x as AugmentedModuleMeta, xt as Binary, y as Translations, yt as WrappedFs, z as RemoveLocal } from "./index-M1OI9qC7.spec.js";
|
|
2
2
|
export { type AddRecord, type AugmentedModuleMeta, type BaseTask, type BatchOptimizer, type Binary, type CheckConnectionResult, type ConflictResolver, type ConflictResolverEntry, type ConflictResolverPayload, type Context, type CreateLocalDir, type CreateRemoteDir, type CustomAtom, type DatabaseAsync, type DatabaseSync, type Decider, type DeciderEntry, type DeciderInput, type DeleteAtom, type Dispatch, type Download, type Events, type ExistingMemoryDB, type FileStat, type FolderStat, type Fragment, type Fs, type FsWrapperEntry, type InputAtom, type ListReporter, type LocalRequestMiddlewareEntry, type MaybePromise, type MkdirAtom, type ModuleMeta, type MoveAtom, type MoveLocal, type MoveRemote, type ObsidianLanguageCode, type On, type OptimizerEntry, type OptimizerInput, type OptimizerOutput, type OutputAtom, type Progress, type RecordStat, type RecordStatsMap, type RecordStore, type RemoteFsEntry, type RemoteLister, type RemoteListerEntry, type RemoteRequestMiddlewareEntry, type RemoveLocal, type RemoveRecord, type RemoveRemote, type Request, type RequestParam, type RequestResponse, type ResolveConflict, type RootFs, SelectFromContext, type SettingEntry, type Settings, type Stat, type StatsMap, type StoreAsync, type StoreOperations, type StoreSync, type SyncTerminateReason, type TaskFactory, type TaskNames, type Translate, type TranslationResource, type Translations, type Upload, type VaultRequest, type WrappedFs, type WriteAtom, digOriginal, pipe, prefixWrapper, readWithSize, setNeedMigration, writeWithValue };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./render-progress.js";import t from"../utils/round-percent.js";import n from"../utils/to-error-message.js";import{Modal as r,Notice as i,Setting as a}from"obsidian";var o=class extends r{ctx;options;cleanupCallbacks=[];constructor(e,t){super(e.app),this.ctx=e,this.options=t}onOpen(){let{contentEl:e,options:{content:t,apply:n}}=this,{translate:r}=this.ctx;e.empty(),e.addClass(`markdown-rendered`),this.setTitle(r(`remoteMigration`)),typeof t==`string`?e.createEl(`p`,{cls:`whitespace-pre-wrap`,text:t}):e.append(t),e.createEl(`p`,{cls:`whitespace-pre-wrap`,text:r(`migrationDescription`)}),new a(e).addButton(e=>e.setButtonText(r(`cancel`)).onClick(this.close.bind(this))).addButton(e=>e.setButtonText(r(`toggleWithoutMigration`)).onClick(async()=>{await n(),this.close()})).addButton(e=>e.setButtonText(r(`startMigration`)).setCta().onClick(this.handleMigration))}handleMigration=()=>{let{on:n,translate:r,dispatch:i}=this.ctx;this.contentEl.empty(),this.setTitle(r(`migrationProcess`));let{left:o,right:s,bar:c}=e(this.contentEl,`mb-3`),l,u=e=>{l?.remove(),l=new a(this.contentEl).addButton(t=>t.setButtonText(r(e)).onClick(this.close.bind(this))).settingEl};u(`hide`),this.cleanupCallbacks.push(n(`migrationProgress`,({total:e,completed:n,current:a})=>{n===0&&i(`logGeneral`,`Migration started.`);let l=t(n,e);s.setText(`${n}/${e} ${r(`completed`)}`),a&&o.setText(a),c.setValue(l),l===100&&u(`done`)}),n(`migrationFailed`,()=>{i(`errorGeneral`,`Migration failed.`),o.setText(r(`migrationFailed`)),u(`done`)})),this.migrate()};migrate=async()=>{let{dispatch:e,requestSync:t,initializeSync:r,translate:a,memoryDB:o}=this.ctx;e(`migrationProgress`,{completed:0,current:a(`migrationPhase1Description`),total:3});let s=(await t(`migration`)).result;if(s===`cancelled`||s===`failed`){e(`migrationFailed`,`phase 1 failed`);return}e(`migrationProgress`,{completed:1,current:a(`migrationPhase2Description`),total:3});try{let{record:e,remoteFs:t}=r();await Promise.all([e.clear(),this.options.apply(),...o.getStore(`remoteContext20000`).entries().sort(([e],[t])=>t.length-e.length).map(([e])=>t.delete(e))])}catch(t){let r=n(t);new i(`${a(`migrationFailed`)}: ${r}`),e(`migrationFailed`,r);return}e(`migrationProgress`,{completed:2,current:a(`migrationPhase3Description`),total:3});let c=(await t(`migration`)).result;if(c===`cancelled`||c===`failed`){e(`migrationFailed`,`phase 3 failed`);return}e(`migrationProgress`,{completed:3,current:a(`completed`),total:3})};onClose(){this.cleanupCallbacks.splice(0).forEach(e=>e()),this.contentEl.empty()}};function s(e,{toggle:t,needMigration:n,content:r,apply:i}){let a=!1;t.onChange(s=>{if(a){a=!1;return}
|
|
1
|
+
import e from"./render-progress.js";import t from"../utils/round-percent.js";import n from"../utils/to-error-message.js";import{Modal as r,Notice as i,Setting as a}from"obsidian";var o=class extends r{ctx;options;cleanupCallbacks=[];constructor(e,t){super(e.app),this.ctx=e,this.options=t}onOpen(){let{contentEl:e,options:{content:t,apply:n}}=this,{translate:r}=this.ctx;e.empty(),e.addClass(`markdown-rendered`),this.setTitle(r(`remoteMigration`)),typeof t==`string`?e.createEl(`p`,{cls:`whitespace-pre-wrap`,text:t}):e.append(t),e.createEl(`p`,{cls:`whitespace-pre-wrap`,text:r(`migrationDescription`)}),new a(e).addButton(e=>e.setButtonText(r(`cancel`)).onClick(this.close.bind(this))).addButton(e=>e.setButtonText(r(`toggleWithoutMigration`)).onClick(async()=>{await n(),this.close()})).addButton(e=>e.setButtonText(r(`startMigration`)).setCta().onClick(this.handleMigration))}handleMigration=()=>{let{on:n,translate:r,dispatch:i}=this.ctx;this.contentEl.empty(),this.setTitle(r(`migrationProcess`));let{left:o,right:s,bar:c}=e(this.contentEl,`mb-3`),l,u=e=>{l?.remove(),l=new a(this.contentEl).addButton(t=>t.setButtonText(r(e)).onClick(this.close.bind(this))).settingEl};u(`hide`),this.cleanupCallbacks.push(n(`migrationProgress`,({total:e,completed:n,current:a})=>{n===0&&i(`logGeneral`,`Migration started.`);let l=t(n,e);s.setText(`${n}/${e} ${r(`completed`)}`),a&&o.setText(a),c.setValue(l),l===100&&u(`done`)}),n(`migrationFailed`,()=>{i(`errorGeneral`,`Migration failed.`),o.setText(r(`migrationFailed`)),u(`done`)})),this.migrate()};migrate=async()=>{let{dispatch:e,requestSync:t,initializeSync:r,translate:a,memoryDB:o}=this.ctx;e(`migrationProgress`,{completed:0,current:a(`migrationPhase1Description`),total:3});let s=(await t(`migration`)).result;if(s===`cancelled`||s===`failed`){e(`migrationFailed`,`phase 1 failed`);return}e(`migrationProgress`,{completed:1,current:a(`migrationPhase2Description`),total:3});try{let{record:e,remoteFs:t}=r();await Promise.all([e.clear(),this.options.apply(),...o.getStore(`remoteContext20000`).entries().sort(([e],[t])=>t.length-e.length).map(([e])=>t.delete(e))])}catch(t){let r=n(t);new i(`${a(`migrationFailed`)}: ${r}`),e(`migrationFailed`,r);return}e(`migrationProgress`,{completed:2,current:a(`migrationPhase3Description`),total:3});let c=(await t(`migration`)).result;if(c===`cancelled`||c===`failed`){e(`migrationFailed`,`phase 3 failed`);return}e(`migrationProgress`,{completed:3,current:a(`completed`),total:3})};onClose(){this.cleanupCallbacks.splice(0).forEach(e=>e()),this.contentEl.empty()}};function s(e,{toggle:t,needMigration:n,content:r,apply:i}){let a=!1;t.onChange(s=>{if(a){a=!1;return}let c=async n=>{n?(a=!0,t.setValue(!s),new o(e,{apply:async()=>{await i(s),a=!0,t.setValue(s)},content:r(s)}).open()):await i(s)},l=n?.(s)??!0;l instanceof Promise?l.then(c):c(l)})}export{s as default};
|