openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
45 lines (44 loc) • 1.25 kB
JavaScript
import { l as isRecord } from "./record-coerce-CVPuDqcc.mjs";
import "./utils-C8YECn2Q.mjs";
import { isDeepStrictEqual } from "node:util";
//#region src/config/config-change-paths.ts
function collectConfigWriteChangedPaths(e, t, n) {
const r = /* @__PURE__ */ new Set();
collectChangedPaths(e, t, "", r);
for (const e of n) {
const t = e.filter((e) => e.length > 0).join(".");
if (t) r.add(t);
}
return r;
}
function collectChangedPaths(e, t, n, r) {
if (Object.is(e, t)) return;
if (Array.isArray(e) && Array.isArray(t)) {
const i = Math.max(e.length, t.length);
for (let a = 0; a < i; a += 1) {
const i = n ? `${n}[${a}]` : `[${a}]`;
if (a >= e.length || a >= t.length) {
r.add(i);
continue;
}
collectChangedPaths(e[a], t[a], i, r);
}
return;
}
if (isRecord(e) && isRecord(t)) {
const i = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
for (const a of i) {
const i = n ? `${n}.${a}` : a;
const o = Object.hasOwn(e, a);
if (!Object.hasOwn(t, a) || !o) {
r.add(i);
continue;
}
collectChangedPaths(e[a], t[a], i, r);
}
return;
}
if (!isDeepStrictEqual(e, t)) r.add(n);
}
//#endregion
export { collectConfigWriteChangedPaths as n, collectChangedPaths as t };