openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
28 lines (27 loc) • 1.74 kB
JavaScript
//#region src/infra/database-engine/diagnostics-format.ts
/** The text view preserves unknowns and the same per-store facts exposed by JSON. */
function formatDatabaseStoreDiagnostic(e) {
const { configured: t, schema: n } = e;
const r = e.observed === "sqlite";
const i = [
`${e.family}${e.path ? ` (${e.path})` : ""}`,
`default=${t.default}, override=${t.fixedLocal ? "fixed local (local by design)" : t.override ?? "inherit"}, effective=${t.effective}`,
`observed=${e.observed}${e.mismatch === true ? " (mismatch)" : e.mismatch === null ? " (mismatch unknown)" : ""}`,
`schema=${n.versioning === "unversioned" ? "unversioned" : n.version ?? "unknown"}, expected=${n.versioning === "unversioned" ? "not applicable" : n.expectedVersion ?? "unknown"}, pending=${n.pending ?? "unknown"}`,
`connectivity=${e.connectivity}`,
`namespace=${e.namespace ?? (r ? "not applicable" : "unknown")}`,
`storeId=${e.storeId ?? (r ? "not applicable" : "unknown")}`,
`database=${e.database ?? (r ? "local file" : "unknown")}`,
`extensions=${e.extensions === null ? "unknown" : e.extensions.join(", ") || "none"}`,
`admittedExtensions=${e.admittedExtensions === null ? "unknown" : e.admittedExtensions.join(", ") || "none"}`,
`degraded=${e.degraded === null ? "unknown" : e.degraded.join(", ") || "none"}`,
`custody=${e.custody}, lease=${e.lease}`,
`backup=${e.backup?.status ?? "unknown"}`,
`legacy=${e.legacyMigrations.state}${e.legacyMigrations.pending.length ? ` (${e.legacyMigrations.pending.join(", ")})` : ""}`
];
if (e.issues.length) i.push(e.issues.join(" "));
if (e.nextSteps.length) i.push(`Next: ${e.nextSteps.join(" ")}`);
return i.join("; ");
}
//#endregion
export { formatDatabaseStoreDiagnostic as t };