n8n-core 1.62.0 → 1.62.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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
2
|
-
import {
|
|
3
|
-
export declare function createNodeAsTool(
|
|
4
|
-
export declare function getNodeAsTool(ctx: IExecuteFunctions, node: INodeType, nodeParameters: INodeParameters): {
|
|
2
|
+
import type { IExecuteFunctions, INodeParameters, INodeType } from 'n8n-workflow';
|
|
3
|
+
export declare function createNodeAsTool(ctx: IExecuteFunctions, node: INodeType, nodeParameters: INodeParameters): {
|
|
5
4
|
response: DynamicStructuredTool<import("@langchain/core/dist/types/zod").ZodObjectAny>;
|
|
6
5
|
};
|
package/dist/CreateNodeAsTool.js
CHANGED
|
@@ -1,122 +1,282 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNodeAsTool = createNodeAsTool;
|
|
4
|
-
exports.getNodeAsTool = getNodeAsTool;
|
|
5
4
|
const tools_1 = require("@langchain/core/tools");
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
class AIParametersParser {
|
|
8
|
+
constructor(ctx) {
|
|
9
|
+
this.ctx = ctx;
|
|
10
|
+
}
|
|
11
|
+
generateZodSchema(placeholder) {
|
|
12
|
+
let schema;
|
|
13
|
+
switch (placeholder.type?.toLowerCase()) {
|
|
14
|
+
case 'string':
|
|
15
|
+
schema = zod_1.z.string();
|
|
16
|
+
break;
|
|
17
|
+
case 'number':
|
|
18
|
+
schema = zod_1.z.number();
|
|
19
|
+
break;
|
|
20
|
+
case 'boolean':
|
|
21
|
+
schema = zod_1.z.boolean();
|
|
22
|
+
break;
|
|
23
|
+
case 'json':
|
|
24
|
+
schema = zod_1.z.record(zod_1.z.any());
|
|
25
|
+
break;
|
|
26
|
+
default:
|
|
27
|
+
schema = zod_1.z.string();
|
|
28
|
+
}
|
|
29
|
+
if (placeholder.description) {
|
|
30
|
+
schema = schema.describe(`${schema.description ?? ''} ${placeholder.description}`.trim());
|
|
31
|
+
}
|
|
32
|
+
if (placeholder.defaultValue !== undefined) {
|
|
33
|
+
schema = schema.default(placeholder.defaultValue);
|
|
19
34
|
}
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
return schema;
|
|
36
|
+
}
|
|
37
|
+
traverseNodeParameters(payload, collectedArgs) {
|
|
38
|
+
if (typeof payload === 'string') {
|
|
39
|
+
const fromAICalls = this.extractFromAICalls(payload);
|
|
40
|
+
fromAICalls.forEach((call) => collectedArgs.push(call));
|
|
41
|
+
}
|
|
42
|
+
else if (Array.isArray(payload)) {
|
|
43
|
+
payload.forEach((item) => this.traverseNodeParameters(item, collectedArgs));
|
|
44
|
+
}
|
|
45
|
+
else if (typeof payload === 'object' && payload !== null) {
|
|
46
|
+
Object.values(payload).forEach((value) => this.traverseNodeParameters(value, collectedArgs));
|
|
22
47
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
48
|
+
}
|
|
49
|
+
extractFromAICalls(str) {
|
|
50
|
+
const args = [];
|
|
51
|
+
const pattern = /\$fromAI\s*\(\s*/gi;
|
|
52
|
+
let match;
|
|
53
|
+
while ((match = pattern.exec(str)) !== null) {
|
|
54
|
+
const startIndex = match.index + match[0].length;
|
|
55
|
+
let current = startIndex;
|
|
56
|
+
let inQuotes = false;
|
|
57
|
+
let quoteChar = '';
|
|
58
|
+
let parenthesesCount = 1;
|
|
59
|
+
let argsString = '';
|
|
60
|
+
while (current < str.length && parenthesesCount > 0) {
|
|
61
|
+
const char = str[current];
|
|
62
|
+
if (inQuotes) {
|
|
63
|
+
if (char === '\\' && current + 1 < str.length) {
|
|
64
|
+
argsString += char + str[current + 1];
|
|
65
|
+
current += 2;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (char === quoteChar) {
|
|
69
|
+
inQuotes = false;
|
|
70
|
+
quoteChar = '';
|
|
71
|
+
}
|
|
72
|
+
argsString += char;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
if (['"', "'", '`'].includes(char)) {
|
|
76
|
+
inQuotes = true;
|
|
77
|
+
quoteChar = char;
|
|
78
|
+
}
|
|
79
|
+
else if (char === '(') {
|
|
80
|
+
parenthesesCount++;
|
|
81
|
+
}
|
|
82
|
+
else if (char === ')') {
|
|
83
|
+
parenthesesCount--;
|
|
84
|
+
}
|
|
85
|
+
if (parenthesesCount > 0 || char !== ')') {
|
|
86
|
+
argsString += char;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
current++;
|
|
90
|
+
}
|
|
91
|
+
if (parenthesesCount === 0) {
|
|
92
|
+
try {
|
|
93
|
+
const parsedArgs = this.parseArguments(argsString);
|
|
94
|
+
args.push(parsedArgs);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
throw new n8n_workflow_1.NodeOperationError(this.ctx.getNode(), `Failed to parse $fromAI arguments: ${argsString}: ${error}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
throw new n8n_workflow_1.NodeOperationError(this.ctx.getNode(), `Unbalanced parentheses while parsing $fromAI call: ${str.slice(startIndex)}`);
|
|
26
102
|
}
|
|
27
103
|
}
|
|
104
|
+
return args;
|
|
28
105
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
106
|
+
parseArguments(argsString) {
|
|
107
|
+
const args = [];
|
|
108
|
+
let currentArg = '';
|
|
109
|
+
let inQuotes = false;
|
|
110
|
+
let quoteChar = '';
|
|
111
|
+
let escapeNext = false;
|
|
112
|
+
for (let i = 0; i < argsString.length; i++) {
|
|
113
|
+
const char = argsString[i];
|
|
114
|
+
if (escapeNext) {
|
|
115
|
+
currentArg += char;
|
|
116
|
+
escapeNext = false;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (char === '\\') {
|
|
120
|
+
escapeNext = true;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (['"', "'", '`'].includes(char)) {
|
|
124
|
+
if (!inQuotes) {
|
|
125
|
+
inQuotes = true;
|
|
126
|
+
quoteChar = char;
|
|
127
|
+
currentArg += char;
|
|
128
|
+
}
|
|
129
|
+
else if (char === quoteChar) {
|
|
130
|
+
inQuotes = false;
|
|
131
|
+
quoteChar = '';
|
|
132
|
+
currentArg += char;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
currentArg += char;
|
|
136
|
+
}
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (char === ',' && !inQuotes) {
|
|
140
|
+
args.push(currentArg.trim());
|
|
141
|
+
currentArg = '';
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
currentArg += char;
|
|
37
145
|
}
|
|
38
|
-
|
|
39
|
-
|
|
146
|
+
if (currentArg) {
|
|
147
|
+
args.push(currentArg.trim());
|
|
40
148
|
}
|
|
41
|
-
|
|
42
|
-
|
|
149
|
+
const cleanArgs = args.map((arg) => {
|
|
150
|
+
const trimmed = arg.trim();
|
|
151
|
+
if ((trimmed.startsWith("'") && trimmed.endsWith("'")) ||
|
|
152
|
+
(trimmed.startsWith('`') && trimmed.endsWith('`')) ||
|
|
153
|
+
(trimmed.startsWith('"') && trimmed.endsWith('"'))) {
|
|
154
|
+
return trimmed
|
|
155
|
+
.slice(1, -1)
|
|
156
|
+
.replace(/\\'/g, "'")
|
|
157
|
+
.replace(/\\`/g, '`')
|
|
158
|
+
.replace(/\\"/g, '"')
|
|
159
|
+
.replace(/\\\\/g, '\\');
|
|
160
|
+
}
|
|
161
|
+
return trimmed;
|
|
162
|
+
});
|
|
163
|
+
const type = cleanArgs?.[2] || 'string';
|
|
164
|
+
if (!['string', 'number', 'boolean', 'json'].includes(type.toLowerCase())) {
|
|
165
|
+
throw new n8n_workflow_1.NodeOperationError(this.ctx.getNode(), `Invalid type: ${type}`);
|
|
43
166
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
167
|
+
return {
|
|
168
|
+
key: cleanArgs[0] || '',
|
|
169
|
+
description: cleanArgs[1],
|
|
170
|
+
type: (cleanArgs?.[2] ?? 'string'),
|
|
171
|
+
defaultValue: this.parseDefaultValue(cleanArgs[3]),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
parseDefaultValue(value) {
|
|
175
|
+
if (value === undefined || value === '')
|
|
176
|
+
return undefined;
|
|
177
|
+
const lowerValue = value.toLowerCase();
|
|
178
|
+
if (lowerValue === 'true')
|
|
179
|
+
return true;
|
|
180
|
+
if (lowerValue === 'false')
|
|
181
|
+
return false;
|
|
182
|
+
if (!isNaN(Number(value)))
|
|
183
|
+
return Number(value);
|
|
184
|
+
try {
|
|
185
|
+
return (0, n8n_workflow_1.jsonParse)(value);
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
return value;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
getDescription(node, nodeParameters) {
|
|
192
|
+
const manualDescription = nodeParameters.toolDescription;
|
|
193
|
+
if (nodeParameters.descriptionType === 'auto') {
|
|
194
|
+
const resource = nodeParameters.resource;
|
|
195
|
+
const operation = nodeParameters.operation;
|
|
196
|
+
let description = node.description.description;
|
|
197
|
+
if (resource) {
|
|
198
|
+
description += `\n Resource: ${resource}`;
|
|
58
199
|
}
|
|
59
|
-
|
|
200
|
+
if (operation) {
|
|
201
|
+
description += `\n Operation: ${operation}`;
|
|
202
|
+
}
|
|
203
|
+
return description.trim();
|
|
204
|
+
}
|
|
205
|
+
if (nodeParameters.descriptionType === 'manual') {
|
|
206
|
+
return manualDescription ?? node.description.description;
|
|
60
207
|
}
|
|
61
|
-
|
|
62
|
-
current[lastKey ?? matchingKey] = values[matchingKey];
|
|
208
|
+
return node.description.description;
|
|
63
209
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
210
|
+
createTool(node, nodeParameters) {
|
|
211
|
+
const collectedArguments = [];
|
|
212
|
+
this.traverseNodeParameters(nodeParameters, collectedArguments);
|
|
213
|
+
const nameValidationRegex = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
214
|
+
const keyMap = new Map();
|
|
215
|
+
for (const argument of collectedArguments) {
|
|
216
|
+
if (argument.key.length === 0 || !nameValidationRegex.test(argument.key)) {
|
|
217
|
+
const isEmptyError = 'You must specify a key when using $fromAI()';
|
|
218
|
+
const isInvalidError = `Parameter key \`${argument.key}\` is invalid`;
|
|
219
|
+
const error = new Error(argument.key.length === 0 ? isEmptyError : isInvalidError);
|
|
220
|
+
throw new n8n_workflow_1.NodeOperationError(this.ctx.getNode(), error, {
|
|
221
|
+
description: 'Invalid parameter key, must be between 1 and 64 characters long and only contain letters, numbers, underscores, and hyphens',
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
if (keyMap.has(argument.key)) {
|
|
225
|
+
const existingArg = keyMap.get(argument.key);
|
|
226
|
+
if (existingArg.description !== argument.description ||
|
|
227
|
+
existingArg.type !== argument.type) {
|
|
228
|
+
throw new n8n_workflow_1.NodeOperationError(this.ctx.getNode(), `Duplicate key '${argument.key}' found with different description or type`, {
|
|
229
|
+
description: 'Ensure all $fromAI() calls with the same key have consistent descriptions and types',
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
keyMap.set(argument.key, argument);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const uniqueArgsMap = collectedArguments.reduce((map, arg) => {
|
|
238
|
+
map.set(arg.key, arg);
|
|
239
|
+
return map;
|
|
240
|
+
}, new Map());
|
|
241
|
+
const uniqueArguments = Array.from(uniqueArgsMap.values());
|
|
242
|
+
const schemaObj = uniqueArguments.reduce((acc, placeholder) => {
|
|
243
|
+
acc[placeholder.key] = this.generateZodSchema(placeholder);
|
|
244
|
+
return acc;
|
|
245
|
+
}, {});
|
|
246
|
+
const schema = zod_1.z.object(schemaObj).required();
|
|
247
|
+
const description = this.getDescription(node, nodeParameters);
|
|
248
|
+
const nodeName = this.ctx.getNode().name.replace(/ /g, '_');
|
|
249
|
+
const name = nodeName || node.description.name;
|
|
250
|
+
const tool = new tools_1.DynamicStructuredTool({
|
|
251
|
+
name,
|
|
252
|
+
description,
|
|
253
|
+
schema,
|
|
254
|
+
func: async (functionArgs) => {
|
|
255
|
+
const { index } = this.ctx.addInputData("ai_tool", [
|
|
256
|
+
[{ json: functionArgs }],
|
|
257
|
+
]);
|
|
258
|
+
try {
|
|
259
|
+
const result = await node.execute?.bind(this.ctx)();
|
|
260
|
+
const mappedResults = result?.[0]?.flatMap((item) => item.json);
|
|
261
|
+
this.ctx.addOutputData("ai_tool", index, [
|
|
262
|
+
[{ json: { response: mappedResults } }],
|
|
263
|
+
]);
|
|
264
|
+
return JSON.stringify(mappedResults);
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
const nodeError = new n8n_workflow_1.NodeOperationError(this.ctx.getNode(), error);
|
|
268
|
+
this.ctx.addOutputData("ai_tool", index, nodeError);
|
|
269
|
+
return 'Error during node execution: ' + nodeError.description;
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
});
|
|
273
|
+
return tool;
|
|
76
274
|
}
|
|
77
|
-
const schema = zod_1.z.object(schemaObj).required();
|
|
78
|
-
const toolDescription = ctx.getNodeParameter('toolDescription', 0, node.description.description);
|
|
79
|
-
const tool = new tools_1.DynamicStructuredTool({
|
|
80
|
-
name: node.description.name,
|
|
81
|
-
description: toolDescription ? toolDescription : node.description.description,
|
|
82
|
-
schema,
|
|
83
|
-
func: async (functionArgs) => {
|
|
84
|
-
const ctxProxy = new Proxy(ctx, {
|
|
85
|
-
get(target, prop, receiver) {
|
|
86
|
-
if (prop === 'getNodeParameter') {
|
|
87
|
-
return new Proxy(target.getNodeParameter, {
|
|
88
|
-
apply(targetMethod, thisArg, argumentsList) {
|
|
89
|
-
const [key] = argumentsList;
|
|
90
|
-
if (typeof key !== 'string') {
|
|
91
|
-
return Reflect.apply(targetMethod, thisArg, argumentsList);
|
|
92
|
-
}
|
|
93
|
-
const encodedKey = encodeDotNotation(key);
|
|
94
|
-
const matchingKeys = Array.from(placeholderValues.keys()).filter((k) => k.startsWith(encodedKey));
|
|
95
|
-
if (matchingKeys.length > 0) {
|
|
96
|
-
const res = buildStructureFromMatches(encodedKey, matchingKeys, functionArgs);
|
|
97
|
-
return res?.[decodeDotNotation(key)] ?? res;
|
|
98
|
-
}
|
|
99
|
-
return Reflect.apply(targetMethod, thisArg, argumentsList);
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
return Reflect.get(target, prop, receiver);
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
ctxProxy.addInputData("ai_tool", [[{ json: functionArgs }]]);
|
|
107
|
-
const result = await node.execute?.bind(ctxProxy)();
|
|
108
|
-
const mappedResults = result?.[0]?.flatMap((item) => item.json);
|
|
109
|
-
ctxProxy.addOutputData("ai_tool", 0, [
|
|
110
|
-
[{ json: { response: mappedResults } }],
|
|
111
|
-
]);
|
|
112
|
-
return JSON.stringify(mappedResults);
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
return tool;
|
|
116
275
|
}
|
|
117
|
-
function
|
|
276
|
+
function createNodeAsTool(ctx, node, nodeParameters) {
|
|
277
|
+
const parser = new AIParametersParser(ctx);
|
|
118
278
|
return {
|
|
119
|
-
response:
|
|
279
|
+
response: parser.createTool(node, nodeParameters),
|
|
120
280
|
};
|
|
121
281
|
}
|
|
122
282
|
//# sourceMappingURL=CreateNodeAsTool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateNodeAsTool.js","sourceRoot":"","sources":["../src/CreateNodeAsTool.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"CreateNodeAsTool.js","sourceRoot":"","sources":["../src/CreateNodeAsTool.ts"],"names":[],"mappings":";;AAwaA,4CAUC;AAlbD,iDAA8D;AAE9D,+CAAiF;AACjF,6BAAwB;AAgBxB,MAAM,kBAAkB;IAOvB,YAAY,GAAsB;QACjC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,CAAC;IAOO,iBAAiB,CAAC,WAA2B;QACpD,IAAI,MAAoB,CAAC;QAEzB,QAAQ,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC;YACzC,KAAK,QAAQ;gBACZ,MAAM,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC;gBACpB,MAAM;YACP,KAAK,QAAQ;gBACZ,MAAM,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC;gBACpB,MAAM;YACP,KAAK,SAAS;gBACb,MAAM,GAAG,OAAC,CAAC,OAAO,EAAE,CAAC;gBACrB,MAAM;YACP,KAAK,MAAM;gBACV,MAAM,GAAG,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC,CAAC;gBAC3B,MAAM;YACP;gBACC,MAAM,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC;QACtB,CAAC;QAED,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;YAC7B,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,MAA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,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAGhE,IAAI,CAAC,GAAG,CAAC,aAAa,YAA4B,KAAK,EAAE;wBACxD,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,CAAC;qBACvC,CAAC,CAAC;oBAGH,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;gBACtC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,MAAM,SAAS,GAAG,IAAI,iCAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,KAAc,CAAC,CAAC;oBAC7E,IAAI,CAAC,GAAG,CAAC,aAAa,YAA4B,KAAK,EAAE,SAAS,CAAC,CAAC;oBACpE,OAAO,+BAA+B,GAAG,SAAS,CAAC,WAAW,CAAC;gBAChE,CAAC;YACF,CAAC;SACD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAYD,SAAgB,gBAAgB,CAC/B,GAAsB,EACtB,IAAe,EACf,cAA+B;IAE/B,MAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO;QACN,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC;KACjD,CAAC;AACH,CAAC"}
|
|
@@ -1818,7 +1818,7 @@ async function getInputConnectionData(workflow, runExecutionData, runIndex, conn
|
|
|
1818
1818
|
if (!nodeType.supplyData) {
|
|
1819
1819
|
if (nodeType.description.outputs.includes("ai_tool")) {
|
|
1820
1820
|
nodeType.supplyData = async function () {
|
|
1821
|
-
return (0, CreateNodeAsTool_1.
|
|
1821
|
+
return (0, CreateNodeAsTool_1.createNodeAsTool)(this, nodeType, this.getNode().parameters);
|
|
1822
1822
|
};
|
|
1823
1823
|
}
|
|
1824
1824
|
else {
|