mindnet_obsidian/src/interview/InterviewConfigLoader.ts

21 lines
610 B
TypeScript
Raw Normal View History

import type { App } from "obsidian";
import { VocabularyLoader } from "../vocab/VocabularyLoader";
import { parseInterviewConfig, validateConfig } from "./parseInterviewConfig";
import type { InterviewConfig } from "./types";
/**
* Loader for interview config YAML files.
*/
export class InterviewConfigLoader {
/**
* Load and parse interview config from vault.
*/
static async loadConfig(
app: App,
path: string
): Promise<{ config: InterviewConfig; errors: string[] }> {
const yamlText = await VocabularyLoader.loadText(app, path);
return parseInterviewConfig(yamlText);
}
}