refactor: waypoint-utils to use IVaultAdapter

- Change WaypointUtils.isFolderNote() signature to accept IVaultAdapter
  instead of App
- Update method body to use vault.read() instead of app.vault.read()
- Callers will be updated in next commit
This commit is contained in:
2025-10-20 07:52:39 -04:00
parent 26b8c2bd77
commit fdf1b4c69b

View File

@@ -1,4 +1,5 @@
import { App, TFile } from 'obsidian';
import { TFile } from 'obsidian';
import { IVaultAdapter } from '../adapters/interfaces';
/**
* Waypoint block information
@@ -87,7 +88,7 @@ export class WaypointUtils {
* 1. Has the same basename as its parent folder, OR
* 2. Contains waypoint markers
*/
static async isFolderNote(app: App, file: TFile): Promise<FolderNoteInfo> {
static async isFolderNote(vault: IVaultAdapter, file: TFile): Promise<FolderNoteInfo> {
const basename = file.basename;
const parentFolder = file.parent;
@@ -97,7 +98,7 @@ export class WaypointUtils {
// Check for waypoint markers
let hasWaypoint = false;
try {
const content = await app.vault.read(file);
const content = await vault.read(file);
hasWaypoint = this.hasWaypointMarker(content);
} catch (error) {
// If we can't read the file, we can't check for waypoints