MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / rememberLocalVault

Function rememberLocalVault

apps/desktop/src/main/vault.ts:435–452  ·  view source on GitHub ↗
(
  entries: PersistedLocalVault[],
  vault: VaultInfo,
  openedAt = Date.now()
)

Source from the content-addressed store, hash-verified

433}
434
435export function rememberLocalVault(
436 entries: PersistedLocalVault[],
437 vault: VaultInfo,
438 openedAt = Date.now()
439): PersistedLocalVault[] {
440 const root = path.resolve(vault.root)
441 const next: PersistedLocalVault = {
442 root,
443 name: vault.name || path.basename(root),
444 lastOpenedAt: openedAt
445 }
446 return [
447 next,
448 ...entries
449 .filter((entry) => path.resolve(entry.root) !== root)
450 .sort((a, b) => b.lastOpenedAt - a.lastOpenedAt || a.name.localeCompare(b.name))
451 ].slice(0, 20)
452}
453
454export function forgetLocalVault(
455 entries: PersistedLocalVault[],

Callers 4

vault.test.tsFile · 0.90
setVaultForWindowFunction · 0.90
setVaultFunction · 0.90
listLocalVaultsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected