@hesprs/sync-engine-sdk 3.0.3 → 3.1.0

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