@hesprs/sync-engine-sdk 3.1.7 → 3.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.spec.d.ts +9 -3
- package/dist/{index-lLeUlsPq.spec.d.ts → index-DbHTJm2U.spec.d.ts} +36 -45
- package/dist/index.spec.d.ts +1 -1
- package/dist/node_modules/.bun/synthkernel@._synthkernel.tgz/node_modules/synthkernel/dist/reactive.js +1 -1
- package/dist/packages/plugin/src/components/MigrationModal.js +1 -1
- package/dist/packages/plugin/src/utils/pipe.js +1 -1
- package/dist/packages/plugin/test/test-kit.js +1 -1
- package/dist/packages/shared/src/error.js +1 -0
- package/dist/pipe-DuPrzktU.js +1 -0
- package/package.json +1 -1
- package/dist/packages/plugin/src/utils/to-error-message.js +0 -1
- package/dist/packages/shared/src/get-status.js +0 -1
- package/dist/pipe-wkp7flXx.js +0 -1
package/dist/dev.spec.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as FileStat, Dt as RootFs, Ft as RecordStatsMap, It as Stat, Lt as StatsMap, Ot as WrappedFs, Pt as RecordStat, Rt as Binary, d as RequestParam, jt as FolderStat, lt as TaskNames, q as Decider, u as Request, yt as Fs } from "./index-
|
|
1
|
+
import { At as FileStat, Dt as RootFs, Ft as RecordStatsMap, It as Stat, Lt as StatsMap, Mt as MaybePromise, Ot as WrappedFs, Pt as RecordStat, Rt as Binary, d as RequestParam, f as RequestResponse, jt as FolderStat, lt as TaskNames, q as Decider, u as Request, yt as Fs } from "./index-DbHTJm2U.spec.js";
|
|
2
2
|
//#region src/sdk/debug-wrapper.d.ts
|
|
3
3
|
declare function debugWrapper(original: Fs, log: (content: string) => void): WrappedFs;
|
|
4
4
|
//#endregion
|
|
@@ -24,8 +24,11 @@ type FsHarness = {
|
|
|
24
24
|
control: Fs;
|
|
25
25
|
fs: RootFs;
|
|
26
26
|
};
|
|
27
|
+
type ResponseControl = (url: string, params: RequestParam) => MaybePromise<ResponseOverrides>;
|
|
27
28
|
type RequestHarness = {
|
|
28
|
-
calls: Array<RequestParam
|
|
29
|
+
calls: Array<RequestParam & {
|
|
30
|
+
url: string;
|
|
31
|
+
}>;
|
|
29
32
|
request: Request;
|
|
30
33
|
};
|
|
31
34
|
type ExtractedTask = {
|
|
@@ -58,7 +61,10 @@ declare function deferred<T>(): {
|
|
|
58
61
|
resolve: (value: T | PromiseLike<T>) => void;
|
|
59
62
|
};
|
|
60
63
|
declare function flush(turns?: number): Promise<void>;
|
|
61
|
-
|
|
64
|
+
type ResponseOverrides = Partial<Omit<RequestResponse, 'json'>> & {
|
|
65
|
+
json?: () => unknown;
|
|
66
|
+
};
|
|
67
|
+
declare function request(control: ResponseControl): RequestHarness;
|
|
62
68
|
declare function fs(options?: FsOptions): FsHarness;
|
|
63
69
|
declare const testKit: {
|
|
64
70
|
bytes: typeof bytes;
|
|
@@ -609,7 +609,7 @@ declare class Extensibility {
|
|
|
609
609
|
};
|
|
610
610
|
}
|
|
611
611
|
//#endregion
|
|
612
|
-
//#region src/components/
|
|
612
|
+
//#region src/components/UntrustedModuleModal.d.ts
|
|
613
613
|
type FileInfo = {
|
|
614
614
|
path: string;
|
|
615
615
|
size: string;
|
|
@@ -617,9 +617,9 @@ type FileInfo = {
|
|
|
617
617
|
ctime: string;
|
|
618
618
|
fileName: string;
|
|
619
619
|
};
|
|
620
|
-
type
|
|
621
|
-
|
|
622
|
-
|
|
620
|
+
type UntrustedModuleTranslations = {
|
|
621
|
+
untrustedModule: string;
|
|
622
|
+
untrustedModuleDescription: Fragment<FileInfo>;
|
|
623
623
|
delete: string;
|
|
624
624
|
configure: string;
|
|
625
625
|
};
|
|
@@ -981,7 +981,7 @@ declare class Bootstrap {
|
|
|
981
981
|
keepRemote: string;
|
|
982
982
|
renameAndKeepBoth: string;
|
|
983
983
|
skip: string;
|
|
984
|
-
} & ControlsSettingTranslations & DevelopmentSettingTranslations & FeaturesSettingTranslations & FilterSettingTranslations & HeadSettingTranslations & MiscellaneousSettingTranslations &
|
|
984
|
+
} & ControlsSettingTranslations & DevelopmentSettingTranslations & FeaturesSettingTranslations & FilterSettingTranslations & HeadSettingTranslations & MiscellaneousSettingTranslations & UntrustedModuleTranslations & FileTreeTranslations & ModulesTranslations;
|
|
985
985
|
readonly settings: {
|
|
986
986
|
maxMemoryConsumption: TogglableValue;
|
|
987
987
|
maxRequestConcurrency: TogglableValue;
|
|
@@ -1138,6 +1138,9 @@ type Events = MergeSingleKey<InternalModules, 'events'>;
|
|
|
1138
1138
|
type Settings = MergeSingleKey<InternalModules, 'settings'>;
|
|
1139
1139
|
type Translations = MergeSingleKey<InternalModules, 'i18n'>;
|
|
1140
1140
|
//#endregion
|
|
1141
|
+
//#region src/utils/glob-match.d.ts
|
|
1142
|
+
type GlobMatchResult = 'include' | 'exclude' | 'advance' | 'probe';
|
|
1143
|
+
//#endregion
|
|
1141
1144
|
//#region src/modules/Sync.d.ts
|
|
1142
1145
|
type SyncTerminateReason = {
|
|
1143
1146
|
result: 'cancelled';
|
|
@@ -1186,6 +1189,9 @@ declare class Sync {
|
|
|
1186
1189
|
isCancelled: Ref<boolean>;
|
|
1187
1190
|
trigger: string;
|
|
1188
1191
|
};
|
|
1192
|
+
syncInitialized: Infras & {
|
|
1193
|
+
match: (path: string) => GlobMatchResult;
|
|
1194
|
+
};
|
|
1189
1195
|
remoteWalkProgress: Progress;
|
|
1190
1196
|
syncTerminated: SyncTerminateReason;
|
|
1191
1197
|
requestConfirmDelete: Array<RemoveLocal>;
|
|
@@ -1249,22 +1255,23 @@ type TriggerEntry = {
|
|
|
1249
1255
|
priority: number;
|
|
1250
1256
|
options?: () => SyncOptions;
|
|
1251
1257
|
};
|
|
1252
|
-
type
|
|
1258
|
+
type Infras = {
|
|
1259
|
+
localFs: Fs;
|
|
1260
|
+
remoteFs: Fs;
|
|
1261
|
+
record: RecordStore;
|
|
1262
|
+
};
|
|
1263
|
+
type RequestParam = Omit<RequestUrlParam, 'body' | 'url'> & {
|
|
1253
1264
|
body?: string | Binary;
|
|
1265
|
+
ignoreCancellation?: boolean;
|
|
1254
1266
|
};
|
|
1255
1267
|
type RequestResponse = {
|
|
1256
1268
|
text: () => string;
|
|
1257
1269
|
bytes: () => Binary;
|
|
1258
|
-
json: () =>
|
|
1270
|
+
json: <T extends object = object>() => T;
|
|
1259
1271
|
headers: Record<string, string>;
|
|
1260
1272
|
status: number;
|
|
1261
1273
|
};
|
|
1262
|
-
type Request = (
|
|
1263
|
-
type Infras = {
|
|
1264
|
-
localFs: Fs;
|
|
1265
|
-
remoteFs: Fs;
|
|
1266
|
-
record: RecordStore;
|
|
1267
|
-
};
|
|
1274
|
+
type Request = (url: string, params?: RequestParam) => Promise<RequestResponse>;
|
|
1268
1275
|
declare class Registrar {
|
|
1269
1276
|
private readonly ctx;
|
|
1270
1277
|
private readonly cleanupCallbacks;
|
|
@@ -1334,58 +1341,39 @@ declare class Registrar {
|
|
|
1334
1341
|
}
|
|
1335
1342
|
//#endregion
|
|
1336
1343
|
//#region src/fs/vault/request.d.ts
|
|
1337
|
-
type VaultRequestParam = {
|
|
1344
|
+
type VaultRequestParam = ({
|
|
1338
1345
|
method: 'GET';
|
|
1339
|
-
key: string;
|
|
1340
1346
|
} | {
|
|
1341
1347
|
method: 'GET_STREAM';
|
|
1342
|
-
|
|
1348
|
+
size: number;
|
|
1343
1349
|
} | {
|
|
1344
1350
|
method: 'PUT';
|
|
1345
|
-
key: string;
|
|
1346
1351
|
value: Binary;
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
ctime?: number;
|
|
1350
|
-
};
|
|
1352
|
+
mtime?: number;
|
|
1353
|
+
ctime?: number;
|
|
1351
1354
|
} | {
|
|
1352
1355
|
method: 'APPEND';
|
|
1353
|
-
key: string;
|
|
1354
1356
|
value: Binary;
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
ctime?: number;
|
|
1358
|
-
};
|
|
1357
|
+
mtime?: number;
|
|
1358
|
+
ctime?: number;
|
|
1359
1359
|
} | {
|
|
1360
1360
|
method: 'DELETE';
|
|
1361
|
-
|
|
1362
|
-
headers?: {
|
|
1363
|
-
permanent?: boolean;
|
|
1364
|
-
};
|
|
1361
|
+
trash?: TrashOption;
|
|
1365
1362
|
} | {
|
|
1366
1363
|
method: 'MOVE';
|
|
1367
|
-
|
|
1368
|
-
headers: {
|
|
1369
|
-
destination: string;
|
|
1370
|
-
};
|
|
1364
|
+
destination: string;
|
|
1371
1365
|
} | {
|
|
1372
1366
|
method: 'MKDIR';
|
|
1373
|
-
key: string;
|
|
1374
1367
|
} | {
|
|
1375
1368
|
method: 'EXISTS';
|
|
1376
|
-
key: string;
|
|
1377
1369
|
} | {
|
|
1378
1370
|
method: 'STAT';
|
|
1379
|
-
|
|
1380
|
-
headers?: {
|
|
1381
|
-
cached?: boolean;
|
|
1382
|
-
};
|
|
1371
|
+
cached?: boolean;
|
|
1383
1372
|
} | {
|
|
1384
1373
|
method: 'LIST';
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
};
|
|
1374
|
+
cached?: boolean;
|
|
1375
|
+
}) & {
|
|
1376
|
+
ignoreCancellation?: boolean;
|
|
1389
1377
|
};
|
|
1390
1378
|
type VaultRequestResponseMap = {
|
|
1391
1379
|
GET: Binary;
|
|
@@ -1399,6 +1387,9 @@ type VaultRequestResponseMap = {
|
|
|
1399
1387
|
STAT: Stat;
|
|
1400
1388
|
LIST: ListedFiles;
|
|
1401
1389
|
};
|
|
1402
|
-
type VaultRequest = <T extends VaultRequestParam
|
|
1390
|
+
type VaultRequest = <T extends VaultRequestParam = {
|
|
1391
|
+
method: 'GET';
|
|
1392
|
+
}>(key: string, params?: T) => Promise<VaultRequestResponseMap[T['method']]>;
|
|
1393
|
+
type TrashOption = 'local' | 'system' | 'permanent';
|
|
1403
1394
|
//#endregion
|
|
1404
1395
|
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 };
|
package/dist/index.spec.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as RemoveRecord, A as setNeedMigration, At as FileStat, B as ObsidianLanguageCode, C as digOriginal, Ct as MoveAtom, D as readWithSize, Dt as RootFs, E as pipe, Et as OutputAtom, F as CallableOrObjectTree, Ft as RecordStatsMap, G as On, H as Translate, I as SettingEntry, It as Stat, J as DeciderInput, K as CreateLocalDir, L as AugmentedModuleMeta, Lt as StatsMap, M as generateEditableList, Mt as MaybePromise, N as reactivelyValidate, Nt as Progress, O as writeWithValue, Ot as WrappedFs, P as s, Pt as RecordStat, Q as RemoveRemote, R as ModuleMeta, Rt as Binary, S as SelectFromContext, St as MkdirAtom, T as concurrency, Tt as OptimizerOutput, U as TranslationResource, V as Snippet, W as Dispatch, X as Upload, Y as TaskFactory, Z as ResolveConflict, _ as Context, _t as CustomAtom, a as FsWrapperEntry, at as AddRecord, b as Translations, bt as InputAtom, c as RemoteFsEntry, ct as ConflictResolverPayload, d as RequestParam, dt as DatabaseAsync, et as RemoveLocal, f as RequestResponse, ft as DatabaseSync, g as SyncTerminateReason, gt as BatchOptimizer, h as SyncOptions, ht as StoreSync, i as DeciderEntry, it as CreateRemoteDir, j as LabelDefinition, jt as FolderStat, k as prefixWrapper, kt as WriteAtom, l as RemoteRequestMiddlewareEntry, lt as TaskNames, m as RemoteLister, mt as StoreOperations, n as CheckConnectionResult, nt as MoveLocal, o as LocalRequestMiddlewareEntry, ot as BaseTask, p as TriggerEntry, pt as StoreAsync, q as Decider, r as ConflictResolverEntry, rt as Download, s as OptimizerEntry, st as ConflictResolver, t as VaultRequest, tt as MoveRemote, u as Request, ut as RecordStore, v as Events, vt as DeleteAtom, w as chunkSize, wt as OptimizerInput, x as ExistingMemoryDB, xt as ListReporter, y as Settings, yt as Fs, z as Fragment } from "./index-
|
|
1
|
+
import { $ as RemoveRecord, A as setNeedMigration, At as FileStat, B as ObsidianLanguageCode, C as digOriginal, Ct as MoveAtom, D as readWithSize, Dt as RootFs, E as pipe, Et as OutputAtom, F as CallableOrObjectTree, Ft as RecordStatsMap, G as On, H as Translate, I as SettingEntry, It as Stat, J as DeciderInput, K as CreateLocalDir, L as AugmentedModuleMeta, Lt as StatsMap, M as generateEditableList, Mt as MaybePromise, N as reactivelyValidate, Nt as Progress, O as writeWithValue, Ot as WrappedFs, P as s, Pt as RecordStat, Q as RemoveRemote, R as ModuleMeta, Rt as Binary, S as SelectFromContext, St as MkdirAtom, T as concurrency, Tt as OptimizerOutput, U as TranslationResource, V as Snippet, W as Dispatch, X as Upload, Y as TaskFactory, Z as ResolveConflict, _ as Context, _t as CustomAtom, a as FsWrapperEntry, at as AddRecord, b as Translations, bt as InputAtom, c as RemoteFsEntry, ct as ConflictResolverPayload, d as RequestParam, dt as DatabaseAsync, et as RemoveLocal, f as RequestResponse, ft as DatabaseSync, g as SyncTerminateReason, gt as BatchOptimizer, h as SyncOptions, ht as StoreSync, i as DeciderEntry, it as CreateRemoteDir, j as LabelDefinition, jt as FolderStat, k as prefixWrapper, kt as WriteAtom, l as RemoteRequestMiddlewareEntry, lt as TaskNames, m as RemoteLister, mt as StoreOperations, n as CheckConnectionResult, nt as MoveLocal, o as LocalRequestMiddlewareEntry, ot as BaseTask, p as TriggerEntry, pt as StoreAsync, q as Decider, r as ConflictResolverEntry, rt as Download, s as OptimizerEntry, st as ConflictResolver, t as VaultRequest, tt as MoveRemote, u as Request, ut as RecordStore, v as Events, vt as DeleteAtom, w as chunkSize, wt as OptimizerInput, x as ExistingMemoryDB, xt as ListReporter, y as Settings, yt as Fs, z as Fragment } from "./index-DbHTJm2U.spec.js";
|
|
2
2
|
export { type AddRecord, type AugmentedModuleMeta, type BaseTask, type BatchOptimizer, type Binary, type CallableOrObjectTree, type CheckConnectionResult, type ConflictResolver, type ConflictResolverEntry, type ConflictResolverPayload, type Context, type CreateLocalDir, type CreateRemoteDir, type CustomAtom, type DatabaseAsync, type DatabaseSync, type Decider, type DeciderEntry, type DeciderInput, type DeleteAtom, type Dispatch, type Download, type Events, type ExistingMemoryDB, type FileStat, type FolderStat, type Fragment, type Fs, type FsWrapperEntry, type InputAtom, type LabelDefinition, type ListReporter, type LocalRequestMiddlewareEntry, type MaybePromise, type MkdirAtom, type ModuleMeta, type MoveAtom, type MoveLocal, type MoveRemote, type ObsidianLanguageCode, type On, type OptimizerEntry, type OptimizerInput, type OptimizerOutput, type OutputAtom, type Progress, type RecordStat, type RecordStatsMap, type RecordStore, type RemoteFsEntry, type RemoteLister, type RemoteRequestMiddlewareEntry, type RemoveLocal, type RemoveRecord, type RemoveRemote, type Request, type RequestParam, type RequestResponse, type ResolveConflict, type RootFs, SelectFromContext, type SettingEntry, type Settings, type Snippet, type Stat, type StatsMap, type StoreAsync, type StoreOperations, type StoreSync, type SyncOptions, type SyncTerminateReason, type TaskFactory, type TaskNames, type Translate, type TranslationResource, type Translations, type TriggerEntry, type Upload, type VaultRequest, type WrappedFs, type WriteAtom, chunkSize, concurrency, digOriginal, generateEditableList, pipe, prefixWrapper, reactivelyValidate, readWithSize, s, setNeedMigration, writeWithValue };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,n){let{equals:r=(e,t)=>e===t}=n??{},i=e,a
|
|
1
|
+
function e(e,n){let{equals:r=(e,t)=>e===t}=n??{},i=e,a=/* @__PURE__ */ new Set,o=(e=>{if(e===void 0)return t?.(o),i;if(r(e,i))return;let n=i;i=e;for(let t of[...a])if(t(e,n)===`stop`)break});return o.subscribe=(e,t)=>(a.add(e),t?.immediate&&e(i,i),()=>o.unsubscribe(e)),o.clear=a.clear.bind(a),o.unsubscribe=e=>a.delete(e),o}let t;export{e as ref};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getMessage as e}from"../../../shared/src/error.js";import{ref as t}from"../../../../node_modules/.bun/synthkernel@._synthkernel.tgz/node_modules/synthkernel/dist/reactive.js";import n from"./render-progress.js";import r from"../utils/round-percent.js";import{Modal as i,Notice as a,Setting as o}from"obsidian";var s=class extends i{ctx;options;cleanupCallbacks=[];completed=t(0);current=t(``);constructor(e,t){super(e.app),this.ctx=e,this.options=t,this.contentEl.addClass(`markdown-rendered`),this.setTitle(e.translate(`remoteMigration`))}onOpen(){let{contentEl:e,options:{content:t,apply:n}}=this,{translate:r}=this.ctx;e.empty(),typeof t==`string`?e.createEl(`p`,{cls:`whitespace-pre-wrap`,text:t}):e.append(t),e.createEl(`p`,{cls:`whitespace-pre-wrap`,text:r(`migrationDescription`)}),new o(e).addButton(e=>e.setButtonText(r(`cancel`)).onClick(this.close.bind(this))).addButton(e=>e.setButtonText(r(`toggleWithoutMigration`)).onClick(async()=>{await n(),this.close()})).addButton(e=>e.setButtonText(r(`startMigration`)).setCta().onClick(this.handleMigration))}handleMigration=()=>{let{current:e,completed:t,ctx:i,cleanupCallbacks:a,contentEl:s,migrate:c}=this,{translate:l,dispatch:u}=i;s.empty(),this.setTitle(l(`migrationProcess`));let{left:d,right:f,bar:p}=n(s,`mb-3`),m,h=e=>{m?.remove(),m=new o(s).addButton(t=>t.setButtonText(l(e)).onClick(()=>this.close())).settingEl};h(`hide`),a.push(t.subscribe(e=>{f.setText(`${e}/3 ${l(`completed`)}`),p.setValue(r(e,3))}),e.subscribe(e=>d.setText(e))),c().then(e=>{h(`done`),e.success||(u(`errorGeneral`,`Migration failed.`),d.setText(l(`migrationFailed`)))})};migrate=async()=>{let{current:t,completed:n,ctx:r}=this,{dispatch:i,requestSync:o,initializeSync:s,translate:c,memoryDB:l}=r,u=(e,t)=>{if(e.result===`failed`)return{reason:`Phase ${t}: ${e.error}`,success:!1};if(e.result===`cancelled`)return{reason:`Phase ${t}: sync cancelled`,success:!1}};i(`logGeneral`,`Migration started.`),n(0),t(c(`migrationPhase1Description`));let d=u(await o(`nonInteractiveManual`),1);if(d)return d;n(1),t(c(`migrationPhase2Description`));try{let{record:e,remoteFs:t}=s();await Promise.all([e.clear(),this.options.apply(),...l.getStore(`remoteContext20000`).keys().sort((e,t)=>t.length-e.length).map(e=>t.delete(e))])}catch(t){let n=e(t);return new a(`${c(`migrationFailed`)}: ${n}`),{reason:`Phase 2: ${n}`,success:!1}}return n(2),t(c(`migrationPhase3Description`)),u(await o(`migration`),3)||(n(3),t(c(`completed`)),{success:!0})};onClose(){this.cleanupCallbacks.splice(0).forEach(e=>e()),this.contentEl.empty()}};function c(e,{toggle:t,needMigration:n,content:r,apply:i}){let a=!1;t.onChange(o=>{if(a){a=!1;return}let c=async n=>{n?(a=!0,t.setValue(!o),new s(e,{apply:async()=>{await i(o),a=!0,t.setValue(o)},content:r(o)}).open()):await i(o)},l=n?.(o)??!0;l instanceof Promise?l.then(c):c(l)})}export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getStatus as e}from"../../../shared/src/
|
|
1
|
+
import{getStatus as e}from"../../../shared/src/error.js";import{STREAM_RESERVATION_SIZE as t}from"../fs/wrappers/memory-control.js";import{Platform as n}from"obsidian";function r(){let e=5*1024**2;`deviceMemory`in navigator&&typeof navigator.deviceMemory==`number`?navigator.deviceMemory<=4&&(e/=2):navigator.hardwareConcurrency<=4&&(e/=2),n.isAndroidApp&&(e/=2);let r=e*.8;return{chunkSize:r,concurrency:Math.floor(t/r),streamThreshold:e}}const{chunkSize:i,concurrency:a,streamThreshold:o}=r();async function s({from:e,to:t,stat:n,key:r}){let i=await c(e,r,n);if(i)return l(t,r,i,n)}async function c(e,t,n){try{return n.size>o?await e.readStream(t,n):await e.read(t,n)}catch(e){if(u(e))return;throw e}}function l(e,t,n,r){return n instanceof ReadableStream?e.writeStream(t,n,r):e.write(t,n,r)}function u(t){return e(t)===404||(t.message??String(t)).toLocaleUpperCase().includes(`ENOENT`)}export{i as chunkSize,a as concurrency,s as pipe,c as readWithSize,l as writeWithValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{taskMap as e}from"../src/sync/decision/interface.js";const t=new TextEncoder;function n(e){return t.encode(e)}function r(e,t={}){let{mtime:n=1,size:r=5,uid:i=`${e}-uid`}=t;return{isDir:!1,key:e,mtime:n,size:r,uid:i}}function i(e){return{isDir:!0,key:e}}function a(e,t){return{isDir:!1,local:e,remote:t}}function o(){return{isDir:!0}}function s(t,n){let r=n.localStats
|
|
1
|
+
import{taskMap as e}from"../src/sync/decision/interface.js";const t=new TextEncoder;function n(e){return t.encode(e)}function r(e,t={}){let{mtime:n=1,size:r=5,uid:i=`${e}-uid`}=t;return{isDir:!1,key:e,mtime:n,size:r,uid:i}}function i(e){return{isDir:!0,key:e}}function a(e,t){return{isDir:!1,local:e,remote:t}}function o(){return{isDir:!0}}function s(t,n){let r=n.localStats??/* @__PURE__ */ new Map,i=n.remoteStats??/* @__PURE__ */ new Map,a=n.records??/* @__PURE__ */ new Map,o=[];return t({localStats:r,logger:()=>{},records:a,remoteStats:i,taskFactory:((t,n)=>{let r=e[t],i=new r({...n,localFs:{},record:{},remoteFs:{}});return i.name=t,i.prettyName=t,o.push({key:n.key,name:t,...n.local!==void 0&&{local:n.local},...n.remote!==void 0&&{remote:n.remote}}),i})}),o}function c(e){return e.map(e=>e.name)}function l(e){return e.map(e=>e.key)}function u(e,t){let n=e.filter(e=>e.key===t);if(n.length!==1)throw Error(`Expected one task for ${t}, found ${n.length}.`);return n[0]}function d(e){return e===`/`||e.endsWith(`/`)?i(e):r(e,{mtime:10,size:5,uid:`uid`})}function f(e=[]){return new ReadableStream({start(t){for(let r of e)t.enqueue(typeof r==`string`?n(r):r);t.close()}})}function p(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),reject:t,resolve:e}}async function m(e=4){for(let t=0;t<e;t+=1)await new Promise(e=>{queueMicrotask(e)})}function h(){return{delete:[],exists:[],list:[],mkdir:[],move:[],read:[],readStream:[],stat:[],write:[],writeStream:[]}}function g(e={}){return{delete:()=>{},exists:()=>!1,getUid:()=>`FsControl`,list:e=>[d(e),i(`${e}folder/`),r(`${e}folder/note.md`,{mtime:12,size:7,uid:`note-2`})],mkdir:()=>{},move:()=>{},read:()=>n(``),readStream:()=>f(),stat:e=>d(e),write:()=>`write-uid`,writeStream:()=>`stream-uid`,...e}}const _=()=>n(`ok`),v=()=>`ok`,y=()=>({});function b(e={}){return{bytes:_,headers:{},status:200,text:v,...e,json:e.json??y}}function x(e){let t=[];return{calls:t,request:async(n,r)=>(t.push({url:n,...r}),b(await e(n,r??{})))}}function S(e={}){let t=h(),n=g(e.control),r=e.uid??`uid`;return{calls:t,control:n,fs:{delete:e=>(t.delete.push(e),n.delete(e)),exists:e=>(t.exists.push(e),n.exists(e)),getUid:()=>r,list:(e,r)=>(t.list.push(e),n.list(e,r)),mkdir:(e,r)=>(t.mkdir.push(e),n.mkdir(e,r)),move:(e,r)=>(t.move.push([e,r]),n.move(e,r)),read:(e,r)=>(t.read.push([e,r]),n.read(e,r)),readStream:(e,r)=>(t.readStream.push([e,r]),n.readStream(e,r)),stat:e=>(t.stat.push(e),n.stat(e)),write:(e,r,i)=>(t.write.push([e,r,i]),n.write(e,r,i)),writeStream:(e,r,i)=>(t.writeStream.push([e,i]),n.writeStream(e,r,i))}}}const C={bytes:n,deferred:p,file:r,fileRecord:a,findTask:u,flush:m,folder:i,folderRecord:o,fs:S,request:x,runDecider:s,stream:f,taskKeys:l,taskNames:c};export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let t=e,n=[t.status,t.res?.status,t.response?.status];for(let e of n)if(typeof e==`number`)return e}function t(e){return e instanceof Error?e.message:String(e)}export{t as getMessage,e as getStatus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Platform as e}from"obsidian";function t(e){let t=e,n=[t.status,t.res?.status,t.response?.status];for(let e of n)if(typeof e==`number`)return e}function n(e){return e instanceof Error?e.message:String(e)}function r(){let t=5*1024**2;`deviceMemory`in navigator&&typeof navigator.deviceMemory==`number`?navigator.deviceMemory<=4&&(t/=2):navigator.hardwareConcurrency<=4&&(t/=2),e.isAndroidApp&&(t/=2);let n=t*.8;return{chunkSize:n,concurrency:Math.floor(16777216/n),streamThreshold:t}}const{chunkSize:i,concurrency:a,streamThreshold:o}=r();async function s({from:e,to:t,stat:n,key:r}){let i=await c(e,r,n);if(i)return l(t,r,i,n)}async function c(e,t,n){try{return n.size>o?await e.readStream(t,n):await e.read(t,n)}catch(e){if(u(e))return;throw e}}function l(e,t,n,r){return n instanceof ReadableStream?e.writeStream(t,n,r):e.write(t,n,r)}function u(e){return t(e)===404||(e.message??String(e)).toLocaleUpperCase().includes(`ENOENT`)}export{l as a,c as i,a as n,n as o,s as r,i as t};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){return e instanceof Error?e.message:String(e)}export{e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){let t=e,n=[t.status,t.res?.status,t.response?.status];for(let e of n)if(typeof e==`number`)return e}export{e as getStatus};
|
package/dist/pipe-wkp7flXx.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Platform as e}from"obsidian";function t(e){let t=e,n=[t.status,t.res?.status,t.response?.status];for(let e of n)if(typeof e==`number`)return e}function n(){let t=5*1024**2;`deviceMemory`in navigator&&typeof navigator.deviceMemory==`number`?navigator.deviceMemory<=4&&(t/=2):navigator.hardwareConcurrency<=4&&(t/=2),e.isAndroidApp&&(t/=2);let n=t*.8;return{chunkSize:n,concurrency:Math.floor(16777216/n),streamThreshold:t}}const{chunkSize:r,concurrency:i,streamThreshold:a}=n();async function o({from:e,to:t,stat:n,key:r}){let i=await s(e,r,n);if(i)return c(t,r,i,n)}async function s(e,t,n){try{return n.size>a?await e.readStream(t,n):await e.read(t,n)}catch(e){if(l(e))return;throw e}}function c(e,t,n,r){return n instanceof ReadableStream?e.writeStream(t,n,r):e.write(t,n,r)}function l(e){return t(e)===404||(e.message??String(e)).toLocaleUpperCase().includes(`ENOENT`)}export{c as a,s as i,i as n,o as r,r as t};
|