initial commit after split

This commit is contained in:
2026-06-24 01:43:10 +02:00
parent b1d6c0150f
commit 30c11a6dcf
173 changed files with 25380 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
export function adminErrorMessage(error: unknown): string {
if (!(error instanceof Error)) return "The administrative operation failed.";
const message = error.message;
const jsonStart = message.indexOf("{");
if (jsonStart >= 0) {
try {
const parsed = JSON.parse(message.slice(jsonStart)) as { detail?: unknown };
if (typeof parsed.detail === "string") return parsed.detail;
if (Array.isArray(parsed.detail)) {
return parsed.detail.map((item) => typeof item === "object" && item && "msg" in item ? String((item as { msg: unknown }).msg) : String(item)).join("; ");
}
} catch {
// Fall through to the original message.
}
}
return message;
}
export function formatDateTime(value?: string | null): string {
if (!value) return "Never";
const date = new Date(value);
return Number.isNaN(date.getTime()) ? value : date.toLocaleString();
}
export function joinLabels(values: Array<{ name: string }>): string {
return values.length ? values.map((value) => value.name).join(", ") : "—";
}