refactor: dedupe matrix store record helper

This commit is contained in:
Peter Steinberger
2026-04-07 00:13:40 +01:00
parent 10bc10b853
commit 539a8b1619

View File

@@ -11,6 +11,7 @@ import {
type IStoredClientOpts,
} from "matrix-js-sdk/lib/matrix.js";
import { writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
import { isRecord } from "../../record-shared.js";
import { createAsyncLock } from "../async-lock.js";
import { LogService } from "../sdk/logger.js";
import { claimCurrentTokenStorageState } from "./storage.js";
@@ -25,10 +26,6 @@ type PersistedMatrixSyncStore = {
cleanShutdown?: boolean;
};
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null;
}
function normalizeRoomsData(value: unknown): IRooms | null {
if (!isRecord(value)) {
return null;