feat(core): Fix populating of node custom api call options (#5303)

* feat(core): Fix populating of node custom api call options

* lint fixes

* Adress PR comments

* Add e2e test and only inject custom API options for latest version

* Make sure to injectCustomApiCallOption for the latest version of node
This commit is contained in:
OlegIvaniv
2023-02-02 14:53:08 +01:00
committed by GitHub
parent 6cba652ff9
commit e58bc41d24
8 changed files with 78 additions and 85 deletions

View File

@@ -56,9 +56,12 @@ const customNodeActionsParsers: {
},
};
function filterSinglePlaceholderAction(actions: INodeActionTypeDescription[]) {
function filterActions(actions: INodeActionTypeDescription[]) {
return actions.filter(
(action: INodeActionTypeDescription, _: number, arr: INodeActionTypeDescription[]) => {
const isApiCall = action.actionKey === CUSTOM_API_CALL_KEY;
if (isApiCall) return false;
const isPlaceholderTriggerAction = action.actionKey === PLACEHOLDER_RECOMMENDED_ACTION_KEY;
return !isPlaceholderTriggerAction || (isPlaceholderTriggerAction && arr.length > 1);
},
@@ -339,7 +342,7 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, {
const filteredNodes = Object.values(mergedNodes).map((node) => ({
...node,
actions: filterSinglePlaceholderAction(node.actions || []),
actions: filterActions(node.actions || []),
}));
return filteredNodes;