@hesprs/sync-engine-sdk 3.1.5 → 3.1.7

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.
Files changed (35) hide show
  1. package/dist/dev.js +1 -1
  2. package/dist/dev.spec.d.ts +1 -1
  3. package/dist/index-lLeUlsPq.spec.d.ts +1404 -0
  4. package/dist/index.js +1 -1
  5. package/dist/index.spec.d.ts +2 -834
  6. package/dist/node_modules/.bun/synthkernel@._synthkernel.tgz/node_modules/synthkernel/dist/reactive.js +1 -0
  7. package/dist/packages/plugin/src/components/MigrationModal.js +1 -0
  8. package/dist/prefix.js +1 -1
  9. package/package.json +1 -1
  10. package/dist/index-g3mTMY1u.spec.d.ts +0 -560
  11. package/dist/plugin/src/components/MigrationModal.js +0 -1
  12. /package/dist/{plugin → packages/plugin}/src/components/render-progress.js +0 -0
  13. /package/dist/{plugin → packages/plugin}/src/fs/wrappers/memory-control.js +0 -0
  14. /package/dist/{plugin → packages/plugin}/src/settings/utils.js +0 -0
  15. /package/dist/{plugin → packages/plugin}/src/sync/decision/interface.js +0 -0
  16. /package/dist/{plugin → packages/plugin}/src/sync/tasks/AddRecord.js +0 -0
  17. /package/dist/{plugin → packages/plugin}/src/sync/tasks/CreateLocalDir.js +0 -0
  18. /package/dist/{plugin → packages/plugin}/src/sync/tasks/CreateRemoteDir.js +0 -0
  19. /package/dist/{plugin → packages/plugin}/src/sync/tasks/Download.js +0 -0
  20. /package/dist/{plugin → packages/plugin}/src/sync/tasks/MoveLocal.js +0 -0
  21. /package/dist/{plugin → packages/plugin}/src/sync/tasks/MoveRemote.js +0 -0
  22. /package/dist/{plugin → packages/plugin}/src/sync/tasks/RemoveLocal.js +0 -0
  23. /package/dist/{plugin → packages/plugin}/src/sync/tasks/RemoveRecord.js +0 -0
  24. /package/dist/{plugin → packages/plugin}/src/sync/tasks/RemoveRemote.js +0 -0
  25. /package/dist/{plugin → packages/plugin}/src/sync/tasks/ResolveConflict.js +0 -0
  26. /package/dist/{plugin → packages/plugin}/src/sync/tasks/Upload.js +0 -0
  27. /package/dist/{plugin → packages/plugin}/src/sync/tasks/interface.js +0 -0
  28. /package/dist/{plugin → packages/plugin}/src/utils/move-value.js +0 -0
  29. /package/dist/{plugin → packages/plugin}/src/utils/pipe.js +0 -0
  30. /package/dist/{plugin → packages/plugin}/src/utils/round-percent.js +0 -0
  31. /package/dist/{plugin → packages/plugin}/src/utils/sha-256.js +0 -0
  32. /package/dist/{plugin → packages/plugin}/src/utils/to-error-message.js +0 -0
  33. /package/dist/{plugin → packages/plugin}/test/test-kit.js +0 -0
  34. /package/dist/{shared → packages/shared}/src/get-status.js +0 -0
  35. /package/dist/{shared → packages/shared}/src/path.js +0 -0
