feat(core)!: Change data processing for multi-input-nodes (#4238)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Jan Oberhauser
2023-06-23 12:07:52 +02:00
committed by GitHub
parent 9194d8bb0e
commit b8458a53f6
13 changed files with 7032 additions and 67 deletions

View File

@@ -358,8 +358,8 @@ export class Expression {
timezone: string,
additionalKeys: IWorkflowDataProxyAdditionalKeys,
executeData?: IExecuteData,
defaultValue?: boolean | number | string,
): boolean | number | string | undefined {
defaultValue?: boolean | number | string | unknown[],
): boolean | number | string | undefined | unknown[] {
if (parameterValue === undefined) {
// Value is not set so return the default
return defaultValue;

View File

@@ -1429,6 +1429,8 @@ export interface INodeTypeDescription extends INodeTypeBaseDescription {
eventTriggerDescription?: string;
activationMessage?: string;
inputs: string[];
forceInputNodeExecution?: string | boolean; // TODO: This option should be deprecated after a while
requiredInputs?: string | number[] | number;
inputNames?: string[];
outputs: string[];
outputNames?: string[];

View File

@@ -1186,11 +1186,35 @@ export class Workflow {
// because then it is a trigger node. As they only pass data through and so the input-data
// becomes output-data it has to be possible.
if (inputData.hasOwnProperty('main') && inputData.main.length > 0) {
if (inputData.main?.length > 0) {
// We always use the data of main input and the first input for execute
connectionInputData = inputData.main[0] as INodeExecutionData[];
}
let forceInputNodeExecution = nodeType.description.forceInputNodeExecution;
if (forceInputNodeExecution !== undefined) {
if (typeof forceInputNodeExecution === 'string') {
forceInputNodeExecution = !!this.expression.getSimpleParameterValue(
node,
forceInputNodeExecution,
mode,
additionalData.timezone,
{ $version: node.typeVersion },
);
}
if (!forceInputNodeExecution) {
// If the nodes do not get force executed data of some inputs may be missing
// for that reason do we use the data of the first one that contains any
for (const mainData of inputData.main) {
if (mainData?.length) {
connectionInputData = mainData;
break;
}
}
}
}
if (connectionInputData.length === 0) {
// No data for node so return
return { data: undefined };