Phase 1 reliability/stabilisation: auth logging, logout client, loader+xml hardening

This commit is contained in:
2026-05-13 10:05:49 +01:00
parent d36a56c4c9
commit 8fe06c09c4
9 changed files with 125 additions and 49 deletions
+10 -1
View File
@@ -2,6 +2,8 @@
import fs from "fs";
import path from "path";
const xmlCache = new Map();
/**
* Reads /data/formsxml/{appealtypes}.xml and normalises it.
* Returns { xmlStr } or throws on missing file.
@@ -9,6 +11,10 @@ import path from "path";
export function readFormXml(appealtypes) {
if (!appealtypes) throw new Error("readFormXml: appealtypes is required");
if (xmlCache.has(appealtypes)) {
return xmlCache.get(appealtypes);
}
const configDirectory = path.resolve(process.cwd(), "data/formsxml");
const filePath = path.join(configDirectory, `${appealtypes}.xml`);
@@ -20,5 +26,8 @@ export function readFormXml(appealtypes) {
xmlStr = xmlStr.replace(/> <"/g, "><");
xmlStr = xmlStr.toString();
return { xmlStr, filePath };
const result = { xmlStr, filePath };
xmlCache.set(appealtypes, result);
return result;
}