more refactor

This commit is contained in:
2025-07-23 09:54:11 -06:00
parent 3e371247d6
commit 1885431574
69 changed files with 158 additions and 142 deletions

View File

@@ -0,0 +1,16 @@
import { GlobalSettings, zodGlobalSettings } from "./globalSettingsModels";
import { parse, stringify } from "yaml";
export const globalSettingsToYaml = (settings: GlobalSettings) => {
return stringify(settings);
};
export const parseGlobalSettingsYaml = (yaml: string): GlobalSettings => {
const parsed = parse(yaml);
try {
return zodGlobalSettings.parse(parsed);
} catch (e) {
console.error("Error parsing global settings YAML:", e);
throw new Error(`Error parsing global settings, got ${yaml}, ${e}`);
}
};