openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
37 lines (36 loc) • 1.05 kB
JavaScript
import { l as isRecord } from "./record-coerce-CVPuDqcc.mjs";
import { t as resolveActiveManagedProxyTlsOptions } from "./active-managed-proxy-tls-NikAcZOT.mjs";
//#region src/infra/net/proxy/managed-proxy-undici.ts
function readProxyTlsRecord(e) {
if (!e || !("proxyTls" in e)) return;
return isRecord(e.proxyTls) ? e.proxyTls : void 0;
}
function readProxyUrlFromOptions(e) {
if (!e) return;
if ("uri" in e) {
const t = e.uri;
return t instanceof URL ? t.href : typeof t === "string" ? t : void 0;
}
if ("httpsProxy" in e || "httpProxy" in e) {
const t = Reflect.get(e, "httpsProxy");
const n = Reflect.get(e, "httpProxy");
return typeof t === "string" ? t : typeof n === "string" ? n : void 0;
}
}
function addActiveManagedProxyTlsOptions(e, t) {
const n = resolveActiveManagedProxyTlsOptions({
proxyUrl: readProxyUrlFromOptions(e),
env: t?.env
});
if (!n) return e;
const r = readProxyTlsRecord(e);
return {
...e,
proxyTls: {
...n,
...r
}
};
}
//#endregion
export { addActiveManagedProxyTlsOptions as t };