@n8n/n8n-nodes-langchain
Version:

69 lines • 2.73 kB
JavaScript
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var httpProxyAgent_exports = {};
__export(httpProxyAgent_exports, {
getNodeProxyAgent: () => getNodeProxyAgent,
getProxyAgent: () => getProxyAgent,
proxyFetch: () => proxyFetch
});
module.exports = __toCommonJS(httpProxyAgent_exports);
var import_https_proxy_agent = require("https-proxy-agent");
var import_proxy_from_env = __toESM(require("proxy-from-env"));
var import_undici = require("undici");
function getProxyUrlFromEnv(targetUrl) {
return import_proxy_from_env.default.getProxyForUrl(targetUrl ?? "https://example.nonexistent/");
}
function getProxyAgent(targetUrl) {
const proxyUrl = getProxyUrlFromEnv(targetUrl);
if (!proxyUrl) {
return void 0;
}
return new import_undici.ProxyAgent(proxyUrl);
}
async function proxyFetch(input, init) {
return await fetch(input, {
...init,
// @ts-expect-error - dispatcher is an undici-specific option not in standard fetch
dispatcher: getProxyAgent(input.toString())
});
}
function getNodeProxyAgent(targetUrl) {
const proxyUrl = getProxyUrlFromEnv(targetUrl);
if (!proxyUrl) {
return void 0;
}
return new import_https_proxy_agent.HttpsProxyAgent(proxyUrl);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getNodeProxyAgent,
getProxyAgent,
proxyFetch
});
//# sourceMappingURL=httpProxyAgent.js.map