@@ -0,0 +1,1404 @@
1
+ import { App, Command, EventRef, ExtraButtonComponent, IconName, ListedFiles, Modal, Plugin, RequestUrlParam, Setting, SettingDefinition, SettingDefinitionGroup, SettingDefinitionItem, SettingDefinitionList, SettingDefinitionPage, Stat, TextComponent, ToggleComponent } from "obsidian";
2
+ //#region ../shared/src/e2e-utils.spec.d.ts
3
+ type General$1 = any;
4
+ //#endregion
5
+ //#region ../shared/src/binary.d.ts
6
+ type Binary = Uint8Array<ArrayBuffer>;
7
+ //#endregion
8
+ //#region src/types.d.ts
9
+ type MaybePromise<T> = Promise<T> | T;
10
+ type TogglableValue<T = number> = {
11
+ enabled: boolean;
12
+ value: T;
13
+ };
14
+ type FileStat = {
15
+ isDir: false;
16
+ key: string;
17
+ mtime: number;
18
+ size: number;
19
+ uid: string;
20
+ };
21
+ type FolderStat = {
22
+ isDir: true;
23
+ key: string;
24
+ };
25
+ type Stat$1 = FileStat | FolderStat;
26
+ type RecordStat = {
27
+ isDir: false;
28
+ local: string;
29
+ remote: string;
30
+ } | {
31
+ isDir: true;
32
+ };
33
+ type StatsMap = Map<string, Stat$1>;
34
+ type RecordStatsMap = Map<string, RecordStat>;
35
+ type GlobMatchRule = {
36
+ expr: string;
37
+ caseSensitive: boolean;
38
+ };
39
+ type Progress<T = string> = {
40
+ total: number;
41
+ completed: number;
42
+ current?: T;
43
+ };
44
+ //#endregion
45
+ //#region src/fs/interface.d.ts
46
+ /**
47
+ * All keys use unified format:
48
+ * - root: `/`
49
+ * - file: `note.md`, `folder/note.md`
50
+ * - folder: `folder/`, `folder/nested/`
51
+ */
52
+ type RootFs = {
53
+ getUid(): string;
54
+ read(key: string, stat: FileStat): MaybePromise<Binary>;
55
+ readStream(key: string, stat: FileStat): MaybePromise<ReadableStream<Binary>>;
56
+ write(key: string, value: Binary, stat: FileStat): MaybePromise<string>;
57
+ writeStream(key: string, value: ReadableStream<Binary>, stat: FileStat): MaybePromise<string>;
58
+ delete(key: string): MaybePromise<void>;
59
+ move(oldKey: string, newKey: string): MaybePromise<void>;
60
+ mkdir(key: string, recursive?: boolean): MaybePromise<void>;
61
+ stat(key: string): MaybePromise<Stat$1>;
62
+ exists(key: string): MaybePromise<boolean>;
63
+ list(key: string, reporter: ListReporter): MaybePromise<Array<Stat$1>>;
64
+ };
65
+ type ListReporter = (progress: Required<Progress>) => MaybePromise<'include' | 'exclude' | 'advance'>;
66
+ type WrappedFs = RootFs & {
67
+ original: Fs;
68
+ };
69
+ type Fs = WrappedFs | RootFs;
70
+ type WriteAtom = {
71
+ type: 'write';
72
+ key: string;
73
+ execute: () => MaybePromise<string>;
74
+ resolve: (uid: string) => void;
75
+ reject: (err: Error) => void;
76
+ };
77
+ type DeleteAtom = {
78
+ type: 'delete';
79
+ key: string;
80
+ execute: () => MaybePromise<void>;
81
+ resolve: () => void;
82
+ reject: (err: Error) => void;
83
+ };
84
+ type MoveAtom = {
85
+ type: 'move';
86
+ oldKey: string;
87
+ newKey: string;
88
+ execute: () => MaybePromise<void>;
89
+ resolve: () => void;
90
+ reject: (err: Error) => void;
91
+ };
92
+ type MkdirAtom = {
93
+ type: 'mkdir';
94
+ key: string;
95
+ execute: () => MaybePromise<void>;
96
+ resolve: () => void;
97
+ reject: (err: Error) => void;
98
+ };
99
+ type InputAtom = WriteAtom | DeleteAtom | MoveAtom | MkdirAtom;
100
+ type CustomAtom = {
101
+ type: 'custom';
102
+ execute: () => MaybePromise<void>;
103
+ };
104
+ type OutputAtom = InputAtom | CustomAtom;
105
+ type OptimizerInput = {
106
+ atoms: Array<InputAtom>;
107
+ fs: Fs;
108
+ executeAtom: (atom: OutputAtom) => Promise<void | string>;
109
+ };
110
+ type OptimizerOutput = Array<OutputAtom>;
111
+ type BatchOptimizer = (input: OptimizerInput) => OptimizerOutput;
112
+ //#endregion
113
+ //#region ../../node_modules/.bun/uni-kv@..+..+uni-kv.tgz/node_modules/uni-kv/dist/interface.d.ts
114
+ //#region src/interface.d.ts
115
+ type Database<D extends Record<string, unknown>, M extends Record<string, unknown>, F extends boolean> = {
116
+ getStore<K extends keyof D>(name: K): Store<D[K], F>;
117
+ getStoreNames(): IsPromise<Array<string>, F>;
118
+ deleteStore(name: string): IsPromise<void, F>;
119
+ clearStores(): IsPromise<void, F>;
120
+ getMeta<T extends keyof M>(key: T): IsPromise<M[T] | undefined, F>;
121
+ setMeta<T extends keyof M>(key: T, value: M[T]): IsPromise<void, F>;
122
+ dispose(): IsPromise<void, F>;
123
+ };
124
+ type Store<T, F extends boolean> = {
125
+ get(key: string): IsPromise<T | undefined, F>;
126
+ set(key: string, value: T): IsPromise<void, F>;
127
+ delete(key: string): IsPromise<void, F>;
128
+ clear(): IsPromise<void, F>;
129
+ keys(): IsPromise<Array<string>, F>;
130
+ values(): IsPromise<Array<T>, F>;
131
+ entries(): IsPromise<Array<[string, T]>, F>;
132
+ batch(operations: Array<StoreOperations<T>>): IsPromise<Array<GetResult<T>>, F>;
133
+ };
134
+ type StoreSync<T = unknown> = Store<T, false>;
135
+ type StoreAsync<T = unknown> = Store<T, true>;
136
+ type DatabaseSync<D extends Record<string, unknown> = Record<string, unknown>, M extends Record<string, unknown> = {}> = Database<D, M, false>;
137
+ type DatabaseAsync<D extends Record<string, unknown> = Record<string, unknown>, M extends Record<string, unknown> = {}> = Database<D, M, true>;
138
+ type GetOperation = {
139
+ type: 'get';
140
+ key: string;
141
+ };
142
+ type GetResult<T> = {
143
+ key: string;
144
+ value: T | undefined;
145
+ };
146
+ type SetOperation<T> = {
147
+ type: 'set';
148
+ key: string;
149
+ value: T;
150
+ };
151
+ type DeleteOperation = {
152
+ type: 'delete';
153
+ key: string;
154
+ };
155
+ type StoreOperations<T> = GetOperation | SetOperation<T> | DeleteOperation;
156
+ type IsPromise<T, F extends boolean> = F extends true ? Promise<T> : T;
157
+ //#endregion
158
+ //#region ../../node_modules/.bun/synthkernel@.+synthkernel.tgz/node_modules/synthkernel/dist/context.d.ts
159
+ //#region src/context.d.ts
160
+ type General = any;
161
+ type GeneralConstructor = new (...args: Array<General>) => General;
162
+ type ModuleConstructor<C extends object> = new (context: C) => General;
163
+ type GeneralModuleInput = ReadonlyArray<GeneralConstructor> | ReadonlyArray<object>;
164
+ type IsPlainObject<T> = T extends object ? T extends Function | Date | RegExp | Array<any> | Map<any, any> | Set<any> ? false : true : false;
165
+ type ShallowMerge<A, B> = IsPlainObject<A> extends true ? (IsPlainObject<B> extends true ? Omit<A, keyof B> & B : B) : B;
166
+ type Keys<T> = T extends General ? keyof T : never;
167
+ type InstanceEach<T extends GeneralModuleInput> = T extends ReadonlyArray<GeneralConstructor> ? { [K in keyof T]: InstanceType<T[K]>; } : T;
168
+ type PickEach<T extends ReadonlyArray<object>, K extends PropertyKey> = { [I in keyof T]: Pick<T[I], Extract<K, keyof T[I]>>; };
169
+ type RootValue<T extends object> = RootKey extends keyof T ? Extract<T[RootKey], object> : {};
170
+ type MergeRootEach<T extends ReadonlyArray<object>> = { [I in keyof T]: ShallowMerge<Omit<T[I], RootKey>, RootValue<T[I]>>; };
171
+ type ExtractKeyEach<T extends ReadonlyArray<object>, K extends Keys<T>> = { [I in keyof T]: K extends keyof T[I] ? T[I][K] : never; };
172
+ type MergeObjects<T extends ReadonlyArray<object>, O extends ReadonlyArray<object> = MergeRootEach<T>> = { [P in Keys<O[number]>]: MergeValues<ExtractKeyEach<O, P>>; };
173
+ type MergeSingleKey<M extends GeneralModuleInput, K extends Keys<InstanceEach<M>[number]>> = MergeValues<ExtractKeyEach<InstanceEach<M>, K>>;
174
+ type MergePair<A, B> = [A] extends [never] ? B : [B] extends [never] ? A : ShallowMerge<A, B>;
175
+ type MergeValues<T extends ReadonlyArray<unknown>> = T extends readonly [infer First, ...infer Rest] ? [First] extends [never] ? MergeValues<Rest> : Rest extends ReadonlyArray<unknown> ? Rest['length'] extends 0 ? First : MergePair<First, MergeValues<Rest>> : never : never;
176
+ type MergeResult<M extends GeneralModuleInput, K extends Keys<InstanceEach<M>[number]>, Pr extends object, Po extends object> = MergeObjects<[Pr, ...PickEach<InstanceEach<M>, K>, Po]>;
177
+ type Context$1<M extends GeneralModuleInput, K extends Keys<InstanceEach<M>[number]>, Pr extends object = {}, Po extends object = {}> = MergeResult<M, K, Pr, Po> & {
178
+ __modules__: WeakMap<M[number], InstanceEach<M>[number]>;
179
+ __getModule__: <C extends new (ctx: General) => InstanceEach<M>[number]>(ctor: C) => InstanceType<C>;
180
+ __addModule__: <N extends ModuleConstructor<Context$1<[...M, N], K, Pr, Po>>>(newModule: N) => Context$1<[...M, N], K, Pr, Po>;
181
+ __assign__: (obj: Partial<MergeResult<M, K, Pr, Po>>) => Context$1<M, K, Pr, Po>;
182
+ };
183
+ declare const ROOT_KEY = "root";
184
+ type RootKey = typeof ROOT_KEY;
185
+ //#endregion
186
+ //#region ../../node_modules/.bun/synthkernel@.+synthkernel.tgz/node_modules/synthkernel/dist/reactive.d.ts
187
+ //#region src/reactive.d.ts
188
+ type RefMatchingFunc<T> = (newValue: T, oldValue: T) => unknown;
189
+ type Ref<T> = {
190
+ (): T;
191
+ (newValue: T): void;
192
+ subscribe(func: RefMatchingFunc<T>, options?: {
193
+ immediate?: boolean;
194
+ }): () => void;
195
+ unsubscribe(func: RefMatchingFunc<T>): void;
196
+ clear(): void;
197
+ };
198
+ //#endregion
199
+ //#region src/modules/Storage.d.ts
200
+ type RecordStore = StoreAsync<RecordStat>;
201
+ declare class Storage {
202
+ private readonly ctx;
203
+ private readonly memoryDB;
204
+ private readonly indexedDB;
205
+ constructor(ctx: {
206
+ getNamespace: () => string;
207
+ });
208
+ private readonly getRecordStore;
209
+ private readonly deleteRecordStore;
210
+ private readonly clearRecordStores;
211
+ private readonly recordStoreExists;
212
+ readonly root: {
213
+ clearRecordStores: () => Promise<void>;
214
+ deleteRecordStore: (namespace?: string) => MaybePromise<void>;
215
+ getRecordStore: (namespace?: string) => {
216
+ get(key: string): Promise<RecordStat | undefined>;
217
+ set(key: string, value: RecordStat): Promise<void>;
218
+ delete(key: string): Promise<void>;
219
+ clear(): Promise<void>;
220
+ keys(): Promise<string[]>;
221
+ values(): Promise<RecordStat[]>;
222
+ entries(): Promise<[string, RecordStat][]>;
223
+ batch(operations: StoreOperations<RecordStat>[]): Promise<GetResult<RecordStat>[]>;
224
+ };
225
+ indexedDB: DatabaseAsync<General$1, General$1>;
226
+ memoryDB: {
227
+ getStore<K extends string | number | symbol>(name: K): {
228
+ get(key: string): any;
229
+ set(key: string, value: any): void;
230
+ delete(key: string): void;
231
+ clear(): void;
232
+ keys(): string[];
233
+ values(): any[];
234
+ entries(): [string, any][];
235
+ batch(operations: StoreOperations<any>[]): GetResult<any>[];
236
+ };
237
+ getStoreNames(): string[];
238
+ deleteStore(name: string): void;
239
+ clearStores(): void;
240
+ getMeta<T extends string | number | symbol>(key: T): any;
241
+ setMeta<T extends string | number | symbol>(key: T, value: any): void;
242
+ dispose(): void;
243
+ };
244
+ recordStoreExists: (namespace?: string) => MaybePromise<boolean>;
245
+ };
246
+ readonly dispose: () => void;
247
+ }
248
+ //#endregion
249
+ //#region src/sync/tasks/interface.d.ts
250
+ type BaseTaskOptions = {
251
+ localFs: Fs;
252
+ remoteFs: Fs;
253
+ record: RecordStore;
254
+ };
255
+ type TaskNames = 'addRecord' | 'removeRecord' | 'createLocalDir' | 'createRemoteDir' | 'download' | 'resolveConflict' | 'removeLocal' | 'removeRemote' | 'upload' | 'moveLocal' | 'moveRemote';
256
+ type ConflictResolverPayload = {
257
+ local: FileStat;
258
+ remote: FileStat;
259
+ key: string;
260
+ localFs: Fs;
261
+ remoteFs: Fs;
262
+ record: RecordStore;
263
+ };
264
+ type ConflictResolver = (payload: ConflictResolverPayload) => MaybePromise<void>;
265
+ declare abstract class BaseTask<T extends TaskOptions = TaskOptions> {
266
+ readonly options: BaseTaskOptions & T;
267
+ constructor(options: BaseTaskOptions & T);
268
+ protected readonly remoteFs: Fs;
269
+ protected readonly localFs: Fs;
270
+ protected readonly record: RecordStore;
271
+ name: TaskNames;
272
+ prettyName: string;
273
+ readonly key: string;
274
+ readonly local: (BaseTaskOptions & T)['local'];
275
+ readonly remote: (BaseTaskOptions & T)['remote'];
276
+ abstract exec(): MaybePromise<void>;
277
+ }
278
+ //#endregion
279
+ //#region src/sync/tasks/AddRecord.d.ts
280
+ declare class AddRecord extends BaseTask<OptionsWithBothStats> {
281
+ exec(): Promise<void>;
282
+ }
283
+ //#endregion
284
+ //#region src/sync/tasks/CreateRemoteDir.d.ts
285
+ declare class CreateRemoteDir extends BaseTask<OptionsWithLocalFolderStat> {
286
+ exec(): Promise<void>;
287
+ }
288
+ //#endregion
289
+ //#region src/sync/tasks/Download.d.ts
290
+ declare class Download extends BaseTask<OptionsWithRemoteFileStat> {
291
+ exec(): Promise<void>;
292
+ }
293
+ //#endregion
294
+ //#region src/sync/tasks/MoveLocal.d.ts
295
+ declare class MoveLocal extends BaseTask<OptionsWithRemoteStatAndOldKey> {
296
+ exec(): Promise<void>;
297
+ }
298
+ //#endregion
299
+ //#region src/sync/tasks/MoveRemote.d.ts
300
+ declare class MoveRemote extends BaseTask<OptionsWithLocalStatAndOldKey> {
301
+ exec(): Promise<void>;
302
+ }
303
+ //#endregion
304
+ //#region src/sync/tasks/RemoveLocal.d.ts
305
+ declare class RemoveLocal extends BaseTask<OptionsWithLocalStat> {
306
+ exec(): Promise<void>;
307
+ }
308
+ //#endregion
309
+ //#region src/sync/tasks/RemoveRecord.d.ts
310
+ declare class RemoveRecord extends BaseTask {
311
+ exec(): Promise<void>;
312
+ }
313
+ //#endregion
314
+ //#region src/sync/tasks/RemoveRemote.d.ts
315
+ declare class RemoveRemote extends BaseTask<OptionsWithRemoteStat> {
316
+ exec(): Promise<void>;
317
+ }
318
+ //#endregion
319
+ //#region src/sync/tasks/ResolveConflict.d.ts
320
+ declare class ResolveConflict extends BaseTask<OptionsWithBothFileStats & {
321
+ resolver: ConflictResolver;
322
+ }> {
323
+ exec: () => MaybePromise<void>;
324
+ }
325
+ //#endregion
326
+ //#region src/sync/tasks/Upload.d.ts
327
+ declare class Upload extends BaseTask<OptionsWithLocalFileStat> {
328
+ exec(): Promise<void>;
329
+ }
330
+ //#endregion
331
+ //#region src/sync/decision/interface.d.ts
332
+ type TaskOptions = {
333
+ key: string;
334
+ remote?: Stat$1;
335
+ local?: Stat$1;
336
+ };
337
+ type OptionsWithRemoteFileStat = {
338
+ remote: FileStat;
339
+ } & TaskOptions;
340
+ type OptionsWithLocalFileStat = {
341
+ local: FileStat;
342
+ } & TaskOptions;
343
+ type OptionsWithRemoteFolderStat = {
344
+ remote: FolderStat;
345
+ } & TaskOptions;
346
+ type OptionsWithLocalFolderStat = {
347
+ local: FolderStat;
348
+ } & TaskOptions;
349
+ type OptionsWithLocalStat = {
350
+ local: Stat$1;
351
+ } & TaskOptions;
352
+ type OptionsWithRemoteStat = {
353
+ remote: Stat$1;
354
+ } & TaskOptions;
355
+ type OptionsWithBothStats = {
356
+ local: Stat$1;
357
+ remote: Stat$1;
358
+ } & TaskOptions;
359
+ type OptionsWithBothFileStats = {
360
+ local: FileStat;
361
+ remote: FileStat;
362
+ } & TaskOptions;
363
+ type OptionsWithLocalStatAndOldKey = {
364
+ local: Stat$1;
365
+ oldKey: string;
366
+ } & TaskOptions;
367
+ type OptionsWithRemoteStatAndOldKey = {
368
+ remote: Stat$1;
369
+ oldKey: string;
370
+ } & TaskOptions;
371
+ type TaskOptionsMap = {
372
+ download: OptionsWithRemoteFileStat;
373
+ upload: OptionsWithLocalFileStat;
374
+ resolveConflict: OptionsWithBothFileStats;
375
+ removeLocal: OptionsWithLocalStat;
376
+ removeRemote: OptionsWithRemoteStat;
377
+ createLocalDir: OptionsWithRemoteFolderStat;
378
+ createRemoteDir: OptionsWithLocalFolderStat;
379
+ removeRecord: TaskOptions;
380
+ addRecord: OptionsWithBothStats;
381
+ moveLocal: OptionsWithRemoteStatAndOldKey;
382
+ moveRemote: OptionsWithLocalStatAndOldKey;
383
+ };
384
+ declare const taskMap: {
385
+ readonly addRecord: typeof AddRecord;
386
+ readonly createLocalDir: typeof CreateLocalDir;
387
+ readonly createRemoteDir: typeof CreateRemoteDir;
388
+ readonly download: typeof Download;
389
+ readonly moveLocal: typeof MoveLocal;
390
+ readonly moveRemote: typeof MoveRemote;
391
+ readonly removeLocal: typeof RemoveLocal;
392
+ readonly removeRecord: typeof RemoveRecord;
393
+ readonly removeRemote: typeof RemoveRemote;
394
+ readonly resolveConflict: typeof ResolveConflict;
395
+ readonly upload: typeof Upload;
396
+ };
397
+ type TaskFactory = <N extends TaskNames>(name: N, options: TaskOptionsMap[N]) => InstanceType<(typeof taskMap)[N]>;
398
+ type Decider = (input: DeciderInput) => Array<BaseTask>;
399
+ type DeciderInput = {
400
+ localStats: StatsMap;
401
+ remoteStats: StatsMap;
402
+ records: RecordStatsMap;
403
+ taskFactory: TaskFactory;
404
+ logger: (log: string) => void;
405
+ };
406
+ //#endregion
407
+ //#region src/sync/tasks/CreateLocalDir.d.ts
408
+ declare class CreateLocalDir extends BaseTask<OptionsWithRemoteFolderStat> {
409
+ exec(): Promise<void>;
410
+ }
411
+ //#endregion
412
+ //#region src/modules/EventBus.d.ts
413
+ type Dispatch<O extends object> = <K extends keyof O>(...[key, payload]: undefined extends O[K] ? [K] : [K, O[K]]) => void;
414
+ type On<O extends object> = <K extends keyof O>(key: K, callback: (payload: O[K]) => void) => () => void;
415
+ declare class EventBus {
416
+ readonly events: {
417
+ logSync: string;
418
+ logGeneral: string;
419
+ errorSync: string;
420
+ errorGeneral: string;
421
+ };
422
+ private readonly cleanupCallbacks;
423
+ private readonly isIdle;
424
+ private readonly syncLogs;
425
+ private readonly generalLogs;
426
+ constructor();
427
+ private readonly getThisSync;
428
+ private readonly putSyncLog;
429
+ private readonly putGeneralLog;
430
+ private readonly subscribers;
431
+ private readonly on;
432
+ private readonly dispatch;
433
+ private readonly getLogs;
434
+ readonly dispose: () => void;
435
+ readonly root: {
436
+ dispatch: Dispatch<General$1>;
437
+ getLogs: () => string;
438
+ isIdle: Ref<boolean>;
439
+ on: On<General$1>;
440
+ };
441
+ }
442
+ //#endregion
443
+ //#region src/modules/I18n.d.ts
444
+ type ObsidianLanguageCode = 'en' | 'af' | 'am' | 'ar' | 'az' | 'be' | 'bg' | 'bn' | 'ca' | 'cs' | 'da' | 'de' | 'dv' | 'el' | 'en-GB' | 'eo' | 'es' | 'eu' | 'fa' | 'fi' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ka' | 'kh' | 'kn' | 'ko' | 'ky' | 'la' | 'lt' | 'lv' | 'ml' | 'ms' | 'nan-TW' | 'ne' | 'nl' | 'nn' | 'no' | 'oc' | 'or' | 'pl' | 'pt' | 'pt-BR' | 'ro' | 'ru' | 'sa' | 'si' | 'sk' | 'sl' | 'sq' | 'sr' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'vi' | 'zh' | 'zh-TW';
445
+ type Factory<A = undefined> = (args: A) => DocumentFragment | string;
446
+ type Fragment<A = undefined> = (args: A) => DocumentFragment;
447
+ type Snippet<A = undefined> = (args: A) => string;
448
+ type TranslationTypes = string | Factory<General$1>;
449
+ type TranslationResource = Record<string, TranslationTypes>;
450
+ type TranslateParams<R extends TranslationTypes> = R extends Factory<infer A> ? ([A] extends [undefined] ? [] : [A]) : [];
451
+ type Translate<O extends TranslationResource> = <K extends keyof O>(key: K, ...arg: TranslateParams<O[K]>) => O[K] extends string | Snippet<General$1> ? string : DocumentFragment;
452
+ declare class I18n {
453
+ private readonly targetLangs;
454
+ readonly i18n: {};
455
+ private readonly registerI18n;
456
+ private readonly translate;
457
+ root: {
458
+ registerI18n: (code: ObsidianLanguageCode, resource: TranslationResource) => void;
459
+ translate: Translate<TranslationResource>;
460
+ };
461
+ }
462
+ //#endregion
463
+ //#region src/modules/Observability.d.ts
464
+ type SyncStage = 'none' | 'walkingRemote' | 'awaitingConfirmation' | 'executing' | 'completed' | 'completedNoop' | 'cancelled' | 'failed';
465
+ type AddRibbonIcon = (icon: IconName, title: string, callback: (evt: MouseEvent) => void) => HTMLElement;
466
+ declare class Observability {
467
+ private readonly ctx;
468
+ private lastSyncTime;
469
+ private lastFailure?;
470
+ private readonly sinceLastSyncText;
471
+ private readonly syncStage;
472
+ private readonly walkProgress;
473
+ private readonly executionProgress;
474
+ private readonly cleanupCallbacks;
475
+ private readonly t;
476
+ private readonly progressText;
477
+ readonly settings: {
478
+ noticeStatusOnMobile: boolean;
479
+ exportLogsDirectory: string;
480
+ };
481
+ readonly i18n: {
482
+ startSync: string;
483
+ startNonInteractiveSync: string;
484
+ stopSync: string;
485
+ showProgress: string;
486
+ exportLogsToFile: string;
487
+ exportLogsFailed: string;
488
+ idle: string;
489
+ };
490
+ constructor(ctx: {
491
+ addStatusBarItem: () => HTMLElement;
492
+ on: On<Events>;
493
+ translate: Translate<Translations>;
494
+ isIdle: Ref<boolean>;
495
+ dispatch: Dispatch<Events>;
496
+ requestSync: (trigger: string) => Promise<SyncTerminateReason>;
497
+ showProgress: () => void;
498
+ addCommand: (command: Command) => Command;
499
+ addRibbonIcon: AddRibbonIcon;
500
+ getLogs: () => string;
501
+ app: App;
502
+ });
503
+ readonly start: () => void;
504
+ private readonly setupStatus;
505
+ private readonly setupCommands;
506
+ private readonly exportLogs;
507
+ readonly dispose: () => void;
508
+ root: {
509
+ executionProgress: Ref<Progress<TaskInfo>>;
510
+ exportLogs: () => Promise<void>;
511
+ syncStage: Ref<SyncStage>;
512
+ walkProgress: Ref<Progress>;
513
+ };
514
+ }
515
+ //#endregion
516
+ //#region src/components/file-tree/index.d.ts
517
+ type FileTreeTranslations = {
518
+ selectAll: string;
519
+ xSelected: Snippet<number>;
520
+ };
521
+ //#endregion
522
+ //#region src/modules/Extensibility.d.ts
523
+ type ModuleInstance = {
524
+ moduleSettings: object;
525
+ dispose?: () => void;
526
+ start?: () => void;
527
+ };
528
+ type ModuleCtor = new (ctx: object) => ModuleInstance;
529
+ type ModuleMeta = {
530
+ id: string;
531
+ name: string;
532
+ version: string;
533
+ description: string;
534
+ main: string;
535
+ icon?: string;
536
+ minPluginVersion?: string;
537
+ readme?: string;
538
+ integrity: string;
539
+ };
540
+ type AugmentedModuleMeta = ModuleMeta & {
541
+ enabled: boolean;
542
+ source: string;
543
+ icon: string;
544
+ };
545
+ declare class Extensibility {
546
+ private readonly ctx;
547
+ private readonly moduleDir;
548
+ private readonly sourceCache;
549
+ private readonly discoveredModules;
550
+ private readonly loadedModules;
551
+ private readonly moduleStore;
552
+ private autoUpdateTimeout?;
553
+ readonly settings: {
554
+ moduleSources: Array<string>;
555
+ moduleAutoUpdate: boolean;
556
+ modules: Record<string, object>;
557
+ };
558
+ readonly i18n: {
559
+ failedToLoadModule: Snippet<string>;
560
+ failedToDownloadModule: Snippet<string>;
561
+ failedToFetchSource: Snippet<string>;
562
+ };
563
+ readonly events: {
564
+ moduleLoaded: string;
565
+ moduleUnloaded: string;
566
+ };
567
+ constructor(ctx: {
568
+ app: App;
569
+ __addModule__: Context['__addModule__'];
570
+ __getModule__: Context['__getModule__'];
571
+ dispatch: Dispatch<Events>;
572
+ translate: Translate<Translations>;
573
+ allModules: Set<General$1>;
574
+ isIdle: Ref<boolean>;
575
+ saveSettings: () => Promise<void>;
576
+ indexedDB: DatabaseAsync<Record<string, AugmentedModuleMeta>>;
577
+ });
578
+ readonly start: () => void;
579
+ private readonly createOperationFactory;
580
+ private readonly loadAllModules;
581
+ private readonly loadModule;
582
+ private readonly unloadModule;
583
+ private readonly installModule;
584
+ private readonly downloadModule;
585
+ private readonly deleteModule;
586
+ private readonly fetchSources;
587
+ private readonly updateModules;
588
+ private readonly updateModuleMeta;
589
+ private readonly enableModule;
590
+ private readonly disableModule;
591
+ private readonly getModulePath;
592
+ private readonly parseModulePath;
593
+ readonly dispose: () => void;
594
+ readonly root: {
595
+ deleteModule: (id: string) => Promise<void>;
596
+ disableModule: (id: string) => void;
597
+ discoveredModules: Map<string, AugmentedModuleMeta>;
598
+ downloadModule: (meta: AugmentedModuleMeta, waitIdle?: boolean) => Promise<void>;
599
+ enableModule: (id: string) => Promise<void>;
600
+ fetchSources: (manual?: boolean) => Promise<AugmentedModuleMeta[]>;
601
+ installModule: (meta: AugmentedModuleMeta, module: string) => Promise<void>;
602
+ loadAllModules: () => Promise<void>;
603
+ loadModule: (meta: AugmentedModuleMeta, start?: boolean, module?: string) => Promise<void>;
604
+ loadedModules: Map<string, ModuleCtor>;
605
+ pluginOutdated: boolean;
606
+ unloadModule: (id: string) => void;
607
+ updateModuleMeta: (meta: AugmentedModuleMeta) => Promise<void>;
608
+ updateModules: () => Promise<void>;
609
+ };
610
+ }
611
+ //#endregion
612
+ //#region src/components/UnknownModuleModal.d.ts
613
+ type FileInfo = {
614
+ path: string;
615
+ size: string;
616
+ mtime: string;
617
+ ctime: string;
618
+ fileName: string;
619
+ };
620
+ type UnknownModuleTranslations = {
621
+ unknownModule: string;
622
+ unknownModuleDescription: Fragment<FileInfo>;
623
+ delete: string;
624
+ configure: string;
625
+ };
626
+ //#endregion
627
+ //#region src/modules/Setting.d.ts
628
+ type SettingTree = {
629
+ (self: SettingTree): SettingDefinitionItem;
630
+ [key: number]: SettingTree;
631
+ };
632
+ type NestedCallableTree = {
633
+ (self: SettingTree): SettingDefinitionItem;
634
+ [key: number]: CallableOrObjectTree;
635
+ };
636
+ type CallableOrObjectTree = NestedCallableTree | {
637
+ [key: number]: CallableOrObjectTree;
638
+ };
639
+ type SettingEntry = {
640
+ priority: number;
641
+ apply: CallableOrObjectTree;
642
+ };
643
+ declare class Setting$1 {
644
+ private readonly ctx;
645
+ private readonly cleanupCallbacks;
646
+ private settingTab?;
647
+ private readonly settingRegistry;
648
+ readonly i18n: {
649
+ match: string;
650
+ matchLabelDescription: string;
651
+ speed: string;
652
+ speedLabelDescription: string;
653
+ };
654
+ constructor(ctx: {
655
+ on: On<Events>;
656
+ translate: Translate<Translations>;
657
+ registerSetting: (entry: SettingEntry) => () => boolean;
658
+ });
659
+ readonly start: () => void;
660
+ private readonly matchLabel;
661
+ private readonly speedLabel;
662
+ private readonly addSettingTab;
663
+ private readonly rerenderSettingTab;
664
+ private readonly refreshSettingTab;
665
+ root: {
666
+ addSettingTab: (plugin: Plugin) => void;
667
+ matchLabel: () => {
668
+ text: string;
669
+ tooltip: string;
670
+ };
671
+ refreshSettingTab: () => void | undefined;
672
+ registerSetting: (entry: SettingEntry) => () => boolean;
673
+ rerenderSettingTab: () => void | undefined;
674
+ speedLabel: () => {
675
+ color: string;
676
+ text: string;
677
+ textColor: string;
678
+ tooltip: string;
679
+ };
680
+ };
681
+ readonly dispose: () => void;
682
+ }
683
+ //#endregion
684
+ //#region src/settings/utils.d.ts
685
+ type EphemeralEditableItem<T> = {
686
+ valid: boolean;
687
+ new: boolean;
688
+ value: T;
689
+ };
690
+ type EphemeralEditableListSchema = {
691
+ ephemeralEditableLists: Array<EphemeralEditableItem<General$1>>;
692
+ };
693
+ type AugmentedSettingDefinitionItem<K extends string = string> = SettingDefinitionGroup<K> | SettingDefinitionList<K> | (SettingDefinitionPage<K> & {
694
+ labels?: Array<LabelDefinition>;
695
+ }) | (SettingDefinition<K> & {
696
+ labels?: Array<LabelDefinition>;
697
+ });
698
+ type LabelDefinition = {
699
+ text: string;
700
+ tooltip: string;
701
+ color?: string;
702
+ textColor?: string;
703
+ };
704
+ declare function s(parent: (self: SettingTree) => AugmentedSettingDefinitionItem, children?: CallableOrObjectTree): CallableOrObjectTree;
705
+ declare function reactivelyValidate<T>({ text, parse, onSave, format, immediate }: {
706
+ text: TextComponent;
707
+ parse: (value: string) => T | undefined;
708
+ format?: (value: T) => string;
709
+ onSave: (value: T) => void;
710
+ immediate?: boolean;
711
+ }): void;
712
+ declare function generateEditableList<T>({ memoryDB, items, identifier, saveSettings, rerenderSettingTab, defaultValue, render, translations: { add, empty, heading }, extraButtons }: {
713
+ memoryDB: DatabaseSync<EphemeralEditableListSchema>;
714
+ items: Array<T>;
715
+ identifier: string;
716
+ saveSettings: () => Promise<void>;
717
+ rerenderSettingTab: () => void;
718
+ defaultValue: T;
719
+ render: (setting: Setting, item: EphemeralEditableItem<T>, save: () => void) => void | (() => void);
720
+ translations: {
721
+ add: string;
722
+ empty: string;
723
+ heading?: string;
724
+ };
725
+ extraButtons?: Array<(button: ExtraButtonComponent, list: Array<EphemeralEditableItem<T>>, save: () => void) => void>;
726
+ }): SettingDefinitionList;
727
+ //#endregion
728
+ //#region src/settings/controls.d.ts
729
+ type ControlsSettingTranslations = {
730
+ controls: string;
731
+ maxFileSize: string;
732
+ maxFileSizeDescription: string;
733
+ maxFileSizePlaceholder: string;
734
+ maxRequestConcurrency: string;
735
+ minRequestInterval: string;
736
+ minRequestIntervalDescription: string;
737
+ minRequestIntervalPlaceholder: string;
738
+ maxRequestConcurrencyPlaceholder: string;
739
+ maxRequestConcurrencyDescription: string;
740
+ maxMemoryConsumption: string;
741
+ maxMemoryConsumptionDescription: string;
742
+ maxMemoryConsumptionPlaceholder: string;
743
+ };
744
+ //#endregion
745
+ //#region src/settings/development.d.ts
746
+ type DevelopmentSettingTranslations = {
747
+ development: string;
748
+ clearRecords: string;
749
+ recordsCleared: string;
750
+ clear: string;
751
+ clearRecordsDescription: string;
752
+ export: string;
753
+ exportLogsDescription: string;
754
+ exportLogsDirectoryPlaceholder: string;
755
+ exportLogsToFile: string;
756
+ moduleSources: string;
757
+ moduleSourcesDescription: string;
758
+ edit: string;
759
+ xConfigured: Snippet<number>;
760
+ addSource: string;
761
+ noSourceConfigured: string;
762
+ moduleSourcePlaceholder: string;
763
+ };
764
+ //#endregion
765
+ //#region src/components/MigrationModal.d.ts
766
+ type MigrationModalTranslations = {
767
+ cancel: string;
768
+ remoteMigration: string;
769
+ migrationProcess: string;
770
+ startMigration: string;
771
+ migrationDescription: string;
772
+ migrationPhase1Description: string;
773
+ migrationPhase2Description: string;
774
+ migrationPhase3Description: string;
775
+ toggleWithoutMigration: string;
776
+ migrationFailed: string;
777
+ completed: string;
778
+ hide: string;
779
+ done: string;
780
+ };
781
+ type MigrationContext = {
782
+ app: App;
783
+ dispatch: Dispatch<Events>;
784
+ translate: Translate<MigrationModalTranslations>;
785
+ requestSync: (trigger: string) => Promise<SyncTerminateReason>;
786
+ initializeSync: () => Infras;
787
+ memoryDB: ExistingMemoryDB;
788
+ };
789
+ declare function setNeedMigration(ctx: MigrationContext, { toggle, needMigration, content, apply }: {
790
+ toggle: ToggleComponent;
791
+ needMigration?: (value: boolean) => MaybePromise<boolean>;
792
+ content: (value: boolean) => string | DocumentFragment;
793
+ apply: (value: boolean) => MaybePromise<void>;
794
+ }): void;
795
+ //#endregion
796
+ //#region src/settings/features.d.ts
797
+ type FeaturesSettingTranslations = {
798
+ features: string;
799
+ realtimeSyncFastMode: string;
800
+ realtimeSyncFastModeDescription: string;
801
+ realtimeSync: string;
802
+ realtimeSyncDescription: string;
803
+ realtimeSyncPlaceholder: string;
804
+ startupSync: string;
805
+ startupSyncDescription: string;
806
+ startupSyncPlaceholder: string;
807
+ scheduledSync: string;
808
+ scheduledSyncDescription: string;
809
+ scheduledSyncPlaceholder: string;
810
+ asymmetricStorage: string;
811
+ asymmetricStorageDescription: Fragment;
812
+ asymmetricStorageMigration: Fragment<boolean>;
813
+ } & MigrationModalTranslations;
814
+ //#endregion
815
+ //#region src/settings/filter.d.ts
816
+ type FilterSettingTranslations = {
817
+ filterRules: string;
818
+ inclusionRules: string;
819
+ inclusionRulesDescription: Fragment;
820
+ exclusionRules: string;
821
+ exclusionRulesDescription: Fragment;
822
+ xConfigured: Snippet<number>;
823
+ addInclusionRule: string;
824
+ addExclusionRule: string;
825
+ noRuleConfigured: string;
826
+ filterPlaceholder: string;
827
+ caseSensitive: string;
828
+ };
829
+ //#endregion
830
+ //#region src/sdk/prefix.d.ts
831
+ declare function prefixWrapper(original: Fs, prefix: string): WrappedFs;
832
+ //#endregion
833
+ //#region src/utils/pipe.d.ts
834
+ declare const chunkSize: number, concurrency: number;
835
+ declare function pipe({ from, to, stat, key }: {
836
+ from: Fs;
837
+ to: Fs;
838
+ key: string;
839
+ stat: FileStat;
840
+ }): Promise<string | undefined>;
841
+ declare function readWithSize(fs: Fs, key: string, stat: FileStat): Promise<Binary | ReadableStream<Binary> | undefined>;
842
+ declare function writeWithValue(fs: Fs, key: string, value: Binary | ReadableStream<Binary>, stat: FileStat): MaybePromise<string>;
843
+ //#endregion
844
+ //#region src/sdk/index.d.ts
845
+ declare function digOriginal(wrapped: Fs): RootFs;
846
+ type SelectFromContext<O extends object> = Context extends O ? O : never;
847
+ //#endregion
848
+ //#region src/settings/head.d.ts
849
+ type HeadSettingTranslations = {
850
+ moduleAutoUpdate: string;
851
+ moduleAutoUpdateDescription: string;
852
+ moduleManagement: string;
853
+ moduleManagementDescription: string;
854
+ backend: string;
855
+ backendDescription: string;
856
+ syncStrategy: string;
857
+ syncStrategyDescription: string;
858
+ checkConnectionFailed: string;
859
+ checkConnectionSuccess: string;
860
+ checkConnection: string;
861
+ conflictResolveStrategy: string;
862
+ conflictResolveStrategyDescription: string;
863
+ xEnabled: Snippet<number>;
864
+ settingTips: Fragment<{
865
+ labels: Array<LabelDefinition>;
866
+ addLabel: typeof addLabel;
867
+ }>;
868
+ };
869
+ declare function addLabel(element: Element, { text, tooltip, color, textColor }: LabelDefinition): HTMLSpanElement;
870
+ //#endregion
871
+ //#region src/settings/miscellaneous.d.ts
872
+ type MiscellaneousSettingTranslations = {
873
+ miscellaneous: string;
874
+ diffMatchPatch: string;
875
+ keepLocal: string;
876
+ keepRemote: string;
877
+ skip: string;
878
+ noticeStatusOnMobile: string;
879
+ noticeStatusOnMobileDescription: string;
880
+ confirmTasksInSync: string;
881
+ confirmTasksInSyncDescription: string;
882
+ confirmDeleteInAutoSync: string;
883
+ confirmDeleteInAutoSyncDescription: string;
884
+ customHeaders: string;
885
+ customHeadersDescription: string;
886
+ edit: string;
887
+ xConfigured: Snippet<number>;
888
+ addHeader: string;
889
+ noHeaderConfigured: string;
890
+ headerKeyPlaceholder: string;
891
+ headerValuePlaceholder: string;
892
+ addSecretHeader: string;
893
+ avoidAutoSyncWhenOffline: string;
894
+ avoidAutoSyncWhenOfflineDescription: string;
895
+ };
896
+ //#endregion
897
+ //#region src/components/module-management/index.d.ts
898
+ type ModuleManagementTranslations = {
899
+ disableModule: string;
900
+ downloadModule: string;
901
+ enableModule: string;
902
+ installed: string;
903
+ loadingModules: string;
904
+ noInstalledModulesFound: string;
905
+ noMatchingModulesFound: string;
906
+ noModulesAvailable: string;
907
+ updateAvailable: string;
908
+ updateModule: string;
909
+ deleteModule: string;
910
+ editModuleInformation: string;
911
+ official: string;
912
+ someModulesHidden: string;
913
+ openReadme: string;
914
+ };
915
+ //#endregion
916
+ //#region src/components/ModuleEditorModal.d.ts
917
+ type ModuleEditorTranslations = {
918
+ editModuleInformation: string;
919
+ enable: string;
920
+ enableDescription: string;
921
+ name: string;
922
+ namePlaceholder: string;
923
+ nameDescription: string;
924
+ description: string;
925
+ descriptionDescription: string;
926
+ descriptionPlaceholder: string;
927
+ icon: string;
928
+ iconDescription: Fragment;
929
+ iconPlaceholder: string;
930
+ update: string;
931
+ updateDescription: string;
932
+ updatePlaceholder: string;
933
+ integrityVerification: string;
934
+ integrityVerificationDescription: Fragment;
935
+ save: string;
936
+ cancel: string;
937
+ readmePage: string;
938
+ readmePageDescription: string;
939
+ readmePagePlaceholder: string;
940
+ };
941
+ //#endregion
942
+ //#region src/settings/module-management.d.ts
943
+ type ModulesTranslations = ModuleEditorTranslations & ModuleManagementTranslations & {
944
+ searchModules: string;
945
+ moduleManagement: string;
946
+ showInstalledOnly: string;
947
+ installModuleFromFile: string;
948
+ moduleExtensionWarning: Fragment;
949
+ };
950
+ //#endregion
951
+ //#region src/modules/Bootstrap.d.ts
952
+ type CustomHeaders = Array<{
953
+ type: 'plaintext' | 'secret';
954
+ value: string;
955
+ key: string;
956
+ }>;
957
+ type ExistingMemoryDB = DatabaseSync<{
958
+ localContext20000: Stat$1;
959
+ remoteContext10000: Stat$1;
960
+ remoteContext20000: Stat$1;
961
+ }, {
962
+ localContext20000Marker: string;
963
+ remoteContext10000Marker?: string;
964
+ remoteContext20000Marker: string;
965
+ }>;
966
+ declare class Bootstrap {
967
+ private readonly ctx;
968
+ private readonly cleanupCallbacks;
969
+ private readonly memoryStates;
970
+ private isCancelled?;
971
+ private readonly localPool;
972
+ private readonly remotePool;
973
+ private localFs?;
974
+ private remoteFs?;
975
+ readonly i18n: {
976
+ bidirectional: string;
977
+ mirrorLocal: string;
978
+ mirrorRemote: string;
979
+ latestSurvive: string;
980
+ keepLocal: string;
981
+ keepRemote: string;
982
+ renameAndKeepBoth: string;
983
+ skip: string;
984
+ } & ControlsSettingTranslations & DevelopmentSettingTranslations & FeaturesSettingTranslations & FilterSettingTranslations & HeadSettingTranslations & MiscellaneousSettingTranslations & UnknownModuleTranslations & FileTreeTranslations & ModulesTranslations;
985
+ readonly settings: {
986
+ maxMemoryConsumption: TogglableValue;
987
+ maxRequestConcurrency: TogglableValue;
988
+ minRequestInterval: TogglableValue;
989
+ realtimeSyncFastMode: boolean;
990
+ asymmetricStorage: boolean;
991
+ customHeaders: CustomHeaders;
992
+ confirmDeleteInAutoSync: boolean;
993
+ confirmTasksInSync: boolean;
994
+ };
995
+ constructor(ctx: {
996
+ app: App;
997
+ registerI18n: (code: ObsidianLanguageCode, resource: TranslationResource) => void;
998
+ on: On<Events>;
999
+ dispatch: Dispatch<Events>;
1000
+ memoryDB: ExistingMemoryDB;
1001
+ registerDecider: (id: string, entry: DeciderEntry) => void;
1002
+ registerLocalFsWrapper: (entry: FsWrapperEntry) => void;
1003
+ registerRemoteFs: (id: string, entry: RemoteFsEntry) => void;
1004
+ registerRemoteFsWrapper: (entry: FsWrapperEntry) => void;
1005
+ translate: Translate<Translations>;
1006
+ optimizeLocal: BatchOptimizer;
1007
+ optimizeRemote: BatchOptimizer;
1008
+ registerLocalOptimizer: (optimizer: OptimizerEntry) => void;
1009
+ registerRemoteOptimizer: (optimizer: OptimizerEntry) => void;
1010
+ registerTrigger: (key: string, entry: TriggerEntry) => () => boolean;
1011
+ registerConflictResolver: (id: string, entry: ConflictResolverEntry) => void;
1012
+ registerRemoteRequestMiddleware: (entry: RemoteRequestMiddlewareEntry) => void;
1013
+ registerLocalRequestMiddleware: (entry: LocalRequestMiddlewareEntry) => void;
1014
+ });
1015
+ readonly start: () => void;
1016
+ readonly dispose: () => void;
1017
+ }
1018
+ //#endregion
1019
+ //#region src/modules/ProgressModal.d.ts
1020
+ type DeleteConfirmReturn = {
1021
+ delete: Array<RemoveLocal>;
1022
+ reupload: Array<RemoveLocal>;
1023
+ };
1024
+ type TaskCounts = {
1025
+ total: number;
1026
+ deleteLocal: number;
1027
+ deleteRemote: number;
1028
+ conflict: number;
1029
+ };
1030
+ declare class ProgressModal extends Modal {
1031
+ private readonly ctx;
1032
+ private readonly moduleCleanupCallbacks;
1033
+ private readonly t;
1034
+ private opening;
1035
+ private readonly modalCleanupCallbacks;
1036
+ private readonly dispatch;
1037
+ private description?;
1038
+ private detailContainer?;
1039
+ private controls?;
1040
+ constructor(ctx: {
1041
+ app: App;
1042
+ translate: Translate<Translations>;
1043
+ on: On<Events>;
1044
+ dispatch: Dispatch<Events>;
1045
+ syncStage: Ref<SyncStage>;
1046
+ walkProgress: Ref<Progress>;
1047
+ executionProgress: Ref<Progress<TaskInfo>>;
1048
+ });
1049
+ readonly events: {
1050
+ tasksConfirmed: Array<BaseTask>;
1051
+ deleteConfirmed: DeleteConfirmReturn;
1052
+ };
1053
+ readonly i18n: {
1054
+ syncProgress: string;
1055
+ completed: string;
1056
+ failedTasksDescription: Snippet<number>;
1057
+ confirmDeleteDescription: Snippet<number>;
1058
+ confirmTasksDescription: Snippet<TaskCounts>;
1059
+ hide: string;
1060
+ confirm: string;
1061
+ cancel: string;
1062
+ done: string;
1063
+ stopSync: string;
1064
+ } & Record<TaskNames | SyncStage, string>;
1065
+ private readonly renderHideStop;
1066
+ private readonly renderConfirmCancel;
1067
+ private readonly renderDone;
1068
+ private readonly showDetails;
1069
+ private readonly hideDetails;
1070
+ onOpen(): void;
1071
+ root: {
1072
+ hideProgress: {
1073
+ (): void;
1074
+ (): void;
1075
+ };
1076
+ showProgress: () => void;
1077
+ };
1078
+ onClose(): void;
1079
+ dispose(): void;
1080
+ }
1081
+ //#endregion
1082
+ //#region src/modules/Scheduler.d.ts
1083
+ declare class Scheduler {
1084
+ private readonly ctx;
1085
+ private readonly pendingRequests;
1086
+ private isScheduling;
1087
+ private realtimeSyncTimer?;
1088
+ private scheduledSyncTimer?;
1089
+ private startupSyncTimer?;
1090
+ constructor(ctx: {
1091
+ syncStage: Ref<SyncStage>;
1092
+ executeSync: (trigger: string, options?: SyncOptions) => Promise<SyncTerminateReason>;
1093
+ registerEvent: (ref: EventRef) => void;
1094
+ reduceTriggers: (triggers: Array<string>) => {
1095
+ trigger: string;
1096
+ options?: SyncOptions;
1097
+ };
1098
+ app: App;
1099
+ isIdle: Ref<boolean>;
1100
+ dispatch: Dispatch<Events>;
1101
+ });
1102
+ settings: {
1103
+ startupSync: TogglableValue;
1104
+ scheduledSync: TogglableValue;
1105
+ realtimeSync: TogglableValue;
1106
+ exclusionRules: Array<GlobMatchRule>;
1107
+ inclusionRules: Array<GlobMatchRule>;
1108
+ avoidAutoSyncWhenOffline: boolean;
1109
+ };
1110
+ private readonly requestSync;
1111
+ start: () => void;
1112
+ dispose: () => void;
1113
+ private readonly startScheduledSync;
1114
+ private readonly stopScheduledSync;
1115
+ private readonly onChange;
1116
+ private readonly scheduleFlush;
1117
+ private readonly flush;
1118
+ root: {
1119
+ requestSync: (trigger: string) => Promise<SyncTerminateReason>;
1120
+ startScheduledSync: () => void;
1121
+ stopScheduledSync: () => void;
1122
+ };
1123
+ }
1124
+ //#endregion
1125
+ //#region src/index.d.ts
1126
+ declare const internalModules: readonly [typeof EventBus, typeof I18n, typeof Storage, typeof Extensibility, typeof Setting$1, typeof Registrar, typeof Sync, typeof Observability, typeof Scheduler, typeof ProgressModal, typeof Bootstrap];
1127
+ type InternalModules = typeof internalModules;
1128
+ type MergeKeys = 'settings' | 'root' | 'events' | 'i18n';
1129
+ type Context = Context$1<InternalModules, MergeKeys, {
1130
+ app: App;
1131
+ addCommand: (command: Command) => Command;
1132
+ registerEvent: (ref: EventRef) => void;
1133
+ addRibbonIcon: AddRibbonIcon;
1134
+ addStatusBarItem: () => HTMLElement;
1135
+ saveSettings: () => Promise<void>;
1136
+ }>;
1137
+ type Events = MergeSingleKey<InternalModules, 'events'>;
1138
+ type Settings = MergeSingleKey<InternalModules, 'settings'>;
1139
+ type Translations = MergeSingleKey<InternalModules, 'i18n'>;
1140
+ //#endregion
1141
+ //#region src/modules/Sync.d.ts
1142
+ type SyncTerminateReason = {
1143
+ result: 'cancelled';
1144
+ } | {
1145
+ result: 'completed';
1146
+ } | {
1147
+ result: 'failed';
1148
+ error: string;
1149
+ } | {
1150
+ result: 'noop';
1151
+ };
1152
+ type TaskInfo = {
1153
+ name: TaskNames;
1154
+ key: string;
1155
+ prettyName: string;
1156
+ isDir: boolean;
1157
+ };
1158
+ type FailedTaskInfo = TaskInfo & {
1159
+ error: string;
1160
+ };
1161
+ type RemoteLister = (info: Infras & {
1162
+ reporter: ListReporter;
1163
+ }) => MaybePromise<Array<Stat$1>>;
1164
+ type SyncOptions = {
1165
+ decider?: Decider;
1166
+ remoteLister?: RemoteLister;
1167
+ conflictResolver?: ConflictResolver;
1168
+ detectMoves?: boolean;
1169
+ needConfirmTasks?: boolean;
1170
+ needConfirmDeletion?: boolean;
1171
+ exclusionRules?: Array<GlobMatchRule>;
1172
+ inclusionRules?: Array<GlobMatchRule>;
1173
+ };
1174
+ declare class Sync {
1175
+ private readonly ctx;
1176
+ constructor(ctx: {
1177
+ dispatch: Dispatch<Events>;
1178
+ initializeSync: () => Infras;
1179
+ getDecider: () => Decider;
1180
+ on: On<Events>;
1181
+ translate: Translate<Translations>;
1182
+ getConflictResolver: () => ConflictResolver;
1183
+ });
1184
+ readonly events: {
1185
+ syncStarted: {
1186
+ isCancelled: Ref<boolean>;
1187
+ trigger: string;
1188
+ };
1189
+ remoteWalkProgress: Progress;
1190
+ syncTerminated: SyncTerminateReason;
1191
+ requestConfirmDelete: Array<RemoveLocal>;
1192
+ requestConfirmTasks: Array<BaseTask>;
1193
+ syncCanceled: undefined;
1194
+ taskCompleted: TaskInfo;
1195
+ taskFailed: FailedTaskInfo;
1196
+ executionStarted: Array<BaseTask>;
1197
+ };
1198
+ readonly settings: {
1199
+ maxFileSize: TogglableValue;
1200
+ exclusionRules: Array<GlobMatchRule>;
1201
+ inclusionRules: Array<GlobMatchRule>;
1202
+ };
1203
+ private readonly postProcess;
1204
+ private readonly confirmTasks;
1205
+ private readonly confirmDeletion;
1206
+ private readonly executeSync;
1207
+ private readonly convertDeleteToUpload;
1208
+ root: {
1209
+ executeSync: (trigger: string, options?: SyncOptions) => Promise<SyncTerminateReason>;
1210
+ };
1211
+ }
1212
+ //#endregion
1213
+ //#region src/modules/Registrar.d.ts
1214
+ type RejectableWrapper<T> = (value: T) => T | undefined;
1215
+ type OrderedWrapperEntry<T> = {
1216
+ priority: number;
1217
+ apply: RejectableWrapper<T>;
1218
+ };
1219
+ type RemoteRequestMiddlewareEntry = OrderedWrapperEntry<Request>;
1220
+ type LocalRequestMiddlewareEntry = OrderedWrapperEntry<VaultRequest>;
1221
+ type FsWrapperEntry = OrderedWrapperEntry<Fs>;
1222
+ type CheckConnectionResult = {
1223
+ success: true;
1224
+ } | {
1225
+ success: false;
1226
+ reason: string;
1227
+ };
1228
+ type RemoteFsEntry = {
1229
+ instantiate: (request: Request) => RootFs;
1230
+ prettyName: () => string;
1231
+ checkConnection: (request: Request) => MaybePromise<CheckConnectionResult>;
1232
+ };
1233
+ type DeciderEntry = {
1234
+ decider: Decider;
1235
+ prettyName: () => string;
1236
+ };
1237
+ type ConflictResolverEntry = {
1238
+ prettyName: () => string;
1239
+ resolver: ConflictResolver;
1240
+ };
1241
+ type GeneralFn = (...args: ReadonlyArray<General$1>) => unknown;
1242
+ type RejectableApply<F extends GeneralFn> = (...input: Parameters<F>) => ReturnType<F> | undefined;
1243
+ type OrderedApplyEntry<F extends GeneralFn> = {
1244
+ apply: RejectableApply<F>;
1245
+ priority: number;
1246
+ };
1247
+ type OptimizerEntry = OrderedApplyEntry<BatchOptimizer>;
1248
+ type TriggerEntry = {
1249
+ priority: number;
1250
+ options?: () => SyncOptions;
1251
+ };
1252
+ type RequestParam = Omit<RequestUrlParam, 'body'> & {
1253
+ body?: string | Binary;
1254
+ };
1255
+ type RequestResponse = {
1256
+ text: () => string;
1257
+ bytes: () => Binary;
1258
+ json: () => General$1;
1259
+ headers: Record<string, string>;
1260
+ status: number;
1261
+ };
1262
+ type Request = (params: RequestParam | string) => Promise<RequestResponse>;
1263
+ type Infras = {
1264
+ localFs: Fs;
1265
+ remoteFs: Fs;
1266
+ record: RecordStore;
1267
+ };
1268
+ declare class Registrar {
1269
+ private readonly ctx;
1270
+ private readonly cleanupCallbacks;
1271
+ private readonly localFsWrapperRegistry;
1272
+ private readonly remoteFsWrapperRegistry;
1273
+ private readonly localOptimizerRegistry;
1274
+ private readonly remoteOptimizerRegistry;
1275
+ private readonly remoteRequestMiddlewareRegistry;
1276
+ private readonly localRequestMiddlewareRegistry;
1277
+ private readonly remoteFsRegistry;
1278
+ private readonly deciderRegistry;
1279
+ private readonly triggerRegistry;
1280
+ private readonly conflictResolverRegistry;
1281
+ readonly settings: {
1282
+ remoteFs: string;
1283
+ decider: string;
1284
+ conflictResolver: string;
1285
+ };
1286
+ constructor(ctx: {
1287
+ app: App;
1288
+ getRecordStore: (namespace?: string) => StoreAsync<RecordStat>;
1289
+ });
1290
+ private readonly getVaultRequest;
1291
+ private readonly createLocalFs;
1292
+ private readonly createRemoteFs;
1293
+ private readonly getRequest;
1294
+ private readonly getCheckConnection;
1295
+ private readonly getDecider;
1296
+ private readonly optimizeLocal;
1297
+ private readonly optimizeRemote;
1298
+ private readonly reduceTriggers;
1299
+ private readonly getConflictResolver;
1300
+ private readonly getNamespace;
1301
+ private readonly initializeSync;
1302
+ root: {
1303
+ conflictResolverRegistry: Map<string, ConflictResolverEntry>;
1304
+ createLocalFs: () => Fs;
1305
+ createRemoteFs: (remoteFs?: string) => Fs;
1306
+ deciderRegistry: Map<string, DeciderEntry>;
1307
+ getCheckConnection: (remoteFs?: string) => () => MaybePromise<CheckConnectionResult>;
1308
+ getConflictResolver: () => ConflictResolver;
1309
+ getDecider: () => Decider;
1310
+ getNamespace: (localFs?: Fs, remoteFs?: Fs) => string;
1311
+ getRequest: () => Request;
1312
+ getVaultRequest: () => VaultRequest;
1313
+ initializeSync: () => Infras;
1314
+ optimizeLocal: BatchOptimizer;
1315
+ optimizeRemote: BatchOptimizer;
1316
+ reduceTriggers: (triggers: Array<string>) => {
1317
+ trigger: string;
1318
+ options?: SyncOptions;
1319
+ };
1320
+ registerConflictResolver: (key: string, entry: ConflictResolverEntry) => () => boolean;
1321
+ registerCss: (css: string) => () => void;
1322
+ registerDecider: (key: string, entry: DeciderEntry) => () => boolean;
1323
+ registerLocalFsWrapper: (entry: FsWrapperEntry) => () => boolean;
1324
+ registerLocalOptimizer: (entry: OptimizerEntry) => () => boolean;
1325
+ registerLocalRequestMiddleware: (entry: LocalRequestMiddlewareEntry) => () => boolean;
1326
+ registerRemoteFs: (key: string, entry: RemoteFsEntry) => () => boolean;
1327
+ registerRemoteFsWrapper: (entry: FsWrapperEntry) => () => boolean;
1328
+ registerRemoteOptimizer: (entry: OptimizerEntry) => () => boolean;
1329
+ registerRemoteRequestMiddleware: (entry: RemoteRequestMiddlewareEntry) => () => boolean;
1330
+ registerTrigger: (key: string, entry: TriggerEntry) => () => boolean;
1331
+ remoteFsRegistry: Map<string, RemoteFsEntry>;
1332
+ };
1333
+ readonly dispose: () => void;
1334
+ }
1335
+ //#endregion
1336
+ //#region src/fs/vault/request.d.ts
1337
+ type VaultRequestParam = {
1338
+ method: 'GET';
1339
+ key: string;
1340
+ } | {
1341
+ method: 'GET_STREAM';
1342
+ key: string;
1343
+ } | {
1344
+ method: 'PUT';
1345
+ key: string;
1346
+ value: Binary;
1347
+ headers?: {
1348
+ mtime?: number;
1349
+ ctime?: number;
1350
+ };
1351
+ } | {
1352
+ method: 'APPEND';
1353
+ key: string;
1354
+ value: Binary;
1355
+ headers?: {
1356
+ mtime?: number;
1357
+ ctime?: number;
1358
+ };
1359
+ } | {
1360
+ method: 'DELETE';
1361
+ key: string;
1362
+ headers?: {
1363
+ permanent?: boolean;
1364
+ };
1365
+ } | {
1366
+ method: 'MOVE';
1367
+ key: string;
1368
+ headers: {
1369
+ destination: string;
1370
+ };
1371
+ } | {
1372
+ method: 'MKDIR';
1373
+ key: string;
1374
+ } | {
1375
+ method: 'EXISTS';
1376
+ key: string;
1377
+ } | {
1378
+ method: 'STAT';
1379
+ key: string;
1380
+ headers?: {
1381
+ cached?: boolean;
1382
+ };
1383
+ } | {
1384
+ method: 'LIST';
1385
+ key: string;
1386
+ headers?: {
1387
+ cached?: boolean;
1388
+ };
1389
+ };
1390
+ type VaultRequestResponseMap = {
1391
+ GET: Binary;
1392
+ GET_STREAM: ReadableStream<Binary>;
1393
+ PUT: void;
1394
+ APPEND: void;
1395
+ DELETE: void;
1396
+ MOVE: void;
1397
+ MKDIR: void;
1398
+ EXISTS: boolean;
1399
+ STAT: Stat;
1400
+ LIST: ListedFiles;
1401
+ };
1402
+ type VaultRequest = <T extends VaultRequestParam>(params: T) => Promise<VaultRequestResponseMap[T['method']]>;
1403
+ //#endregion
1404
+ export { RemoveRecord as $, setNeedMigration as A, FileStat as At, ObsidianLanguageCode as B, digOriginal as C, MoveAtom as Ct, readWithSize as D, RootFs as Dt, pipe as E, OutputAtom as Et, CallableOrObjectTree as F, RecordStatsMap as Ft, On as G, Translate as H, SettingEntry as I, Stat$1 as It, DeciderInput as J, CreateLocalDir as K, AugmentedModuleMeta as L, StatsMap as Lt, generateEditableList as M, MaybePromise as Mt, reactivelyValidate as N, Progress as Nt, writeWithValue as O, WrappedFs as Ot, s as P, RecordStat as Pt, RemoveRemote as Q, ModuleMeta as R, Binary as Rt, SelectFromContext as S, MkdirAtom as St, concurrency as T, OptimizerOutput as Tt, TranslationResource as U, Snippet as V, Dispatch as W, Upload as X, TaskFactory as Y, ResolveConflict as Z, Context as _, CustomAtom as _t, FsWrapperEntry as a, AddRecord as at, Translations as b, InputAtom as bt, RemoteFsEntry as c, ConflictResolverPayload as ct, RequestParam as d, DatabaseAsync as dt, RemoveLocal as et, RequestResponse as f, DatabaseSync as ft, SyncTerminateReason as g, BatchOptimizer as gt, SyncOptions as h, StoreSync as ht, DeciderEntry as i, CreateRemoteDir as it, LabelDefinition as j, FolderStat as jt, prefixWrapper as k, WriteAtom as kt, RemoteRequestMiddlewareEntry as l, TaskNames as lt, RemoteLister as m, StoreOperations as mt, CheckConnectionResult as n, MoveLocal as nt, LocalRequestMiddlewareEntry as o, BaseTask as ot, TriggerEntry as p, StoreAsync as pt, Decider as q, ConflictResolverEntry as r, Download as rt, OptimizerEntry as s, ConflictResolver as st, VaultRequest as t, MoveRemote as tt, Request as u, RecordStore as ut, Events as v, DeleteAtom as vt, chunkSize as w, OptimizerInput as wt, ExistingMemoryDB as x, ListReporter as xt, Settings as y, Fs as yt, Fragment as z };