mirror of https://github.com/openclaw/openclaw.git
fix(core): resolve post-rebase type errors
This commit is contained in:
parent
58cde87436
commit
f7c658efb9
|
|
@ -10,7 +10,9 @@ describe("runOpenAIOAuthTlsPreflight", () => {
|
|||
});
|
||||
|
||||
it("returns ok when OpenAI auth endpoint is reachable", async () => {
|
||||
const fetchImpl = vi.fn(async () => new Response("", { status: 400 }));
|
||||
const fetchImpl = vi.fn(
|
||||
async () => new Response("", { status: 400 }),
|
||||
) as unknown as typeof fetch;
|
||||
const result = await runOpenAIOAuthTlsPreflight({ fetchImpl, timeoutMs: 20 });
|
||||
expect(result).toEqual({ ok: true });
|
||||
});
|
||||
|
|
@ -22,7 +24,7 @@ describe("runOpenAIOAuthTlsPreflight", () => {
|
|||
};
|
||||
cause.code = "UNABLE_TO_GET_ISSUER_CERT_LOCALLY";
|
||||
throw new TypeError("fetch failed", { cause });
|
||||
});
|
||||
}) as unknown as typeof fetch;
|
||||
const result = await runOpenAIOAuthTlsPreflight({ fetchImpl: tlsFetchImpl, timeoutMs: 20 });
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
|
|
@ -38,7 +40,7 @@ describe("runOpenAIOAuthTlsPreflight", () => {
|
|||
"Client network socket disconnected before secure TLS connection was established",
|
||||
),
|
||||
});
|
||||
});
|
||||
}) as unknown as typeof fetch;
|
||||
const result = await runOpenAIOAuthTlsPreflight({
|
||||
fetchImpl: networkFetchImpl,
|
||||
timeoutMs: 20,
|
||||
|
|
|
|||
|
|
@ -870,7 +870,7 @@ async function dispatchDiscordComponentEvent(params: {
|
|||
allowFrom: channelConfig?.users ?? guildInfo?.users,
|
||||
normalizeEntry: (entry) => {
|
||||
const normalized = normalizeDiscordAllowList([entry], ["discord:", "user:", "pk:"]);
|
||||
const candidate = normalized?.[0];
|
||||
const candidate = normalized?.ids.values().next().value;
|
||||
return candidate && /^\d+$/.test(candidate) ? candidate : undefined;
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -365,6 +365,9 @@ async function readAllowFromStateForPathWithExists(
|
|||
if (cachedOrMissing) {
|
||||
return cachedOrMissing;
|
||||
}
|
||||
if (!stat) {
|
||||
return { entries: [], exists: false };
|
||||
}
|
||||
|
||||
const { value, exists } = await readJsonFile<AllowFromStore>(filePath, {
|
||||
version: 1,
|
||||
|
|
@ -402,6 +405,9 @@ function readAllowFromStateForPathSyncWithExists(
|
|||
if (cachedOrMissing) {
|
||||
return cachedOrMissing;
|
||||
}
|
||||
if (!stat) {
|
||||
return { entries: [], exists: false };
|
||||
}
|
||||
|
||||
let raw = "";
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue