n8n-mcp 2.12.2 → 2.13.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/README.md +6 -4
- package/data/nodes.db +0 -0
- package/dist/mcp/handlers-n8n-manager.d.ts +1 -0
- package/dist/mcp/handlers-n8n-manager.d.ts.map +1 -1
- package/dist/mcp/handlers-n8n-manager.js +144 -1
- package/dist/mcp/handlers-n8n-manager.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +7 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-docs/index.d.ts.map +1 -1
- package/dist/mcp/tool-docs/index.js +1 -0
- package/dist/mcp/tool-docs/index.js.map +1 -1
- package/dist/mcp/tool-docs/validation/validate-workflow.js +1 -1
- package/dist/mcp/tool-docs/validation/validate-workflow.js.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/index.d.ts +1 -0
- package/dist/mcp/tool-docs/workflow_management/index.d.ts.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/index.js +3 -1
- package/dist/mcp/tool-docs/workflow_management/index.js.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/n8n-autofix-workflow.d.ts +3 -0
- package/dist/mcp/tool-docs/workflow_management/n8n-autofix-workflow.d.ts.map +1 -0
- package/dist/mcp/tool-docs/workflow_management/n8n-autofix-workflow.js +127 -0
- package/dist/mcp/tool-docs/workflow_management/n8n-autofix-workflow.js.map +1 -0
- package/dist/mcp/tool-docs/workflow_management/n8n-validate-workflow.js +1 -1
- package/dist/mcp/tool-docs/workflow_management/n8n-validate-workflow.js.map +1 -1
- package/dist/mcp/tools-n8n-manager.d.ts.map +1 -1
- package/dist/mcp/tools-n8n-manager.js +35 -0
- package/dist/mcp/tools-n8n-manager.js.map +1 -1
- package/dist/scripts/debug-http-search.d.ts +3 -0
- package/dist/scripts/debug-http-search.d.ts.map +1 -0
- package/dist/scripts/debug-http-search.js +57 -0
- package/dist/scripts/debug-http-search.js.map +1 -0
- package/dist/scripts/test-autofix-documentation.d.ts +3 -0
- package/dist/scripts/test-autofix-documentation.d.ts.map +1 -0
- package/dist/scripts/test-autofix-documentation.js +103 -0
- package/dist/scripts/test-autofix-documentation.js.map +1 -0
- package/dist/scripts/test-autofix-workflow.d.ts +2 -0
- package/dist/scripts/test-autofix-workflow.d.ts.map +1 -0
- package/dist/scripts/test-autofix-workflow.js +223 -0
- package/dist/scripts/test-autofix-workflow.js.map +1 -0
- package/dist/scripts/test-node-suggestions.d.ts +3 -0
- package/dist/scripts/test-node-suggestions.d.ts.map +1 -0
- package/dist/scripts/test-node-suggestions.js +165 -0
- package/dist/scripts/test-node-suggestions.js.map +1 -0
- package/dist/scripts/test-summary.d.ts +3 -0
- package/dist/scripts/test-summary.d.ts.map +1 -0
- package/dist/scripts/test-summary.js +77 -0
- package/dist/scripts/test-summary.js.map +1 -0
- package/dist/scripts/test-validation-parity.d.ts +2 -0
- package/dist/scripts/test-validation-parity.d.ts.map +1 -0
- package/dist/scripts/test-validation-parity.js +153 -0
- package/dist/scripts/test-validation-parity.js.map +1 -0
- package/dist/scripts/test-webhook-autofix.d.ts +3 -0
- package/dist/scripts/test-webhook-autofix.d.ts.map +1 -0
- package/dist/scripts/test-webhook-autofix.js +117 -0
- package/dist/scripts/test-webhook-autofix.js.map +1 -0
- package/dist/services/node-similarity-service.d.ts +51 -0
- package/dist/services/node-similarity-service.d.ts.map +1 -0
- package/dist/services/node-similarity-service.js +335 -0
- package/dist/services/node-similarity-service.js.map +1 -0
- package/dist/services/workflow-auto-fixer.d.ts +65 -0
- package/dist/services/workflow-auto-fixer.d.ts.map +1 -0
- package/dist/services/workflow-auto-fixer.js +394 -0
- package/dist/services/workflow-auto-fixer.js.map +1 -0
- package/dist/services/workflow-validator.d.ts +1 -1
- package/dist/services/workflow-validator.d.ts.map +1 -1
- package/dist/services/workflow-validator.js +37 -89
- package/dist/services/workflow-validator.js.map +1 -1
- package/dist/utils/node-type-utils.d.ts +9 -0
- package/dist/utils/node-type-utils.d.ts.map +1 -0
- package/dist/utils/node-type-utils.js +78 -0
- package/dist/utils/node-type-utils.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeSimilarityService = void 0;
|
|
4
|
+
const logger_1 = require("../utils/logger");
|
|
5
|
+
class NodeSimilarityService {
|
|
6
|
+
constructor(repository) {
|
|
7
|
+
this.nodeCache = null;
|
|
8
|
+
this.cacheExpiry = 0;
|
|
9
|
+
this.cacheVersion = 0;
|
|
10
|
+
this.repository = repository;
|
|
11
|
+
this.commonMistakes = this.initializeCommonMistakes();
|
|
12
|
+
}
|
|
13
|
+
initializeCommonMistakes() {
|
|
14
|
+
const patterns = new Map();
|
|
15
|
+
patterns.set('case_variations', [
|
|
16
|
+
{ pattern: 'httprequest', suggestion: 'nodes-base.httpRequest', confidence: 0.95, reason: 'Incorrect capitalization' },
|
|
17
|
+
{ pattern: 'webhook', suggestion: 'nodes-base.webhook', confidence: 0.95, reason: 'Incorrect capitalization' },
|
|
18
|
+
{ pattern: 'slack', suggestion: 'nodes-base.slack', confidence: 0.9, reason: 'Missing package prefix' },
|
|
19
|
+
{ pattern: 'gmail', suggestion: 'nodes-base.gmail', confidence: 0.9, reason: 'Missing package prefix' },
|
|
20
|
+
{ pattern: 'googlesheets', suggestion: 'nodes-base.googleSheets', confidence: 0.9, reason: 'Missing package prefix' },
|
|
21
|
+
{ pattern: 'telegram', suggestion: 'nodes-base.telegram', confidence: 0.9, reason: 'Missing package prefix' },
|
|
22
|
+
]);
|
|
23
|
+
patterns.set('specific_variations', [
|
|
24
|
+
{ pattern: 'HttpRequest', suggestion: 'nodes-base.httpRequest', confidence: 0.95, reason: 'Incorrect capitalization' },
|
|
25
|
+
{ pattern: 'HTTPRequest', suggestion: 'nodes-base.httpRequest', confidence: 0.95, reason: 'Common capitalization mistake' },
|
|
26
|
+
{ pattern: 'Webhook', suggestion: 'nodes-base.webhook', confidence: 0.95, reason: 'Incorrect capitalization' },
|
|
27
|
+
{ pattern: 'WebHook', suggestion: 'nodes-base.webhook', confidence: 0.95, reason: 'Common capitalization mistake' },
|
|
28
|
+
]);
|
|
29
|
+
patterns.set('deprecated_prefixes', [
|
|
30
|
+
{ pattern: 'n8n-nodes-base.', suggestion: 'nodes-base.', confidence: 0.95, reason: 'Full package name used instead of short form' },
|
|
31
|
+
{ pattern: '@n8n/n8n-nodes-langchain.', suggestion: 'nodes-langchain.', confidence: 0.95, reason: 'Full package name used instead of short form' },
|
|
32
|
+
]);
|
|
33
|
+
patterns.set('typos', [
|
|
34
|
+
{ pattern: 'htprequest', suggestion: 'nodes-base.httpRequest', confidence: 0.8, reason: 'Likely typo' },
|
|
35
|
+
{ pattern: 'httpreqest', suggestion: 'nodes-base.httpRequest', confidence: 0.8, reason: 'Likely typo' },
|
|
36
|
+
{ pattern: 'webook', suggestion: 'nodes-base.webhook', confidence: 0.8, reason: 'Likely typo' },
|
|
37
|
+
{ pattern: 'slak', suggestion: 'nodes-base.slack', confidence: 0.8, reason: 'Likely typo' },
|
|
38
|
+
{ pattern: 'googlesheets', suggestion: 'nodes-base.googleSheets', confidence: 0.8, reason: 'Likely typo' },
|
|
39
|
+
]);
|
|
40
|
+
patterns.set('ai_nodes', [
|
|
41
|
+
{ pattern: 'openai', suggestion: 'nodes-langchain.openAi', confidence: 0.85, reason: 'AI node - incorrect package' },
|
|
42
|
+
{ pattern: 'nodes-base.openai', suggestion: 'nodes-langchain.openAi', confidence: 0.9, reason: 'Wrong package - OpenAI is in LangChain package' },
|
|
43
|
+
{ pattern: 'chatopenai', suggestion: 'nodes-langchain.lmChatOpenAi', confidence: 0.85, reason: 'LangChain node naming convention' },
|
|
44
|
+
{ pattern: 'vectorstore', suggestion: 'nodes-langchain.vectorStoreInMemory', confidence: 0.7, reason: 'Generic vector store reference' },
|
|
45
|
+
]);
|
|
46
|
+
return patterns;
|
|
47
|
+
}
|
|
48
|
+
isCommonNodeWithoutPrefix(type) {
|
|
49
|
+
const commonNodes = {
|
|
50
|
+
'httprequest': 'nodes-base.httpRequest',
|
|
51
|
+
'webhook': 'nodes-base.webhook',
|
|
52
|
+
'slack': 'nodes-base.slack',
|
|
53
|
+
'gmail': 'nodes-base.gmail',
|
|
54
|
+
'googlesheets': 'nodes-base.googleSheets',
|
|
55
|
+
'telegram': 'nodes-base.telegram',
|
|
56
|
+
'discord': 'nodes-base.discord',
|
|
57
|
+
'notion': 'nodes-base.notion',
|
|
58
|
+
'airtable': 'nodes-base.airtable',
|
|
59
|
+
'postgres': 'nodes-base.postgres',
|
|
60
|
+
'mysql': 'nodes-base.mySql',
|
|
61
|
+
'mongodb': 'nodes-base.mongoDb',
|
|
62
|
+
};
|
|
63
|
+
const normalized = type.toLowerCase();
|
|
64
|
+
return commonNodes[normalized] || null;
|
|
65
|
+
}
|
|
66
|
+
async findSimilarNodes(invalidType, limit = 5) {
|
|
67
|
+
if (!invalidType || invalidType.trim() === '') {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
const suggestions = [];
|
|
71
|
+
const mistakeSuggestion = this.checkCommonMistakes(invalidType);
|
|
72
|
+
if (mistakeSuggestion) {
|
|
73
|
+
suggestions.push(mistakeSuggestion);
|
|
74
|
+
}
|
|
75
|
+
const allNodes = await this.getCachedNodes();
|
|
76
|
+
const scores = allNodes.map(node => ({
|
|
77
|
+
node,
|
|
78
|
+
score: this.calculateSimilarityScore(invalidType, node)
|
|
79
|
+
}));
|
|
80
|
+
scores.sort((a, b) => b.score.totalScore - a.score.totalScore);
|
|
81
|
+
for (const { node, score } of scores) {
|
|
82
|
+
if (suggestions.some(s => s.nodeType === node.nodeType)) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (score.totalScore >= NodeSimilarityService.SCORING_THRESHOLD) {
|
|
86
|
+
suggestions.push(this.createSuggestion(node, score));
|
|
87
|
+
}
|
|
88
|
+
if (suggestions.length >= limit) {
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return suggestions;
|
|
93
|
+
}
|
|
94
|
+
checkCommonMistakes(invalidType) {
|
|
95
|
+
const cleanType = invalidType.trim();
|
|
96
|
+
const lowerType = cleanType.toLowerCase();
|
|
97
|
+
const commonNodeSuggestion = this.isCommonNodeWithoutPrefix(cleanType);
|
|
98
|
+
if (commonNodeSuggestion) {
|
|
99
|
+
const node = this.repository.getNode(commonNodeSuggestion);
|
|
100
|
+
if (node) {
|
|
101
|
+
return {
|
|
102
|
+
nodeType: commonNodeSuggestion,
|
|
103
|
+
displayName: node.displayName,
|
|
104
|
+
confidence: 0.9,
|
|
105
|
+
reason: 'Missing package prefix',
|
|
106
|
+
category: node.category,
|
|
107
|
+
description: node.description
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
for (const [category, patterns] of this.commonMistakes) {
|
|
112
|
+
if (category === 'deprecated_prefixes') {
|
|
113
|
+
for (const pattern of patterns) {
|
|
114
|
+
if (cleanType.startsWith(pattern.pattern)) {
|
|
115
|
+
const actualSuggestion = cleanType.replace(pattern.pattern, pattern.suggestion);
|
|
116
|
+
const node = this.repository.getNode(actualSuggestion);
|
|
117
|
+
if (node) {
|
|
118
|
+
return {
|
|
119
|
+
nodeType: actualSuggestion,
|
|
120
|
+
displayName: node.displayName,
|
|
121
|
+
confidence: pattern.confidence,
|
|
122
|
+
reason: pattern.reason,
|
|
123
|
+
category: node.category,
|
|
124
|
+
description: node.description
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
for (const [category, patterns] of this.commonMistakes) {
|
|
132
|
+
if (category === 'deprecated_prefixes')
|
|
133
|
+
continue;
|
|
134
|
+
for (const pattern of patterns) {
|
|
135
|
+
const match = category === 'specific_variations'
|
|
136
|
+
? cleanType === pattern.pattern
|
|
137
|
+
: lowerType === pattern.pattern.toLowerCase();
|
|
138
|
+
if (match && pattern.suggestion) {
|
|
139
|
+
const node = this.repository.getNode(pattern.suggestion);
|
|
140
|
+
if (node) {
|
|
141
|
+
return {
|
|
142
|
+
nodeType: pattern.suggestion,
|
|
143
|
+
displayName: node.displayName,
|
|
144
|
+
confidence: pattern.confidence,
|
|
145
|
+
reason: pattern.reason,
|
|
146
|
+
category: node.category,
|
|
147
|
+
description: node.description
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
calculateSimilarityScore(invalidType, node) {
|
|
156
|
+
const cleanInvalid = this.normalizeNodeType(invalidType);
|
|
157
|
+
const cleanValid = this.normalizeNodeType(node.nodeType);
|
|
158
|
+
const displayNameClean = this.normalizeNodeType(node.displayName);
|
|
159
|
+
const isShortSearch = invalidType.length <= NodeSimilarityService.SHORT_SEARCH_LENGTH;
|
|
160
|
+
let nameSimilarity = Math.max(this.getStringSimilarity(cleanInvalid, cleanValid), this.getStringSimilarity(cleanInvalid, displayNameClean)) * 40;
|
|
161
|
+
if (isShortSearch && (cleanValid.includes(cleanInvalid) || displayNameClean.includes(cleanInvalid))) {
|
|
162
|
+
nameSimilarity = Math.max(nameSimilarity, 10);
|
|
163
|
+
}
|
|
164
|
+
let categoryMatch = 0;
|
|
165
|
+
if (node.category) {
|
|
166
|
+
const categoryClean = this.normalizeNodeType(node.category);
|
|
167
|
+
if (cleanInvalid.includes(categoryClean) || categoryClean.includes(cleanInvalid)) {
|
|
168
|
+
categoryMatch = 20;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
let packageMatch = 0;
|
|
172
|
+
const invalidParts = cleanInvalid.split(/[.-]/);
|
|
173
|
+
const validParts = cleanValid.split(/[.-]/);
|
|
174
|
+
if (invalidParts[0] === validParts[0]) {
|
|
175
|
+
packageMatch = 15;
|
|
176
|
+
}
|
|
177
|
+
let patternMatch = 0;
|
|
178
|
+
if (cleanValid.includes(cleanInvalid) || displayNameClean.includes(cleanInvalid)) {
|
|
179
|
+
patternMatch = isShortSearch ? 45 : 25;
|
|
180
|
+
}
|
|
181
|
+
else if (this.getEditDistance(cleanInvalid, cleanValid) <= NodeSimilarityService.TYPO_EDIT_DISTANCE) {
|
|
182
|
+
patternMatch = 20;
|
|
183
|
+
}
|
|
184
|
+
else if (this.getEditDistance(cleanInvalid, displayNameClean) <= NodeSimilarityService.TYPO_EDIT_DISTANCE) {
|
|
185
|
+
patternMatch = 18;
|
|
186
|
+
}
|
|
187
|
+
if (isShortSearch && (cleanValid.startsWith(cleanInvalid) || displayNameClean.startsWith(cleanInvalid))) {
|
|
188
|
+
patternMatch = Math.max(patternMatch, 40);
|
|
189
|
+
}
|
|
190
|
+
const totalScore = nameSimilarity + categoryMatch + packageMatch + patternMatch;
|
|
191
|
+
return {
|
|
192
|
+
nameSimilarity,
|
|
193
|
+
categoryMatch,
|
|
194
|
+
packageMatch,
|
|
195
|
+
patternMatch,
|
|
196
|
+
totalScore
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
createSuggestion(node, score) {
|
|
200
|
+
let reason = 'Similar node';
|
|
201
|
+
if (score.patternMatch >= 20) {
|
|
202
|
+
reason = 'Name similarity';
|
|
203
|
+
}
|
|
204
|
+
else if (score.categoryMatch >= 15) {
|
|
205
|
+
reason = 'Same category';
|
|
206
|
+
}
|
|
207
|
+
else if (score.packageMatch >= 10) {
|
|
208
|
+
reason = 'Same package';
|
|
209
|
+
}
|
|
210
|
+
const confidence = Math.min(score.totalScore / 100, 1);
|
|
211
|
+
return {
|
|
212
|
+
nodeType: node.nodeType,
|
|
213
|
+
displayName: node.displayName,
|
|
214
|
+
confidence,
|
|
215
|
+
reason,
|
|
216
|
+
category: node.category,
|
|
217
|
+
description: node.description
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
normalizeNodeType(type) {
|
|
221
|
+
return type
|
|
222
|
+
.toLowerCase()
|
|
223
|
+
.replace(/[^a-z0-9]/g, '')
|
|
224
|
+
.trim();
|
|
225
|
+
}
|
|
226
|
+
getStringSimilarity(s1, s2) {
|
|
227
|
+
if (s1 === s2)
|
|
228
|
+
return 1;
|
|
229
|
+
if (!s1 || !s2)
|
|
230
|
+
return 0;
|
|
231
|
+
const distance = this.getEditDistance(s1, s2);
|
|
232
|
+
const maxLen = Math.max(s1.length, s2.length);
|
|
233
|
+
return 1 - (distance / maxLen);
|
|
234
|
+
}
|
|
235
|
+
getEditDistance(s1, s2, maxDistance = 5) {
|
|
236
|
+
if (s1 === s2)
|
|
237
|
+
return 0;
|
|
238
|
+
const m = s1.length;
|
|
239
|
+
const n = s2.length;
|
|
240
|
+
const lengthDiff = Math.abs(m - n);
|
|
241
|
+
if (lengthDiff > maxDistance)
|
|
242
|
+
return maxDistance + 1;
|
|
243
|
+
if (m === 0)
|
|
244
|
+
return n;
|
|
245
|
+
if (n === 0)
|
|
246
|
+
return m;
|
|
247
|
+
let prev = Array(n + 1).fill(0).map((_, i) => i);
|
|
248
|
+
for (let i = 1; i <= m; i++) {
|
|
249
|
+
const curr = [i];
|
|
250
|
+
let minInRow = i;
|
|
251
|
+
for (let j = 1; j <= n; j++) {
|
|
252
|
+
const cost = s1[i - 1] === s2[j - 1] ? 0 : 1;
|
|
253
|
+
const val = Math.min(curr[j - 1] + 1, prev[j] + 1, prev[j - 1] + cost);
|
|
254
|
+
curr.push(val);
|
|
255
|
+
minInRow = Math.min(minInRow, val);
|
|
256
|
+
}
|
|
257
|
+
if (minInRow > maxDistance) {
|
|
258
|
+
return maxDistance + 1;
|
|
259
|
+
}
|
|
260
|
+
prev = curr;
|
|
261
|
+
}
|
|
262
|
+
return prev[n];
|
|
263
|
+
}
|
|
264
|
+
async getCachedNodes() {
|
|
265
|
+
const now = Date.now();
|
|
266
|
+
if (!this.nodeCache || now > this.cacheExpiry) {
|
|
267
|
+
try {
|
|
268
|
+
const newNodes = this.repository.getAllNodes();
|
|
269
|
+
if (newNodes && newNodes.length > 0) {
|
|
270
|
+
this.nodeCache = newNodes;
|
|
271
|
+
this.cacheExpiry = now + NodeSimilarityService.CACHE_DURATION_MS;
|
|
272
|
+
this.cacheVersion++;
|
|
273
|
+
logger_1.logger.debug('Node cache refreshed', {
|
|
274
|
+
count: newNodes.length,
|
|
275
|
+
version: this.cacheVersion
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
else if (this.nodeCache) {
|
|
279
|
+
logger_1.logger.warn('Node fetch returned empty, using stale cache');
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
logger_1.logger.error('Failed to fetch nodes for similarity service', error);
|
|
284
|
+
if (this.nodeCache) {
|
|
285
|
+
logger_1.logger.info('Using stale cache due to fetch error');
|
|
286
|
+
return this.nodeCache;
|
|
287
|
+
}
|
|
288
|
+
return [];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return this.nodeCache || [];
|
|
292
|
+
}
|
|
293
|
+
invalidateCache() {
|
|
294
|
+
this.nodeCache = null;
|
|
295
|
+
this.cacheExpiry = 0;
|
|
296
|
+
this.cacheVersion++;
|
|
297
|
+
logger_1.logger.debug('Node cache invalidated', { version: this.cacheVersion });
|
|
298
|
+
}
|
|
299
|
+
async refreshCache() {
|
|
300
|
+
this.invalidateCache();
|
|
301
|
+
await this.getCachedNodes();
|
|
302
|
+
}
|
|
303
|
+
formatSuggestionMessage(suggestions, invalidType) {
|
|
304
|
+
if (suggestions.length === 0) {
|
|
305
|
+
return `Unknown node type: "${invalidType}". No similar nodes found.`;
|
|
306
|
+
}
|
|
307
|
+
let message = `Unknown node type: "${invalidType}"\n\nDid you mean one of these?\n`;
|
|
308
|
+
for (const suggestion of suggestions) {
|
|
309
|
+
const confidence = Math.round(suggestion.confidence * 100);
|
|
310
|
+
message += `• ${suggestion.nodeType} (${confidence}% match)`;
|
|
311
|
+
if (suggestion.displayName) {
|
|
312
|
+
message += ` - ${suggestion.displayName}`;
|
|
313
|
+
}
|
|
314
|
+
message += `\n → ${suggestion.reason}`;
|
|
315
|
+
if (suggestion.confidence >= 0.9) {
|
|
316
|
+
message += ' (can be auto-fixed)';
|
|
317
|
+
}
|
|
318
|
+
message += '\n';
|
|
319
|
+
}
|
|
320
|
+
return message;
|
|
321
|
+
}
|
|
322
|
+
isAutoFixable(suggestion) {
|
|
323
|
+
return suggestion.confidence >= NodeSimilarityService.AUTO_FIX_CONFIDENCE;
|
|
324
|
+
}
|
|
325
|
+
clearCache() {
|
|
326
|
+
this.invalidateCache();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
exports.NodeSimilarityService = NodeSimilarityService;
|
|
330
|
+
NodeSimilarityService.SCORING_THRESHOLD = 50;
|
|
331
|
+
NodeSimilarityService.TYPO_EDIT_DISTANCE = 2;
|
|
332
|
+
NodeSimilarityService.SHORT_SEARCH_LENGTH = 5;
|
|
333
|
+
NodeSimilarityService.CACHE_DURATION_MS = 5 * 60 * 1000;
|
|
334
|
+
NodeSimilarityService.AUTO_FIX_CONFIDENCE = 0.9;
|
|
335
|
+
//# sourceMappingURL=node-similarity-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-similarity-service.js","sourceRoot":"","sources":["../../src/services/node-similarity-service.ts"],"names":[],"mappings":";;;AACA,4CAAyC;AA0BzC,MAAa,qBAAqB;IAchC,YAAY,UAA0B;QAJ9B,cAAS,GAAiB,IAAI,CAAC;QAC/B,gBAAW,GAAW,CAAC,CAAC;QACxB,iBAAY,GAAW,CAAC,CAAC;QAG/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACxD,CAAC;IAMO,wBAAwB;QAC9B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkC,CAAC;QAG3D,QAAQ,CAAC,GAAG,CAAC,iBAAiB,EAAE;Y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YACrC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;YAC3D,OAAO,IAAI,KAAK,UAAU,CAAC,QAAQ,KAAK,UAAU,UAAU,CAAC;YAE7D,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;gBAC3B,OAAO,IAAI,MAAM,UAAU,CAAC,WAAW,EAAE,CAAC;YAC5C,CAAC;YAED,OAAO,IAAI,SAAS,UAAU,CAAC,MAAM,EAAE,CAAC;YAExC,IAAI,UAAU,CAAC,UAAU,IAAI,GAAG,EAAE,CAAC;gBACjC,OAAO,IAAI,sBAAsB,CAAC;YACpC,CAAC;YAED,OAAO,IAAI,IAAI,CAAC;QAClB,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAKD,aAAa,CAAC,UAA0B;QACtC,OAAO,UAAU,CAAC,UAAU,IAAI,qBAAqB,CAAC,mBAAmB,CAAC;IAC5E,CAAC;IAMD,UAAU;QACR,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;;AAneH,sDAoeC;AAleyB,uCAAiB,GAAG,EAAE,AAAL,CAAM;AACvB,wCAAkB,GAAG,CAAC,AAAJ,CAAK;AACvB,yCAAmB,GAAG,CAAC,AAAJ,CAAK;AACxB,uCAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,AAAhB,CAAiB;AAClC,yCAAmB,GAAG,GAAG,AAAN,CAAO"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { WorkflowValidationResult } from './workflow-validator';
|
|
2
|
+
import { ExpressionFormatIssue } from './expression-format-validator';
|
|
3
|
+
import { NodeRepository } from '../database/node-repository';
|
|
4
|
+
import { WorkflowDiffOperation } from '../types/workflow-diff';
|
|
5
|
+
import { Workflow } from '../types/n8n-api';
|
|
6
|
+
export type FixConfidenceLevel = 'high' | 'medium' | 'low';
|
|
7
|
+
export type FixType = 'expression-format' | 'typeversion-correction' | 'error-output-config' | 'node-type-correction' | 'webhook-missing-path';
|
|
8
|
+
export interface AutoFixConfig {
|
|
9
|
+
applyFixes: boolean;
|
|
10
|
+
fixTypes?: FixType[];
|
|
11
|
+
confidenceThreshold?: FixConfidenceLevel;
|
|
12
|
+
maxFixes?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface FixOperation {
|
|
15
|
+
node: string;
|
|
16
|
+
field: string;
|
|
17
|
+
type: FixType;
|
|
18
|
+
before: any;
|
|
19
|
+
after: any;
|
|
20
|
+
confidence: FixConfidenceLevel;
|
|
21
|
+
description: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AutoFixResult {
|
|
24
|
+
operations: WorkflowDiffOperation[];
|
|
25
|
+
fixes: FixOperation[];
|
|
26
|
+
summary: string;
|
|
27
|
+
stats: {
|
|
28
|
+
total: number;
|
|
29
|
+
byType: Record<FixType, number>;
|
|
30
|
+
byConfidence: Record<FixConfidenceLevel, number>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface NodeFormatIssue extends ExpressionFormatIssue {
|
|
34
|
+
nodeName: string;
|
|
35
|
+
nodeId: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function isNodeFormatIssue(issue: ExpressionFormatIssue): issue is NodeFormatIssue;
|
|
38
|
+
export interface NodeTypeError {
|
|
39
|
+
type: 'error';
|
|
40
|
+
nodeId?: string;
|
|
41
|
+
nodeName?: string;
|
|
42
|
+
message: string;
|
|
43
|
+
suggestions?: Array<{
|
|
44
|
+
nodeType: string;
|
|
45
|
+
confidence: number;
|
|
46
|
+
reason: string;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
export declare class WorkflowAutoFixer {
|
|
50
|
+
private readonly defaultConfig;
|
|
51
|
+
private similarityService;
|
|
52
|
+
constructor(repository?: NodeRepository);
|
|
53
|
+
generateFixes(workflow: Workflow, validationResult: WorkflowValidationResult, formatIssues?: ExpressionFormatIssue[], config?: Partial<AutoFixConfig>): AutoFixResult;
|
|
54
|
+
private processExpressionFormatFixes;
|
|
55
|
+
private processTypeVersionFixes;
|
|
56
|
+
private processErrorOutputFixes;
|
|
57
|
+
private processNodeTypeFixes;
|
|
58
|
+
private processWebhookPathFixes;
|
|
59
|
+
private setNestedValue;
|
|
60
|
+
private filterByConfidence;
|
|
61
|
+
private filterOperationsByFixes;
|
|
62
|
+
private calculateStats;
|
|
63
|
+
private generateSummary;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=workflow-auto-fixer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-auto-fixer.d.ts","sourceRoot":"","sources":["../../src/services/workflow-auto-fixer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EACL,qBAAqB,EAEtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAgB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAK1D,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAC3D,MAAM,MAAM,OAAO,GACf,mBAAmB,GACnB,wBAAwB,GACxB,qBAAqB,GACrB,sBAAsB,GACtB,sBAAsB,CAAC;AAE3B,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,mBAAmB,CAAC,EAAE,kBAAkB,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,kBA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