@n8n/ai-utilities 0.30.1 → 0.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/typecheck.tsbuildinfo +1 -1
- package/dist/cjs/utils/http-proxy-agent.d.ts +8 -2
- package/dist/cjs/utils/http-proxy-agent.js +12 -14
- package/dist/cjs/utils/http-proxy-agent.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/typecheck.tsbuildinfo +1 -1
- package/dist/esm/utils/http-proxy-agent.d.ts +8 -2
- package/dist/esm/utils/http-proxy-agent.js +12 -14
- package/dist/esm/utils/http-proxy-agent.js.map +1 -1
- package/package.json +6 -6
|
@@ -6,6 +6,12 @@ export interface AgentTimeoutOptions {
|
|
|
6
6
|
bodyTimeout?: number;
|
|
7
7
|
connectTimeout?: number;
|
|
8
8
|
}
|
|
9
|
-
export declare function getProxyAgent(targetUrl?: string, timeoutOptions?: AgentTimeoutOptions, lookup?: LookupFunction): Agent | ProxyAgent
|
|
10
|
-
export
|
|
9
|
+
export declare function getProxyAgent(targetUrl?: string, timeoutOptions?: AgentTimeoutOptions, lookup?: LookupFunction): Agent | ProxyAgent;
|
|
10
|
+
export interface ProxyFetchOptions {
|
|
11
|
+
input: RequestInfo | URL;
|
|
12
|
+
init?: RequestInit;
|
|
13
|
+
timeoutOptions?: AgentTimeoutOptions;
|
|
14
|
+
lookup: LookupFunction;
|
|
15
|
+
}
|
|
16
|
+
export declare function proxyFetch({ input, init, timeoutOptions, lookup, }: ProxyFetchOptions): Promise<Response>;
|
|
11
17
|
export declare function getNodeProxyAgent(targetUrl?: string, agentOptions?: AgentOptions): import("https").Agent | undefined;
|
|
@@ -4,10 +4,12 @@ exports.getProxyAgent = getProxyAgent;
|
|
|
4
4
|
exports.proxyFetch = proxyFetch;
|
|
5
5
|
exports.getNodeProxyAgent = getNodeProxyAgent;
|
|
6
6
|
const proxy_1 = require("@n8n/backend-network/proxy");
|
|
7
|
+
const node_dns_1 = require("node:dns");
|
|
7
8
|
const undici_1 = require("undici");
|
|
8
9
|
const DEFAULT_TIMEOUT = parseInt(process.env.N8N_AI_TIMEOUT_MAX ?? '3600000', 10);
|
|
9
10
|
const PROXY_FALLBACK_TARGET = 'https://example.nonexistent/';
|
|
10
|
-
|
|
11
|
+
let sharedAgent;
|
|
12
|
+
function getProxyAgent(targetUrl, timeoutOptions, lookup = node_dns_1.lookup) {
|
|
11
13
|
const proxyUrl = (0, proxy_1.resolveProxyUrl)(targetUrl, PROXY_FALLBACK_TARGET);
|
|
12
14
|
const agentOptions = {
|
|
13
15
|
headersTimeout: timeoutOptions?.headersTimeout ?? DEFAULT_TIMEOUT,
|
|
@@ -16,21 +18,17 @@ function getProxyAgent(targetUrl, timeoutOptions, lookup) {
|
|
|
16
18
|
connectTimeout: timeoutOptions.connectTimeout,
|
|
17
19
|
}),
|
|
18
20
|
};
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (process.env.N8N_AI_TIMEOUT_MAX) {
|
|
27
|
-
return new undici_1.Agent(agentOptions);
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
21
|
+
if (proxyUrl) {
|
|
22
|
+
return new undici_1.ProxyAgent({ uri: proxyUrl, ...agentOptions });
|
|
23
|
+
}
|
|
24
|
+
const isDefaultCase = !timeoutOptions && !process.env.N8N_AI_TIMEOUT_MAX && lookup === node_dns_1.lookup;
|
|
25
|
+
if (isDefaultCase) {
|
|
26
|
+
sharedAgent ??= new undici_1.Agent({ ...agentOptions, connect: { lookup } });
|
|
27
|
+
return sharedAgent;
|
|
30
28
|
}
|
|
31
|
-
return new undici_1.
|
|
29
|
+
return new undici_1.Agent({ ...agentOptions, connect: { lookup } });
|
|
32
30
|
}
|
|
33
|
-
async function proxyFetch(input, init, timeoutOptions, lookup) {
|
|
31
|
+
async function proxyFetch({ input, init, timeoutOptions, lookup, }) {
|
|
34
32
|
const targetUrl = input instanceof Request ? input.url : input.toString();
|
|
35
33
|
const dispatcher = getProxyAgent(targetUrl, timeoutOptions, lookup);
|
|
36
34
|
return (await (0, undici_1.fetch)(input, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-proxy-agent.js","sourceRoot":"","sources":["../../../src/utils/http-proxy-agent.ts"],"names":[],"mappings":";;;;;AAkBA,sDAAoF;
|
|
1
|
+
{"version":3,"file":"http-proxy-agent.js","sourceRoot":"","sources":["../../../src/utils/http-proxy-agent.ts"],"names":[],"mappings":";;;;;AAkBA,sDAAoF;AACpF,uCAAmD;AAInD,mCAAiE;AAejE,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,SAAS,EAAE,EAAE,CAAC,CAAC;AAMlF,MAAM,qBAAqB,GAAG,8BAA8B,CAAC;AAO7D,IAAI,WAA8B,CAAC;AAkBnC,uBACC,SAAkB,EAClB,cAAoC,EACpC,MAAM,GAAmB,iBAAa;IAEtC,MAAM,QAAQ,GAAG,IAAA,uBAAe,EAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAEnE,MAAM,YAAY,GAAG;QACpB,cAAc,EAAE,cAAc,EAAE,cAAc,IAAI,eAAe;QACjE,WAAW,EAAE,cAAc,EAAE,WAAW,IAAI,eAAe;QAC3D,GAAG,CAAC,cAAc,EAAE,cAAc,KAAK,SAAS,IAAI;YACnD,cAAc,EAAE,cAAc,CAAC,cAAc;SAC7C,CAAC;KACF,CAAC;IAEF,IAAI,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,mBAAU,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,YAAY,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,MAA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
|
"description": "Utilities for building AI nodes in n8n",
|
|
5
5
|
"types": "dist/esm/index.d.ts",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -133,12 +133,12 @@
|
|
|
133
133
|
"@thednp/dommatrix": "^3.1.1",
|
|
134
134
|
"pdf-parse": "2.4.5",
|
|
135
135
|
"undici": "^7.29.0",
|
|
136
|
-
"@n8n/backend-network": "1.11.
|
|
137
|
-
"@n8n/
|
|
138
|
-
"@n8n/config": "2.35.0",
|
|
139
|
-
"@n8n/utils": "1.45.0",
|
|
136
|
+
"@n8n/backend-network": "1.11.2",
|
|
137
|
+
"@n8n/config": "2.35.1",
|
|
140
138
|
"@n8n/typescript-config": "1.10.0",
|
|
141
|
-
"n8n
|
|
139
|
+
"@n8n/utils": "1.45.1",
|
|
140
|
+
"@n8n/api-types": "1.37.2",
|
|
141
|
+
"n8n-workflow": "2.37.2"
|
|
142
142
|
},
|
|
143
143
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
144
144
|
"homepage": "https://n8n.io",
|