@n8n/ai-workflow-builder 0.28.0 → 0.30.0
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/build.tsbuildinfo +1 -1
- package/dist/chains/prompt-categorization.d.ts +3 -0
- package/dist/chains/prompt-categorization.js +109 -0
- package/dist/chains/prompt-categorization.js.map +1 -0
- package/dist/chains/test/integration/test-helpers.d.ts +3 -0
- package/dist/chains/test/integration/test-helpers.js +16 -0
- package/dist/chains/test/integration/test-helpers.js.map +1 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/llm-config.js +13 -0
- package/dist/llm-config.js.map +1 -1
- package/dist/tools/add-node.tool.d.ts +29 -0
- package/dist/tools/add-node.tool.js +26 -8
- package/dist/tools/add-node.tool.js.map +1 -1
- package/dist/tools/best-practices/chatbot.d.ts +7 -0
- package/dist/tools/best-practices/chatbot.js +118 -0
- package/dist/tools/best-practices/chatbot.js.map +1 -0
- package/dist/tools/best-practices/content-generation.d.ts +7 -0
- package/dist/tools/best-practices/content-generation.js +79 -0
- package/dist/tools/best-practices/content-generation.js.map +1 -0
- package/dist/tools/best-practices/data-extraction.d.ts +7 -0
- package/dist/tools/best-practices/data-extraction.js +105 -0
- package/dist/tools/best-practices/data-extraction.js.map +1 -0
- package/dist/tools/best-practices/form-input.d.ts +7 -0
- package/dist/tools/best-practices/form-input.js +173 -0
- package/dist/tools/best-practices/form-input.js.map +1 -0
- package/dist/tools/best-practices/index.d.ts +3 -0
- package/dist/tools/best-practices/index.js +27 -0
- package/dist/tools/best-practices/index.js.map +1 -0
- package/dist/tools/best-practices/scraping-and-research.d.ts +7 -0
- package/dist/tools/best-practices/scraping-and-research.js +147 -0
- package/dist/tools/best-practices/scraping-and-research.js.map +1 -0
- package/dist/tools/builder-tools.js +6 -0
- package/dist/tools/builder-tools.js.map +1 -1
- package/dist/tools/categorize-prompt.tool.d.ts +5 -0
- package/dist/tools/categorize-prompt.tool.js +84 -0
- package/dist/tools/categorize-prompt.tool.js.map +1 -0
- package/dist/tools/engines/node-search-engine.d.ts +0 -9
- package/dist/tools/engines/node-search-engine.js +74 -73
- package/dist/tools/engines/node-search-engine.js.map +1 -1
- package/dist/tools/get-best-practices.tool.d.ts +33 -0
- package/dist/tools/get-best-practices.tool.js +94 -0
- package/dist/tools/get-best-practices.tool.js.map +1 -0
- package/dist/tools/helpers/validation.d.ts +1 -1
- package/dist/tools/helpers/validation.js +3 -2
- package/dist/tools/helpers/validation.js.map +1 -1
- package/dist/tools/node-details.tool.d.ts +4 -0
- package/dist/tools/node-details.tool.js +3 -2
- package/dist/tools/node-details.tool.js.map +1 -1
- package/dist/tools/prompts/main-agent.prompt.js +23 -5
- package/dist/tools/prompts/main-agent.prompt.js.map +1 -1
- package/dist/tools/update-node-parameters.tool.js +1 -1
- package/dist/tools/update-node-parameters.tool.js.map +1 -1
- package/dist/tools/utils/node-creation.utils.d.ts +2 -2
- package/dist/tools/utils/node-creation.utils.js +7 -3
- package/dist/tools/utils/node-creation.utils.js.map +1 -1
- package/dist/tools/validate-workflow.tool.js +0 -16
- package/dist/tools/validate-workflow.tool.js.map +1 -1
- package/dist/types/best-practices.d.ts +6 -0
- package/dist/types/best-practices.js +3 -0
- package/dist/types/best-practices.js.map +1 -0
- package/dist/types/categorization.d.ts +23 -0
- package/dist/types/categorization.js +38 -0
- package/dist/types/categorization.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/nodes.d.ts +1 -0
- package/dist/types/tools.d.ts +4 -0
- package/dist/utils/http-proxy-agent.d.ts +2 -0
- package/dist/utils/http-proxy-agent.js +16 -0
- package/dist/utils/http-proxy-agent.js.map +1 -0
- package/dist/utils/stream-processor.js +85 -58
- package/dist/utils/stream-processor.js.map +1 -1
- package/dist/validation/checks/agent-prompt.js +1 -1
- package/dist/validation/checks/agent-prompt.js.map +1 -1
- package/dist/validation/checks/connections.js +32 -1
- package/dist/validation/checks/connections.js.map +1 -1
- package/dist/workflow-builder-agent.js +30 -22
- package/dist/workflow-builder-agent.js.map +1 -1
- package/dist/workflow-state.d.ts +1 -1
- package/dist/workflow-state.js.map +1 -1
- package/package.json +10 -6
|
@@ -1,89 +1,103 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NodeSearchEngine = exports.SCORE_WEIGHTS = void 0;
|
|
4
|
+
const sublimeSearch_1 = require("@n8n/utils/dist/search/sublimeSearch");
|
|
4
5
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const NODE_SEARCH_KEYS = [
|
|
7
|
+
{ key: 'displayName', weight: 1.5 },
|
|
8
|
+
{ key: 'name', weight: 1.3 },
|
|
9
|
+
{ key: 'codex.alias', weight: 1.0 },
|
|
10
|
+
{ key: 'description', weight: 0.7 },
|
|
11
|
+
];
|
|
5
12
|
exports.SCORE_WEIGHTS = {
|
|
6
|
-
NAME_CONTAINS: 10,
|
|
7
|
-
DISPLAY_NAME_CONTAINS: 8,
|
|
8
|
-
DESCRIPTION_CONTAINS: 5,
|
|
9
|
-
ALIAS_CONTAINS: 8,
|
|
10
|
-
NAME_EXACT: 20,
|
|
11
|
-
DISPLAY_NAME_EXACT: 15,
|
|
12
13
|
CONNECTION_EXACT: 100,
|
|
13
14
|
CONNECTION_IN_EXPRESSION: 50,
|
|
14
15
|
};
|
|
16
|
+
function getLatestVersion(version) {
|
|
17
|
+
return Array.isArray(version) ? Math.max(...version) : version;
|
|
18
|
+
}
|
|
19
|
+
function dedupeNodes(nodes) {
|
|
20
|
+
const dedupeCache = {};
|
|
21
|
+
nodes.forEach((node) => {
|
|
22
|
+
const cachedNodeType = dedupeCache[node.name];
|
|
23
|
+
if (!cachedNodeType) {
|
|
24
|
+
dedupeCache[node.name] = node;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const cachedVersion = getLatestVersion(cachedNodeType.version);
|
|
28
|
+
const nextVersion = getLatestVersion(node.version);
|
|
29
|
+
if (nextVersion > cachedVersion) {
|
|
30
|
+
dedupeCache[node.name] = node;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return Object.values(dedupeCache);
|
|
34
|
+
}
|
|
15
35
|
class NodeSearchEngine {
|
|
16
36
|
nodeTypes;
|
|
17
37
|
constructor(nodeTypes) {
|
|
18
|
-
this.nodeTypes = nodeTypes;
|
|
38
|
+
this.nodeTypes = dedupeNodes(nodeTypes);
|
|
19
39
|
}
|
|
20
40
|
searchByName(query, limit = 20) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return this.sortAndLimit(results, limit);
|
|
41
|
+
const searchResults = (0, sublimeSearch_1.sublimeSearch)(query, this.nodeTypes, NODE_SEARCH_KEYS);
|
|
42
|
+
return searchResults.slice(0, limit).map(({ item, score }) => ({
|
|
43
|
+
name: item.name,
|
|
44
|
+
displayName: item.displayName,
|
|
45
|
+
description: item.description ?? 'No description available',
|
|
46
|
+
version: getLatestVersion(item.version),
|
|
47
|
+
inputs: item.inputs,
|
|
48
|
+
outputs: item.outputs,
|
|
49
|
+
score,
|
|
50
|
+
}));
|
|
34
51
|
}
|
|
35
52
|
searchByConnectionType(connectionType, limit = 20, nameFilter) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
const nodesWithConnectionType = this.nodeTypes
|
|
54
|
+
.map((nodeType) => {
|
|
55
|
+
const connectionScore = this.getConnectionScore(nodeType, connectionType);
|
|
56
|
+
return connectionScore > 0 ? { nodeType, connectionScore } : null;
|
|
57
|
+
})
|
|
58
|
+
.filter((result) => Boolean(result));
|
|
59
|
+
if (!nameFilter) {
|
|
60
|
+
return nodesWithConnectionType
|
|
61
|
+
.sort((a, b) => b.connectionScore - a.connectionScore)
|
|
62
|
+
.slice(0, limit)
|
|
63
|
+
.map(({ nodeType, connectionScore }) => ({
|
|
64
|
+
name: nodeType.name,
|
|
65
|
+
displayName: nodeType.displayName,
|
|
66
|
+
version: getLatestVersion(nodeType.version),
|
|
67
|
+
description: nodeType.description ?? 'No description available',
|
|
68
|
+
inputs: nodeType.inputs,
|
|
69
|
+
outputs: nodeType.outputs,
|
|
70
|
+
score: connectionScore,
|
|
71
|
+
}));
|
|
53
72
|
}
|
|
54
|
-
|
|
73
|
+
const nodeTypesOnly = nodesWithConnectionType.map((result) => result.nodeType);
|
|
74
|
+
const nameFilteredResults = (0, sublimeSearch_1.sublimeSearch)(nameFilter, nodeTypesOnly, NODE_SEARCH_KEYS);
|
|
75
|
+
return nameFilteredResults
|
|
76
|
+
.slice(0, limit)
|
|
77
|
+
.map(({ item, score: nameScore }) => {
|
|
78
|
+
const connectionResult = nodesWithConnectionType.find((result) => result.nodeType.name === item.name);
|
|
79
|
+
const connectionScore = connectionResult?.connectionScore ?? 0;
|
|
80
|
+
return {
|
|
81
|
+
name: item.name,
|
|
82
|
+
version: getLatestVersion(item.version),
|
|
83
|
+
displayName: item.displayName,
|
|
84
|
+
description: item.description ?? 'No description available',
|
|
85
|
+
inputs: item.inputs,
|
|
86
|
+
outputs: item.outputs,
|
|
87
|
+
score: connectionScore + nameScore,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
55
90
|
}
|
|
56
91
|
formatResult(result) {
|
|
57
92
|
return `
|
|
58
93
|
<node>
|
|
59
94
|
<node_name>${result.name}</node_name>
|
|
95
|
+
<node_version>${result.version}</node_version>
|
|
60
96
|
<node_description>${result.description}</node_description>
|
|
61
97
|
<node_inputs>${typeof result.inputs === 'object' ? JSON.stringify(result.inputs) : result.inputs}</node_inputs>
|
|
62
98
|
<node_outputs>${typeof result.outputs === 'object' ? JSON.stringify(result.outputs) : result.outputs}</node_outputs>
|
|
63
99
|
</node>`;
|
|
64
100
|
}
|
|
65
|
-
calculateNameScore(nodeType, normalizedQuery) {
|
|
66
|
-
let score = 0;
|
|
67
|
-
if (nodeType.name.toLowerCase().includes(normalizedQuery)) {
|
|
68
|
-
score += exports.SCORE_WEIGHTS.NAME_CONTAINS;
|
|
69
|
-
}
|
|
70
|
-
if (nodeType.displayName.toLowerCase().includes(normalizedQuery)) {
|
|
71
|
-
score += exports.SCORE_WEIGHTS.DISPLAY_NAME_CONTAINS;
|
|
72
|
-
}
|
|
73
|
-
if (nodeType.description?.toLowerCase().includes(normalizedQuery)) {
|
|
74
|
-
score += exports.SCORE_WEIGHTS.DESCRIPTION_CONTAINS;
|
|
75
|
-
}
|
|
76
|
-
if (nodeType.codex?.alias?.some((alias) => alias.toLowerCase().includes(normalizedQuery))) {
|
|
77
|
-
score += exports.SCORE_WEIGHTS.ALIAS_CONTAINS;
|
|
78
|
-
}
|
|
79
|
-
if (nodeType.name.toLowerCase() === normalizedQuery) {
|
|
80
|
-
score += exports.SCORE_WEIGHTS.NAME_EXACT;
|
|
81
|
-
}
|
|
82
|
-
if (nodeType.displayName.toLowerCase() === normalizedQuery) {
|
|
83
|
-
score += exports.SCORE_WEIGHTS.DISPLAY_NAME_EXACT;
|
|
84
|
-
}
|
|
85
|
-
return score;
|
|
86
|
-
}
|
|
87
101
|
getConnectionScore(nodeType, connectionType) {
|
|
88
102
|
const outputs = nodeType.outputs;
|
|
89
103
|
if (Array.isArray(outputs)) {
|
|
@@ -98,19 +112,6 @@ class NodeSearchEngine {
|
|
|
98
112
|
}
|
|
99
113
|
return 0;
|
|
100
114
|
}
|
|
101
|
-
createSearchResult(nodeType, score) {
|
|
102
|
-
return {
|
|
103
|
-
name: nodeType.name,
|
|
104
|
-
displayName: nodeType.displayName,
|
|
105
|
-
description: nodeType.description ?? 'No description available',
|
|
106
|
-
inputs: nodeType.inputs,
|
|
107
|
-
outputs: nodeType.outputs,
|
|
108
|
-
score,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
sortAndLimit(results, limit) {
|
|
112
|
-
return results.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
113
|
-
}
|
|
114
115
|
static isAiConnectionType(connectionType) {
|
|
115
116
|
return connectionType.startsWith('ai_');
|
|
116
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-search-engine.js","sourceRoot":"","sources":["../../../src/tools/engines/node-search-engine.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"node-search-engine.js","sourceRoot":"","sources":["../../../src/tools/engines/node-search-engine.ts"],"names":[],"mappings":";;;AAAA,wEAAqE;AAErE,+CAAmD;AAQnD,MAAM,gBAAgB,GAAG;IACxB,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;IACnC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE;IAC5B,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;IACnC,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;CACnC,CAAC;AAKW,QAAA,aAAa,GAAG;IAC5B,gBAAgB,EAAE,GAAG;IACrB,wBAAwB,EAAE,EAAE;CACnB,CAAC;AAEX,SAAS,gBAAgB,CAAC,OAA0B;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAChE,CAAC;AAED,SAAS,WAAW,CAAC,KAA6B;IACjD,MAAM,WAAW,GAAyC,EAAE,CAAC;IAC7D,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACtB,MAAM,cAAc,GAAG,WAAW,CAAC,I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AC;QAEjC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAE5B,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtC,OAAO,qBAAa,CAAC,gBAAgB,CAAC;YACvC,CAAC;QACF,CAAC;aAAM,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAExC,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtC,OAAO,qBAAa,CAAC,wBAAwB,CAAC;YAC/C,CAAC;QACF,CAAC;QAED,OAAO,CAAC,CAAC;IACV,CAAC;IAOD,MAAM,CAAC,kBAAkB,CAAC,cAAsB;QAC/C,OAAO,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAMD,MAAM,CAAC,oBAAoB;QAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,kCAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CACzD,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CACjB,CAAC;IAC3B,CAAC;CACD;AAhKD,4CAgKC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { BuilderToolBase } from '../utils/stream-processor';
|
|
3
|
+
export declare const GET_BEST_PRACTICES_TOOL: BuilderToolBase;
|
|
4
|
+
export declare function createGetBestPracticesTool(): {
|
|
5
|
+
toolName: string;
|
|
6
|
+
displayTitle: string;
|
|
7
|
+
getCustomDisplayTitle?: (values: Record<string, unknown>) => string;
|
|
8
|
+
tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
9
|
+
techniques: z.ZodArray<z.ZodNativeEnum<{
|
|
10
|
+
readonly SCHEDULING: "scheduling";
|
|
11
|
+
readonly CHATBOT: "chatbot";
|
|
12
|
+
readonly FORM_INPUT: "form_input";
|
|
13
|
+
readonly SCRAPING_AND_RESEARCH: "scraping_and_research";
|
|
14
|
+
readonly MONITORING: "monitoring";
|
|
15
|
+
readonly ENRICHMENT: "enrichment";
|
|
16
|
+
readonly TRIAGE: "triage";
|
|
17
|
+
readonly CONTENT_GENERATION: "content_generation";
|
|
18
|
+
readonly DOCUMENT_PROCESSING: "document_processing";
|
|
19
|
+
readonly DATA_EXTRACTION: "data_extraction";
|
|
20
|
+
readonly DATA_ANALYSIS: "data_analysis";
|
|
21
|
+
readonly DATA_TRANSFORMATION: "data_transformation";
|
|
22
|
+
readonly NOTIFICATION: "notification";
|
|
23
|
+
readonly KNOWLEDGE_BASE: "knowledge_base";
|
|
24
|
+
readonly HUMAN_IN_THE_LOOP: "human_in_the_loop";
|
|
25
|
+
}>, "many">;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
28
|
+
}, {
|
|
29
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
30
|
+
}>, unknown, {
|
|
31
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
32
|
+
}, import("@langchain/langgraph").Command<unknown>>;
|
|
33
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_BEST_PRACTICES_TOOL = void 0;
|
|
4
|
+
exports.createGetBestPracticesTool = createGetBestPracticesTool;
|
|
5
|
+
const tools_1 = require("@langchain/core/tools");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
const best_practices_1 = require("../tools/best-practices");
|
|
9
|
+
const progress_1 = require("../tools/helpers/progress");
|
|
10
|
+
const response_1 = require("../tools/helpers/response");
|
|
11
|
+
const categorization_1 = require("../types/categorization");
|
|
12
|
+
const getBestPracticesSchema = zod_1.z.object({
|
|
13
|
+
techniques: zod_1.z
|
|
14
|
+
.array(zod_1.z.nativeEnum(categorization_1.WorkflowTechnique))
|
|
15
|
+
.min(1)
|
|
16
|
+
.describe('List of workflow techniques to retrieve best practices for'),
|
|
17
|
+
});
|
|
18
|
+
function formatBestPractices(techniques) {
|
|
19
|
+
const parts = [];
|
|
20
|
+
const foundDocs = [];
|
|
21
|
+
for (const technique of techniques) {
|
|
22
|
+
const doc = best_practices_1.documentation[technique];
|
|
23
|
+
if (doc) {
|
|
24
|
+
foundDocs.push(doc.getDocumentation());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (foundDocs.length > 0) {
|
|
28
|
+
parts.push('<best_practices>');
|
|
29
|
+
parts.push(foundDocs.join('\n---\n'));
|
|
30
|
+
parts.push('</best_practices>');
|
|
31
|
+
}
|
|
32
|
+
return parts.join('\n');
|
|
33
|
+
}
|
|
34
|
+
exports.GET_BEST_PRACTICES_TOOL = {
|
|
35
|
+
toolName: 'get_best_practices',
|
|
36
|
+
displayTitle: 'Getting best practices',
|
|
37
|
+
};
|
|
38
|
+
function createGetBestPracticesTool() {
|
|
39
|
+
const dynamicTool = (0, tools_1.tool)((input, config) => {
|
|
40
|
+
const reporter = (0, progress_1.createProgressReporter)(config, exports.GET_BEST_PRACTICES_TOOL.toolName, exports.GET_BEST_PRACTICES_TOOL.displayTitle);
|
|
41
|
+
try {
|
|
42
|
+
const validatedInput = getBestPracticesSchema.parse(input);
|
|
43
|
+
const { techniques } = validatedInput;
|
|
44
|
+
reporter.start(validatedInput);
|
|
45
|
+
reporter.progress(`Retrieving best practices for ${techniques.length} technique(s)...`);
|
|
46
|
+
const availableDocs = techniques.filter((technique) => best_practices_1.documentation[technique]);
|
|
47
|
+
if (availableDocs.length === 0) {
|
|
48
|
+
const message = `No best practices documentation available for the requested techniques: ${techniques.join(', ')}`;
|
|
49
|
+
reporter.complete({ techniques, found: 0 });
|
|
50
|
+
return (0, response_1.createSuccessResponse)(config, message);
|
|
51
|
+
}
|
|
52
|
+
const message = formatBestPractices(techniques);
|
|
53
|
+
reporter.complete({
|
|
54
|
+
techniques,
|
|
55
|
+
found: availableDocs.length,
|
|
56
|
+
missing: techniques.length - availableDocs.length,
|
|
57
|
+
});
|
|
58
|
+
return (0, response_1.createSuccessResponse)(config, message);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
62
|
+
const validationError = new errors_1.ValidationError('Invalid input parameters', {
|
|
63
|
+
extra: { errors: error.errors },
|
|
64
|
+
});
|
|
65
|
+
reporter.error(validationError);
|
|
66
|
+
return (0, response_1.createErrorResponse)(config, validationError);
|
|
67
|
+
}
|
|
68
|
+
const toolError = new errors_1.ToolExecutionError(error instanceof Error ? error.message : 'Unknown error occurred', {
|
|
69
|
+
toolName: exports.GET_BEST_PRACTICES_TOOL.toolName,
|
|
70
|
+
cause: error instanceof Error ? error : undefined,
|
|
71
|
+
});
|
|
72
|
+
reporter.error(toolError);
|
|
73
|
+
return (0, response_1.createErrorResponse)(config, toolError);
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
name: exports.GET_BEST_PRACTICES_TOOL.toolName,
|
|
77
|
+
description: `Retrieve best practices documentation for specific workflow techniques.
|
|
78
|
+
|
|
79
|
+
Use this tool after categorizing a user's prompt to get relevant guidance on:
|
|
80
|
+
- Recommended nodes and their purposes
|
|
81
|
+
- Common pitfalls to avoid
|
|
82
|
+
- Performance and resource management tips
|
|
83
|
+
- Implementation patterns and best practices
|
|
84
|
+
- General tips on building workflows that utilise the provided techniques
|
|
85
|
+
|
|
86
|
+
This helps build better workflows by applying proven patterns and avoiding common mistakes.`,
|
|
87
|
+
schema: getBestPracticesSchema,
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
tool: dynamicTool,
|
|
91
|
+
...exports.GET_BEST_PRACTICES_TOOL,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=get-best-practices.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-best-practices.tool.js","sourceRoot":"","sources":["../../src/tools/get-best-practices.tool.ts"],"names":[],"mappings":";;;AAgDA,gEA4EC;AA5HD,iDAA6C;AAC7C,6BAAwB;AAExB,qCAA+D;AAC/D,2DAAuD;AACvD,uDAAkE;AAClE,uDAAsF;AACtF,2DAAuF;AAGvF,MAAM,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,UAAU,EAAE,OAAC;SACX,KAAK,CAAC,OAAC,CAAC,UAAU,CAAC,kCAAiB,CAAC,CAAC;SACtC,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,4DAA4D,CAAC;CACxE,CAAC,CAAC;AAKH,SAAS,mBAAmB,CAAC,UAAmC;IAC/D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,MAAM,GAAG,GAAG,8BAAa,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,GAAG,EAAE,CAAC;YACT,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACxC,CAAC;IACF,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,S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';
|
|
|
4
4
|
export declare function validateNodeExists(nodeId: string, nodes: INode[]): INode | null;
|
|
5
5
|
export declare function findNodeByName(nodeName: string, nodes: INode[]): INode | null;
|
|
6
6
|
export declare function findNodeByIdOrName(nodeIdentifier: string, nodes: INode[]): INode | null;
|
|
7
|
-
export declare function findNodeType(nodeTypeName: string, nodeTypes: INodeTypeDescription[]): INodeTypeDescription | null;
|
|
7
|
+
export declare function findNodeType(nodeTypeName: string, nodeVersion: number, nodeTypes: INodeTypeDescription[]): INodeTypeDescription | null;
|
|
8
8
|
export declare function validateConnection(sourceNode: INode, targetNode: INode): ToolError | null;
|
|
9
9
|
export declare function createValidationError(message: string, code: string, details?: Record<string, string>): ToolError;
|
|
10
10
|
export declare function createNodeNotFoundError(nodeIdentifier: string): ToolError;
|
|
@@ -23,8 +23,9 @@ function findNodeByIdOrName(nodeIdentifier, nodes) {
|
|
|
23
23
|
return byId;
|
|
24
24
|
return findNodeByName(nodeIdentifier, nodes);
|
|
25
25
|
}
|
|
26
|
-
function findNodeType(nodeTypeName, nodeTypes) {
|
|
27
|
-
return nodeTypes.find((nt) => nt.name === nodeTypeName
|
|
26
|
+
function findNodeType(nodeTypeName, nodeVersion, nodeTypes) {
|
|
27
|
+
return (nodeTypes.find((nt) => nt.name === nodeTypeName &&
|
|
28
|
+
(Array.isArray(nt.version) ? nt.version.includes(nodeVersion) : nt.version === nodeVersion)) ?? null);
|
|
28
29
|
}
|
|
29
30
|
function validateConnection(sourceNode, targetNode) {
|
|
30
31
|
if (sourceNode.id === targetNode.id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/tools/helpers/validation.ts"],"names":[],"mappings":";;AAeA,gDAEC;AAKD,wCAEC;AAKD,gDAOC;AAKD,
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/tools/helpers/validation.ts"],"names":[],"mappings":";;AAeA,gDAEC;AAKD,wCAEC;AAKD,gDAO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,EAAE;QACpF,SAAS;QACT,MAAM;QACN,OAAO;KACP,CAAC,CAAC;IAEH,OAAO;QACN,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE;KAC3D,CAAC;AACH,CAAC;AAKD,SAAgB,QAAQ,CAAC,QAAwB;IAChD,OAAO,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -8,17 +8,21 @@ export declare function createNodeDetailsTool(nodeTypes: INodeTypeDescription[])
|
|
|
8
8
|
getCustomDisplayTitle?: (values: Record<string, unknown>) => string;
|
|
9
9
|
tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
10
10
|
nodeName: z.ZodString;
|
|
11
|
+
nodeVersion: z.ZodNumber;
|
|
11
12
|
withParameters: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
12
13
|
withConnections: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
13
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
nodeVersion: number;
|
|
14
16
|
nodeName: string;
|
|
15
17
|
withParameters: boolean;
|
|
16
18
|
withConnections: boolean;
|
|
17
19
|
}, {
|
|
20
|
+
nodeVersion: number;
|
|
18
21
|
nodeName: string;
|
|
19
22
|
withParameters?: boolean | undefined;
|
|
20
23
|
withConnections?: boolean | undefined;
|
|
21
24
|
}>, unknown, {
|
|
25
|
+
nodeVersion: number;
|
|
22
26
|
nodeName: string;
|
|
23
27
|
withParameters?: boolean | undefined;
|
|
24
28
|
withConnections?: boolean | undefined;
|
|
@@ -10,6 +10,7 @@ const response_1 = require("./helpers/response");
|
|
|
10
10
|
const validation_1 = require("./helpers/validation");
|
|
11
11
|
const nodeDetailsSchema = zod_1.z.object({
|
|
12
12
|
nodeName: zod_1.z.string().describe('The exact node type name (e.g., n8n-nodes-base.httpRequest)'),
|
|
13
|
+
nodeVersion: zod_1.z.number().describe('The exact node version'),
|
|
13
14
|
withParameters: zod_1.z
|
|
14
15
|
.boolean()
|
|
15
16
|
.optional()
|
|
@@ -95,10 +96,10 @@ function createNodeDetailsTool(nodeTypes) {
|
|
|
95
96
|
const reporter = (0, progress_1.createProgressReporter)(config, exports.NODE_DETAILS_TOOL.toolName, exports.NODE_DETAILS_TOOL.displayTitle);
|
|
96
97
|
try {
|
|
97
98
|
const validatedInput = nodeDetailsSchema.parse(input);
|
|
98
|
-
const { nodeName, withParameters, withConnections } = validatedInput;
|
|
99
|
+
const { nodeName, nodeVersion, withParameters, withConnections } = validatedInput;
|
|
99
100
|
reporter.start(validatedInput);
|
|
100
101
|
(0, progress_1.reportProgress)(reporter, `Looking up details for ${nodeName}...`);
|
|
101
|
-
const nodeType = (0, validation_1.findNodeType)(nodeName, nodeTypes);
|
|
102
|
+
const nodeType = (0, validation_1.findNodeType)(nodeName, nodeVersion, nodeTypes);
|
|
102
103
|
if (!nodeType) {
|
|
103
104
|
const error = (0, validation_1.createNodeTypeNotFoundError)(nodeName);
|
|
104
105
|
reporter.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-details.tool.js","sourceRoot":"","sources":["../../src/tools/node-details.tool.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"node-details.tool.js","sourceRoot":"","sources":["../../src/tools/node-details.tool.ts"],"names":[],"mappings":";;;AAuIA,sDA8EC;AArND,iDAA6C;AAE7C,6BAAwB;AAIxB,sCAAgE;AAChE,iDAA4E;AAC5E,iDAAgF;AAChF,qDAAiF;AAOjF,MAAM,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IAC5F,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wB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K,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aACjD,CACD,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1B,OAAO,IAAA,8BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC,EACD;QACC,IAAI,EAAE,yBAAiB,CAAC,QAAQ;QAChC,WAAW,EACV,kLAAkL;QACnL,MAAM,EAAE,iBAAiB;KACzB,CACD,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,GAAG,yBAAiB;KACpB,CAAC;AACH,CAAC"}
|
|
@@ -33,24 +33,28 @@ The system's operations processor ensures state consistency across all parallel
|
|
|
33
33
|
<workflow_creation_sequence>
|
|
34
34
|
Follow this proven sequence for creating robust workflows:
|
|
35
35
|
|
|
36
|
-
1. **
|
|
36
|
+
1. **Categorization Phase** - MANDATORY
|
|
37
|
+
- Categorize the prompt and search for best practices documentation based on the techniques found
|
|
38
|
+
- Why: Best practices help to inform which nodes to search for and use to build the workflow plus mistakes to avoid
|
|
39
|
+
|
|
40
|
+
2. **Discovery Phase** (parallel execution)
|
|
37
41
|
- Search for all required node types simultaneously
|
|
38
42
|
- Why: Ensures you work with actual available nodes, not assumptions
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
3. **Analysis Phase** (parallel execution)
|
|
41
45
|
- Get details for ALL nodes before proceeding
|
|
42
46
|
- Why: Understanding inputs/outputs prevents connection errors and ensures proper parameter configuration
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
4. **Creation Phase** (parallel execution)
|
|
45
49
|
- Add nodes individually by calling add_nodes for each node
|
|
46
50
|
- Execute multiple add_nodes calls in parallel for efficiency
|
|
47
51
|
- Why: Each node addition is independent, parallel execution is faster, and the operations processor ensures consistency
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
5. **Connection Phase** (parallel execution)
|
|
50
54
|
- Connect all nodes based on discovered input/output structure
|
|
51
55
|
- Why: Parallel connections are safe and faster
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
6. **Configuration Phase** (parallel execution) - MANDATORY
|
|
54
58
|
- ALWAYS configure nodes using update_node_parameters
|
|
55
59
|
- Even for "simple" nodes like HTTP Request, Set, etc.
|
|
56
60
|
- Configure all nodes in parallel for efficiency
|
|
@@ -63,6 +67,18 @@ Follow this proven sequence for creating robust workflows:
|
|
|
63
67
|
- Review <workflow_validation_report> and resolve any violations before finalizing
|
|
64
68
|
- Why: Ensures structural issues are surfaced early; rerun validation after major updates
|
|
65
69
|
|
|
70
|
+
<best_practices_compliance>
|
|
71
|
+
Enforcing best practice compliance is MANDATORY
|
|
72
|
+
|
|
73
|
+
You MUST enforce best practices even when the user doesn't explicitly request them. Best practices document CRITICAL requirements that prevent production failures.
|
|
74
|
+
|
|
75
|
+
When you retrieve best practices and see CRITICAL requirements:
|
|
76
|
+
1. Identify all MUST-HAVE nodes and configurations
|
|
77
|
+
2. Add them to your workflow plan
|
|
78
|
+
3. Include them in the workflow even if user didn't explicitly ask
|
|
79
|
+
4. Mention them in your setup response so user understands why they're there
|
|
80
|
+
</best_practices_compliance>
|
|
81
|
+
|
|
66
82
|
<parallel_node_creation_example>
|
|
67
83
|
Example: Creating and configuring a workflow (complete process):
|
|
68
84
|
|
|
@@ -92,6 +108,7 @@ Always determine connectionParametersReasoning before setting connectionParamete
|
|
|
92
108
|
- Does this node have dynamic inputs/outputs?
|
|
93
109
|
- Which parameters affect the connection structure?
|
|
94
110
|
- What mode or operation changes the available connections?
|
|
111
|
+
- Are there best practices which provide recommendations for connections?
|
|
95
112
|
</reasoning_first>
|
|
96
113
|
|
|
97
114
|
<parameter_examples>
|
|
@@ -435,6 +452,7 @@ When modifying existing nodes:
|
|
|
435
452
|
<handling_uncertainty>
|
|
436
453
|
When unsure about specific values:
|
|
437
454
|
- Add nodes and connections confidently
|
|
455
|
+
- investigate best practices to see if there are recommendations on how to proceed
|
|
438
456
|
- For uncertain parameters, use update_node_parameters with placeholders formatted exactly as "<__PLACEHOLDER_VALUE__VALUE_LABEL__>"
|
|
439
457
|
- Make VALUE_LABEL descriptive (e.g., "API endpoint URL", "Auth token header") so users know what to supply
|
|
440
458
|
- For tool nodes with dynamic values, use $fromAI expressions instead of placeholders
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main-agent.prompt.js","sourceRoot":"","sources":["../../../src/tools/prompts/main-agent.prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAE7D,oEAAsE;AAEtE,MAAM,YAAY,GAAG
|
|
1
|
+
{"version":3,"file":"main-agent.prompt.js","sourceRoot":"","sources":["../../../src/tools/prompts/main-agent.prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAE7D,oEAAsE;AAEtE,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAudpB,CAAC;AAEF,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCxB,CAAC;AAEF,MAAM,2BAA2B,GAAG;;;oBAGhB,CAAC;AAER,QAAA,eAAe,GAAG,4BAAkB,CAAC,YAAY,CAAC;IAC9D;QACC,QAAQ;QACR;YACC;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,YAAY;aAClB;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gCAAiB;aACvB;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gBAAgB;aACtB;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,2BAA2B;gBACjC,aAAa,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;aACpC;SACD;KACD;IACD,CAAC,aAAa,EAAE,YAAY,CAAC;CAC7B,CAAC,CAAC"}
|
|
@@ -89,7 +89,7 @@ function createUpdateNodeParametersTool(nodeTypes, llm, logger, instanceUrl) {
|
|
|
89
89
|
reporter.error(error);
|
|
90
90
|
return (0, response_1.createErrorResponse)(config, error);
|
|
91
91
|
}
|
|
92
|
-
const nodeType = (0, validation_1.findNodeType)(node.type, nodeTypes);
|
|
92
|
+
const nodeType = (0, validation_1.findNodeType)(node.type, node.typeVersion, nodeTypes);
|
|
93
93
|
if (!nodeType) {
|
|
94
94
|
const error = (0, validation_1.createNodeTypeNotFoundError)(node.type);
|
|
95
95
|
reporter.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-node-parameters.tool.js","sourceRoot":"","sources":["../../src/tools/update-node-parameters.tool.ts"],"names":[],"mappings":";;;AAuIA,wEAkIC;AAxQD,iDAA6C;AAE7C,6BAAwB;AAGxB,yEAAiE;AAEjE,mEAA0E;AAC1E,sCAAsF;AAEtF,iDAA4E;AAC5E,iDAAgF;AAChF,2CAA6F;AAC7F,qDAK8B;AAC9B,2EAKwC;AAKxC,MAAM,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC3D,OAAO,EAAE,OAAC;SACR,KAAK,CAAC,OAAC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K,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,EACjE;gBACC,QAAQ,EAAE,oCAA4B,CAAC,QAAQ;gBAC/C,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aACjD,CACD,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1B,OAAO,IAAA,8BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACF,CAAC,EACD;QACC,IAAI,EAAE,oCAA4B,CAAC,QAAQ;QAC3C,WAAW,EACV,uVAAuV;QACxV,MAAM,EAAE,0BAA0B;KAClC,CACD,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,GAAG,oCAA4B;KAC/B,CAAC;AACH,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type INode, type INodeTypeDescription, type NodeParameterValueType } from 'n8n-workflow';
|
|
2
2
|
export declare function generateUniqueName(baseName: string, existingNodes: INode[]): string;
|
|
3
3
|
export declare function getLatestVersion(nodeType: INodeTypeDescription): number;
|
|
4
4
|
export declare function generateNodeId(): string;
|
|
5
5
|
export declare function generateWebhookId(): string;
|
|
6
6
|
export declare function requiresWebhook(nodeType: INodeTypeDescription): boolean;
|
|
7
|
-
export declare function createNodeInstance(nodeType: INodeTypeDescription, name: string, position: [number, number], parameters?: Record<string, NodeParameterValueType
|
|
7
|
+
export declare function createNodeInstance(nodeType: INodeTypeDescription, typeVersion: number, name: string, position: [number, number], parameters?: Record<string, NodeParameterValueType>, id?: string): INode;
|
|
8
8
|
export declare function mergeWithDefaults(parameters: Record<string, NodeParameterValueType>, nodeType: INodeTypeDescription): Record<string, NodeParameterValueType>;
|
|
@@ -7,6 +7,7 @@ exports.generateWebhookId = generateWebhookId;
|
|
|
7
7
|
exports.requiresWebhook = requiresWebhook;
|
|
8
8
|
exports.createNodeInstance = createNodeInstance;
|
|
9
9
|
exports.mergeWithDefaults = mergeWithDefaults;
|
|
10
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
10
11
|
function generateUniqueName(baseName, existingNodes) {
|
|
11
12
|
let uniqueName = baseName;
|
|
12
13
|
let counter = 1;
|
|
@@ -31,12 +32,15 @@ function generateWebhookId() {
|
|
|
31
32
|
function requiresWebhook(nodeType) {
|
|
32
33
|
return !!(nodeType.webhooks && nodeType.webhooks.length > 0);
|
|
33
34
|
}
|
|
34
|
-
function createNodeInstance(nodeType, name, position, parameters = {}) {
|
|
35
|
+
function createNodeInstance(nodeType, typeVersion, name, position, parameters = {}, id) {
|
|
36
|
+
(0, n8n_workflow_1.assert)(Array.isArray(nodeType.version)
|
|
37
|
+
? nodeType.version.includes(typeVersion)
|
|
38
|
+
: typeVersion === nodeType.version);
|
|
35
39
|
const node = {
|
|
36
|
-
id: generateNodeId(),
|
|
40
|
+
id: id ?? generateNodeId(),
|
|
37
41
|
name,
|
|
38
42
|
type: nodeType.name,
|
|
39
|
-
typeVersion
|
|
43
|
+
typeVersion,
|
|
40
44
|
position,
|
|
41
45
|
parameters,
|
|
42
46
|
};
|