@n8n/ai-utilities 0.33.0 → 0.33.1
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 +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/node-catalog/get.d.ts +1 -0
- package/dist/cjs/node-catalog/get.js +10 -0
- package/dist/cjs/node-catalog/get.js.map +1 -1
- package/dist/cjs/node-catalog/index.d.ts +1 -1
- package/dist/cjs/node-catalog/index.js +2 -1
- package/dist/cjs/node-catalog/index.js.map +1 -1
- package/dist/cjs/suppliers/supplyModel.js +1 -1
- package/dist/cjs/suppliers/supplyModel.js.map +1 -1
- package/dist/cjs/typecheck.tsbuildinfo +1 -1
- package/dist/cjs/utils/http-proxy-agent.d.ts +6 -5
- package/dist/cjs/utils/http-proxy-agent.js +28 -25
- package/dist/cjs/utils/http-proxy-agent.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node-catalog/get.d.ts +1 -0
- package/dist/esm/node-catalog/get.js +10 -0
- package/dist/esm/node-catalog/get.js.map +1 -1
- package/dist/esm/node-catalog/index.d.ts +1 -1
- package/dist/esm/node-catalog/index.js +2 -1
- package/dist/esm/node-catalog/index.js.map +1 -1
- package/dist/esm/suppliers/supplyModel.js +1 -1
- package/dist/esm/suppliers/supplyModel.js.map +1 -1
- package/dist/esm/typecheck.tsbuildinfo +1 -1
- package/dist/esm/utils/http-proxy-agent.d.ts +6 -5
- package/dist/esm/utils/http-proxy-agent.js +28 -25
- package/dist/esm/utils/http-proxy-agent.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import { type TransportSsrfPolicy } from '@n8n/backend-network/transport';
|
|
1
2
|
import type { AgentOptions } from 'node:https';
|
|
2
|
-
import type {
|
|
3
|
-
import { Agent, ProxyAgent } from 'undici';
|
|
3
|
+
import type { Dispatcher } from 'undici';
|
|
4
4
|
export interface AgentTimeoutOptions {
|
|
5
5
|
headersTimeout?: number;
|
|
6
6
|
bodyTimeout?: number;
|
|
7
7
|
connectTimeout?: number;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type EgressFilter = TransportSsrfPolicy;
|
|
10
|
+
export declare function getProxyAgent(targetUrl: string | undefined, timeoutOptions: AgentTimeoutOptions | undefined, egressFilter: EgressFilter): Dispatcher;
|
|
10
11
|
export interface ProxyFetchOptions {
|
|
11
12
|
input: RequestInfo | URL;
|
|
12
13
|
init?: RequestInit;
|
|
13
14
|
timeoutOptions?: AgentTimeoutOptions;
|
|
14
|
-
|
|
15
|
+
egressFilter: EgressFilter;
|
|
15
16
|
}
|
|
16
|
-
export declare function proxyFetch({ input, init, timeoutOptions,
|
|
17
|
+
export declare function proxyFetch({ input, init, timeoutOptions, egressFilter, }: ProxyFetchOptions): Promise<Response>;
|
|
17
18
|
export declare function getNodeProxyAgent(targetUrl?: string, agentOptions?: AgentOptions): import("https").Agent | undefined;
|
|
@@ -3,46 +3,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getProxyAgent = getProxyAgent;
|
|
4
4
|
exports.proxyFetch = proxyFetch;
|
|
5
5
|
exports.getNodeProxyAgent = getNodeProxyAgent;
|
|
6
|
+
const egress_1 = require("@n8n/backend-network/egress");
|
|
6
7
|
const proxy_1 = require("@n8n/backend-network/proxy");
|
|
7
|
-
const
|
|
8
|
-
const undici_1 = require("undici");
|
|
8
|
+
const transport_1 = require("@n8n/backend-network/transport");
|
|
9
9
|
const DEFAULT_TIMEOUT = parseInt(process.env.N8N_AI_TIMEOUT_MAX ?? '3600000', 10);
|
|
10
10
|
const PROXY_FALLBACK_TARGET = 'https://example.nonexistent/';
|
|
11
|
-
let
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
let sharedDispatcher;
|
|
12
|
+
function toSsrfOption(egressFilter) {
|
|
13
|
+
if (egressFilter === egress_1.passthroughEgressFilter) {
|
|
14
|
+
return 'disabled';
|
|
15
|
+
}
|
|
16
|
+
return egressFilter;
|
|
17
|
+
}
|
|
18
|
+
function getProxyAgent(targetUrl, timeoutOptions, egressFilter) {
|
|
19
|
+
const proxyRequired = (0, proxy_1.isProxyRequired)(targetUrl, PROXY_FALLBACK_TARGET);
|
|
20
|
+
const ssrf = toSsrfOption(egressFilter);
|
|
21
|
+
const timeouts = {
|
|
15
22
|
headersTimeout: timeoutOptions?.headersTimeout ?? DEFAULT_TIMEOUT,
|
|
16
23
|
bodyTimeout: timeoutOptions?.bodyTimeout ?? DEFAULT_TIMEOUT,
|
|
17
24
|
...(timeoutOptions?.connectTimeout !== undefined && {
|
|
18
25
|
connectTimeout: timeoutOptions.connectTimeout,
|
|
19
26
|
}),
|
|
20
27
|
};
|
|
21
|
-
|
|
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;
|
|
28
|
+
const isDefaultCase = !proxyRequired && !timeoutOptions && !process.env.N8N_AI_TIMEOUT_MAX && ssrf === 'disabled';
|
|
25
29
|
if (isDefaultCase) {
|
|
26
|
-
|
|
27
|
-
return
|
|
30
|
+
sharedDispatcher ??= (0, transport_1.buildDispatcher)(false, 'disabled', { timeouts });
|
|
31
|
+
return sharedDispatcher;
|
|
28
32
|
}
|
|
29
|
-
return
|
|
33
|
+
return (0, transport_1.buildDispatcher)(proxyRequired ? 'env' : false, ssrf, { timeouts });
|
|
30
34
|
}
|
|
31
|
-
async function proxyFetch({ input, init, timeoutOptions,
|
|
35
|
+
async function proxyFetch({ input, init, timeoutOptions, egressFilter, }) {
|
|
32
36
|
const isRequest = typeof input !== 'string' && !(input instanceof URL);
|
|
33
37
|
const targetUrl = isRequest ? input.url : input.toString();
|
|
34
|
-
const dispatcher = getProxyAgent(targetUrl, timeoutOptions,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const dispatcher = getProxyAgent(targetUrl, timeoutOptions, egressFilter);
|
|
39
|
+
if (!isRequest)
|
|
40
|
+
return await (0, transport_1.dispatchedFetch)(dispatcher, input, init);
|
|
41
|
+
return await (0, transport_1.dispatchedFetch)(dispatcher, targetUrl, {
|
|
42
|
+
method: input.method,
|
|
43
|
+
headers: [...input.headers],
|
|
44
|
+
body: input.body === null ? undefined : await input.arrayBuffer(),
|
|
45
|
+
signal: input.signal,
|
|
46
|
+
redirect: input.redirect,
|
|
43
47
|
...init,
|
|
44
|
-
|
|
45
|
-
}));
|
|
48
|
+
});
|
|
46
49
|
}
|
|
47
50
|
function getNodeProxyAgent(targetUrl, agentOptions) {
|
|
48
51
|
const proxyUrl = (0, proxy_1.resolveProxyUrl)(targetUrl, PROXY_FALLBACK_TARGET);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-proxy-agent.js","sourceRoot":"","sources":["../../../src/utils/http-proxy-agent.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"http-proxy-agent.js","sourceRoot":"","sources":["../../../src/utils/http-proxy-agent.ts"],"names":[],"mappings":";;;;;AAgBA,wDAAsE;AACtE,sDAIoC;AACpC,8DAIwC;AAmBxC,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,SAAS,EAAE,EAAE,CAAC,CAAC;AAOlF,MAAM,qBAAqB,GAAG,8BAA8B,CAAC;AAO7D,IAAI,gBAAwC,CAAC;AAO7C,SAAS,YAAY,CAAC,YAA0B;IAC/C,IAAI,YAAY,KAAK,gCAAuB,EAAE,CAAC;QAC9C,OAAO,UAAU,CAAC;IACnB,CAAC;IACD,OAAO,YAAY,CAAC;AACrB,CAAC;AAoBD,uBACC,SAA6B,EAC7B,cAA+C,EAC/C,YA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Ae,EAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAEtE,OAAO,MAAM,IAAA,2BAAe,EAAC,UAAU,EAAE,SAAS,EAAE;QACnD,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;QAC3B,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,WAAW,EAAE;QACjE,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,GAAG,IAAI;KACP,CAAC,CAAC;AACJ,CAAC;AAUD,2BAAkC,SAAkB,EAAE,YAA2B;IAChF,MAAM,QAAQ,GAAG,IAAA,uBAAe,EAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAEnE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,IAAA,6BAAqB,EAAC,SAAS,IAAI,qBAAqB,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC1F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/ai-utilities",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.1",
|
|
4
4
|
"description": "Utilities for building AI nodes in n8n",
|
|
5
5
|
"types": "dist/esm/index.d.ts",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -135,11 +135,11 @@
|
|
|
135
135
|
"@langchain/openai": "1.4.4",
|
|
136
136
|
"langchain": "1.2.30",
|
|
137
137
|
"lodash": "4.18.1",
|
|
138
|
-
"@n8n/api-types": "1.40.
|
|
139
|
-
"@n8n/backend-network": "1.14.
|
|
138
|
+
"@n8n/api-types": "1.40.1",
|
|
139
|
+
"@n8n/backend-network": "1.14.1",
|
|
140
140
|
"@n8n/typescript-config": "1.12.0",
|
|
141
141
|
"@n8n/utils": "1.48.0",
|
|
142
|
-
"n8n-workflow": "2.40.
|
|
142
|
+
"n8n-workflow": "2.40.1",
|
|
143
143
|
"tmp-promise": "3.0.3",
|
|
144
144
|
"js-tiktoken": "1.0.21",
|
|
145
145
|
"@thednp/dommatrix": "^3.1.1",
|