Refactor: trim duplicate gateway/onboarding helpers and dead utils (#43871)

* Gateway: share input provenance schema

* Onboarding: dedupe top-level channel patching

* Utils: remove unused path helpers

* Protocol: refresh generated gateway models
This commit is contained in:
Vincent Koc
2026-03-12 05:04:31 -04:00
committed by GitHub
parent cb7b38105f
commit 7c889e7113
8 changed files with 55 additions and 105 deletions

View File

@@ -8,7 +8,6 @@ import {
ensureDir,
jidToE164,
normalizeE164,
normalizePath,
resolveConfigDir,
resolveHomeDir,
resolveJidToE164,
@@ -17,7 +16,6 @@ import {
shortenHomePath,
sleep,
toWhatsappJid,
withWhatsAppPrefix,
} from "./utils.js";
function withTempDirSync<T>(prefix: string, run: (dir: string) => T): T {
@@ -29,26 +27,6 @@ function withTempDirSync<T>(prefix: string, run: (dir: string) => T): T {
}
}
describe("normalizePath", () => {
it("adds leading slash when missing", () => {
expect(normalizePath("foo")).toBe("/foo");
});
it("keeps existing slash", () => {
expect(normalizePath("/bar")).toBe("/bar");
});
});
describe("withWhatsAppPrefix", () => {
it("adds whatsapp prefix", () => {
expect(withWhatsAppPrefix("+1555")).toBe("whatsapp:+1555");
});
it("leaves prefixed intact", () => {
expect(withWhatsAppPrefix("whatsapp:+1555")).toBe("whatsapp:+1555");
});
});
describe("ensureDir", () => {
it("creates nested directory", async () => {
await withTempDirSync("openclaw-test-", async (tmp) => {