Skip to content

Commit 2d9bf58

Browse files
authored
Merge pull request #1800 from mokeyish/patch-2
Allow default variable values ​​when testing CustomFunction
2 parents a134ea8 + d8af5ef commit 2d9bf58

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/server/src/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,10 @@ export class App {
324324
// execute custom function node
325325
this.app.post('/api/v1/node-custom-function', async (req: Request, res: Response) => {
326326
const body = req.body
327-
const nodeData = { inputs: body }
327+
const functionInputVariables = Object.fromEntries(
328+
[...(body?.javascriptFunction ?? '').matchAll(/\$([a-zA-Z0-9_]+)/g)].map((g) => [g[1], undefined])
329+
)
330+
const nodeData = { inputs: { functionInputVariables, ...body } }
328331
if (Object.prototype.hasOwnProperty.call(this.nodesPool.componentNodes, 'customFunction')) {
329332
try {
330333
const nodeInstanceFilePath = this.nodesPool.componentNodes['customFunction'].filePath as string

0 commit comments

Comments
 (0)