Skip to content

Commit 850e506

Browse files
authored
Merge pull request #1815 from mokeyish/patch-4
Feature: OverrideConfig allows partial override
2 parents 2290ba9 + f1c704c commit 850e506

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

packages/server/src/utils/index.ts

+27-1
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,33 @@ export const replaceInputsWithConfig = (flowNodeData: INodeData, overrideConfig:
629629
}
630630
}
631631

632-
let paramValue = overrideConfig[config] ?? inputsObj[config]
632+
let paramValue = inputsObj[config]
633+
const overrideConfigValue = overrideConfig[config]
634+
if (overrideConfigValue) {
635+
if (typeof overrideConfigValue === 'object') {
636+
switch (typeof paramValue) {
637+
case 'string':
638+
if (paramValue.startsWith('{') && paramValue.endsWith('}')) {
639+
try {
640+
paramValue = Object.assign({}, JSON.parse(paramValue), overrideConfigValue)
641+
break
642+
} catch (e) {
643+
// ignore
644+
}
645+
}
646+
paramValue = overrideConfigValue
647+
break
648+
case 'object':
649+
paramValue = Object.assign({}, paramValue, overrideConfigValue)
650+
break
651+
default:
652+
paramValue = overrideConfigValue
653+
break
654+
}
655+
} else {
656+
paramValue = overrideConfigValue
657+
}
658+
}
633659
// Check if boolean
634660
if (paramValue === 'true') paramValue = true
635661
else if (paramValue === 'false') paramValue = false

0 commit comments

Comments
 (0)