Miscellaneous Export Index Root runtime exports Export Description digOriginalUnwraps nested wrappers to root filesystem. See file system . prefixWrapperExposes a prefixed directory as an Fs root. See file system . setNeedMigrationAdds migration confirmation behavior to a setting toggle. pipeTransfer a file between two filesystems with auto-streaming. See file system . readWithSizeRead a file with auto-streaming by size threshold. See file system . writeWithValueWrite a value with auto-streaming by input type. See file system .
setNeedMigration setNeedMigration adds migration confirmation behavior to an Obsidian ToggleComponent. It is useful for settings whose existing value changes the remote file layout or representation.
ts import { setNeedMigration } from '@hesprs/sync-engine-sdk' ;
setNeedMigration (ctx, {
toggle,
needMigration : ( value ) => recordStoreExists (),
content : ( value ) => (value ? 'Encryption will be enabled.' : 'Encryption will be disabled.' ),
apply : async ( value ) => {
settings.enabled = value;
await ctx. saveSettings ();
},
}); When needMigration returns false or is omitted, apply runs immediately. When it returns true, the toggle is reverted until the user either starts migration or chooses to toggle without migration. The helper is the public API; its internal migration modal is not exported.
/dev runtime exports Root type exports Group Exports Context Context, Settings, Events, Translations, SelectFromContextEvents Dispatch, OnCore data Binary, MaybePromise, Progress, FileStat, FolderStat, Stat, StatsMap, RecordStat, RecordStatsMapFilesystem RootFs, WrappedFs, Fs, WriteAtom, DeleteAtom, MoveAtom, MkdirAtom, InputAtom, CustomAtom, OutputAtom, OptimizerInput, OptimizerOutput, BatchOptimizerRegistration FsWrapperEntry, RemoteFsEntry, RemoteRequestMiddlewareEntry, LocalRequestMiddlewareEntry, RemoteLister, RemoteListerEntry, DeciderEntry, OptimizerEntry, SettingEntry, ConflictResolverEntry, Request, CheckConnectionResultSync TaskNames, BaseTask, AddRecord, RemoveRecord, Download, Upload, CreateLocalDir, CreateRemoteDir, RemoveLocal, RemoveRemote, MoveLocal, MoveRemote, ResolveConflict, TaskFactory, DeciderInput, Decider, ConflictResolver, ConflictResolverPayload, SyncTerminateReasonStorage RecordStore, StoreAsync, StoreSync, DatabaseAsync, DatabaseSyncModules ModuleMeta, AugmentedModuleMetaRequest VaultRequest, RequestParam, RequestResponse (the response type returned by Request)Internationalization ObsidianLanguageCode, Fragment, TranslationResource, TranslateOther ExistingMemoryDB
Internal supporting types can appear in exported signatures but are not standalone root exports. They include TogglableValue, GlobMatchRule, Infras, BaseTaskOptions, TaskOptions, TaskOptionsMap, TaskInfo, FailedTaskInfo, DeleteConfirmReturn, CustomHeaders, and InterpolationValues.
Settings Settings is a merged object at ctx.settings. For descriptions of each setting, see usage: settings .
Key Type moduleSourcesArray<string> of registry URLsmodulesRecord<string, object> of per-module settingsmoduleAutoUpdatebooleanremoteFsstring selected backend IDdeciderstring selected decider IDconflictResolverstring selected conflict-resolver IDmaxFileSizeTogglableValue max file size in bytesconfirmTasksInSyncbooleanconfirmDeleteInAutoSyncbooleannoticeStatusOnMobilebooleanstartupSyncTogglableValue delay in millisecondsscheduledSyncTogglableValue interval in millisecondsrealtimeSyncTogglableValue debounce delay in millisecondsinclusionRulesArray<GlobMatchRule>exclusionRulesArray<GlobMatchRule>maxMemoryConsumptionTogglableValue in bytesmaxRequestConcurrencyTogglableValueminRequestIntervalTogglableValue in millisecondsrealtimeSyncFastModebooleanasymmetricStoragebooleancustomHeadersArray<{ type: 'plaintext' | 'secret'; value: string; key: string }>
TogglableValue has shape { enabled: boolean; value: number }.
Other Context Members These Context members are not commonly used by modules. Explore source code to obtain usage patterns.
Module Management Member Purpose discoveredModulesMap from discovered module ID to AugmentedModuleMeta.loadedModulesMap from loaded module ID to module constructor.fetchSources(manual?)Fetches module metadata from sources. manual: true forces refetch; false uses in-memory cache. loadAllModules()Loads all enabled installed modules. loadModule(meta, start?)Loads named module; optional second argument starts it. unloadModule(id)Unloads named module. updateModules()Finds and downloads available module updates. downloadModule(meta)Downloads one module from URL. deleteModule(id)Deletes named installed module. enableModule(id)Enables and loads a module. disableModule(id)Unloads and disables a module. updateModuleMeta(meta)Updates stored module metadata. addSettingTab(plugin)Adds Sync Engine setting tab to supplied Obsidian plugin. openModuleManagement()Opens module-management UI. closeModuleManagement()Closes module-management UI.
Filesystem and Sync Member Purpose createLocalFs()Creates wrapped local filesystem. createRemoteFs(id?)Creates selected wrapped remote filesystem. getRequest()Gets composed remote request function. getVaultRequest()Gets composed local vault request function. getNamespace(local?, remote?)Creates storage namespace for optional local/remote FS pair. initializeSync()Creates local FS, remote FS, and record store for sync. getCheckConnection()Gets selected backend connection-check function. getDecider()Gets selected Decider. getConflictResolver()Gets selected ConflictResolver. optimizeLocal(input)Applies selected local BatchOptimizer. optimizeRemote(input)Applies selected remote BatchOptimizer. listRemote(info)Lists remote entries for a sync trigger. executeSync(tasks)Executes synchronization immediately. requestSync(trigger)Queues sync; resolves with SyncTerminateReason. remoteFsRegistryMap<string, RemoteFsEntry>.deciderRegistryMap<string, DeciderEntry>.conflictResolverRegistryMap<string, ConflictResolverEntry>.
UI and Observability Member Purpose executionProgressReactive Progress for task execution. walkProgressReactive Progress for remote traversal. syncStageReactive current sync stage. showProgress()Opens progress UI. hideProgress()Hides progress UI. getLogs()Returns formatted current logs. exportLogs()Exports logs to vault file. startScheduledSync()Starts interval sync. stopScheduledSync()Stops interval sync.
Core and Host Member Purpose settingsMerged Settings object. eventsMerged Events map. i18nMerged Translations resource map. appObsidian App instance. addCommand(cmd)Registers Obsidian command and returns it. registerEvent(ref)Registers Obsidian EventRef for automatic cleanup. addRibbonIcon(...)Adds ribbon icon and returns element. addStatusBarItem()Adds and returns status-bar element. saveSettings()Persists current settings. on(key, cb)Subscribes to typed SDK event. See events . dispatch(key, payload?)Dispatches typed SDK event. See events . isIdleSynthKernel Ref<boolean> for sync-idle state. translateTranslates a key from merged resources. See i18n . rerenderSettingTab()Renders contributed settings again.
Framework Members SynthKernel internal members. Module code normally should not call them.
Member Purpose __modules__Internal module-instance WeakMap. __getModule__Gets internal module instance. __addModule__Adds module constructor to context. __assign__Extends context with merged values.