fix: Remove Request Options from sub nodes (no-changelog) (#9853)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Michael Kret
2024-06-25 14:53:31 +03:00
committed by GitHub
parent 2c0df8d467
commit 19213efc30
6 changed files with 118 additions and 31 deletions

View File

@@ -10,6 +10,7 @@ import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
import uniqBy from 'lodash/uniqBy';
import { NodeConnectionType } from './Interfaces';
import type {
FieldType,
IContextObject,
@@ -351,8 +352,31 @@ const declarativeNodeOptionParameters: INodeProperties = {
],
};
/**
* Determines if the provided node type has any output types other than the main connection type.
* @param typeDescription The node's type description to check.
*/
export function isSubNodeType(
typeDescription: Pick<INodeTypeDescription, 'outputs'> | null,
): boolean {
if (!typeDescription || !typeDescription.outputs || typeof typeDescription.outputs === 'string') {
return false;
}
const outputTypes = getConnectionTypes(typeDescription.outputs);
return outputTypes
? outputTypes.filter((output) => output !== NodeConnectionType.Main).length > 0
: false;
}
/** Augments additional `Request Options` property on declarative node-type */
export function applyDeclarativeNodeOptionParameters(nodeType: INodeType): void {
if (nodeType.execute || nodeType.trigger || nodeType.webhook || nodeType.description.polling) {
if (
nodeType.execute ||
nodeType.trigger ||
nodeType.webhook ||
nodeType.description.polling ||
isSubNodeType(nodeType.description)
) {
return;
}