(value: unknown)
| 1708 | } |
| 1709 | |
| 1710 | function normalizeCachedNoteMeta(value: unknown): NoteMeta | null { |
| 1711 | if (!value || typeof value !== 'object') return null |
| 1712 | const candidate = value as Partial<NoteMeta> |
| 1713 | if ( |
| 1714 | typeof candidate.path !== 'string' || |
| 1715 | typeof candidate.title !== 'string' || |
| 1716 | !SYSTEM_FOLDERS.has(candidate.folder as NoteFolder) || |
| 1717 | typeof candidate.siblingOrder !== 'number' || |
| 1718 | typeof candidate.createdAt !== 'number' || |
| 1719 | typeof candidate.updatedAt !== 'number' || |
| 1720 | typeof candidate.size !== 'number' || |
| 1721 | !Array.isArray(candidate.tags) || |
| 1722 | !candidate.tags.every((tag) => typeof tag === 'string') || |
| 1723 | !Array.isArray(candidate.wikilinks) || |
| 1724 | !candidate.wikilinks.every((wikilink) => typeof wikilink === 'string') || |
| 1725 | !Array.isArray(candidate.assetEmbeds) || |
| 1726 | !candidate.assetEmbeds.every((embed) => typeof embed === 'string') || |
| 1727 | typeof candidate.hasAttachments !== 'boolean' || |
| 1728 | typeof candidate.excerpt !== 'string' |
| 1729 | ) { |
| 1730 | return null |
| 1731 | } |
| 1732 | return { |
| 1733 | path: candidate.path, |
| 1734 | title: candidate.title, |
| 1735 | folder: candidate.folder as NoteFolder, |
| 1736 | siblingOrder: candidate.siblingOrder, |
| 1737 | createdAt: candidate.createdAt, |
| 1738 | updatedAt: candidate.updatedAt, |
| 1739 | size: candidate.size, |
| 1740 | tags: candidate.tags, |
| 1741 | wikilinks: candidate.wikilinks, |
| 1742 | assetEmbeds: candidate.assetEmbeds, |
| 1743 | hasAttachments: candidate.hasAttachments, |
| 1744 | excerpt: candidate.excerpt |
| 1745 | } |
| 1746 | } |
| 1747 | |
| 1748 | async function hydratePersistedNoteMetaCache(root: string): Promise<void> { |
| 1749 | const rootAbs = path.resolve(root) |
no outgoing calls
no test coverage detected