feat(core): Add support for pairedItem (beta) (#3012)

* ✨ Add pairedItem support

* 👕 Fix lint issue

* 🐛 Fix resolution in frontend

* 🐛 Fix resolution issue

* 🐛 Fix resolution in frontend

* 🐛 Fix another resolution issue in frontend

* ⚡ Try to automatically add pairedItem data if possible

* ⚡ Cleanup

* ⚡ Display expression errors in editor UI

* 🐛 Fix issue that it did not display errors in production

* 🐛 Fix auto-fix of missing pairedItem data

* 🐛 Fix frontend resolution for not executed nodes

* ⚡ Fail execution on pairedItem resolve issue and display information
about itemIndex and runIndex

* ⚡ Allow that pairedItem is only set to number if runIndex is 0

* ✨ Improve Expression Errors

* ⚡ Remove no longer needed code

* ⚡ Make errors more helpful

* ⚡ Add additional errors

* 👕 Fix lint issue

* ⚡ Add pairedItem support to core nodes

* ⚡ Improve support in Merge-Node

* ⚡ Fix issue with not correctly converted incoming pairedItem data

* 🐛 Fix frontend resolve issue

* 🐛 Fix frontend parameter name display issue

* ⚡ Improve errors

* 👕 Fix lint issue

* ⚡ Improve errors

* ⚡ Make it possible to display parameter name in error messages

* ⚡ Improve error messages

* ⚡ Fix error message

* ⚡ Improve error messages

* ⚡ Add another error message

* ⚡ Simplify
This commit is contained in:
Jan Oberhauser
2022-06-03 17:25:07 +02:00
committed by GitHub
parent 450a9aafea
commit bdb84130d6
52 changed files with 1317 additions and 152 deletions

View File

@@ -306,6 +306,11 @@ export interface ICredentialDataDecryptedObject {
// Second array index: The different connections (if one node is connected to multiple nodes)
export type NodeInputConnections = IConnection[][];
export interface INodeConnection {
sourceIndex: number;
destinationIndex: number;
}
export interface INodeConnections {
// Input name
[key: string]: NodeInputConnections;
@@ -363,6 +368,7 @@ export interface IGetExecuteFunctions {
inputData: ITaskDataConnections,
node: INode,
additionalData: IWorkflowExecuteAdditionalData,
executeData: IExecuteData,
mode: WorkflowExecuteMode,
): IExecuteFunctions;
}
@@ -377,6 +383,7 @@ export interface IGetExecuteSingleFunctions {
node: INode,
itemIndex: number,
additionalData: IWorkflowExecuteAdditionalData,
executeData: IExecuteData,
mode: WorkflowExecuteMode,
): IExecuteSingleFunctions;
}
@@ -403,9 +410,17 @@ export interface IGetExecuteWebhookFunctions {
): IWebhookFunctions;
}
export interface ISourceDataConnections {
// Key for each input type and because there can be multiple inputs of the same type it is an array
// null is also allowed because if we still need data for a later while executing the workflow set teompoary to null
// the nodes get as input TaskDataConnections which is identical to this one except that no null is allowed.
[key: string]: Array<ISourceData[] | null>;
}
export interface IExecuteData {
data: ITaskDataConnections;
node: INode;
source: ITaskDataConnectionsSource | null;
}
export type IContextObject = {
@@ -514,6 +529,7 @@ export interface IExecuteFunctions {
getWorkflowStaticData(type: string): IDataObject;
getRestApiUrl(): string;
getTimezone(): string;
getExecuteData(): IExecuteData;
getWorkflow(): IWorkflowMetadata;
prepareOutputData(
outputData: INodeExecutionData[],
@@ -553,6 +569,7 @@ export interface IExecuteSingleFunctions {
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
getRestApiUrl(): string;
getTimezone(): string;
getExecuteData(): IExecuteData;
getWorkflow(): IWorkflowMetadata;
getWorkflowDataProxy(): IWorkflowDataProxyData;
getWorkflowStaticData(type: string): IDataObject;
@@ -801,11 +818,25 @@ export interface IBinaryKeyData {
[key: string]: IBinaryData;
}
export interface IPairedItemData {
item: number;
input?: number; // If undefined "0" gets used
}
export interface INodeExecutionData {
[key: string]: IDataObject | IBinaryKeyData | NodeApiError | NodeOperationError | undefined;
[key: string]:
| IDataObject
| IBinaryKeyData
| IPairedItemData
| IPairedItemData[]
| NodeApiError
| NodeOperationError
| number
| undefined;
json: IDataObject;
binary?: IBinaryKeyData;
error?: NodeApiError | NodeOperationError;
pairedItem?: IPairedItemData | IPairedItemData[] | number;
}
export interface INodeExecuteFunctions {
@@ -1262,6 +1293,7 @@ export interface IRunExecutionData {
contextData: IExecuteContextData;
nodeExecutionStack: IExecuteData[];
waitingExecution: IWaitingForExecution;
waitingExecutionSource: IWaitingForExecutionSource | null;
};
waitTill?: Date;
}
@@ -1277,9 +1309,16 @@ export interface ITaskData {
executionTime: number;
data?: ITaskDataConnections;
error?: ExecutionError;
source: Array<ISourceData | null>; // Is an array as nodes have multiple inputs
}
// The data for al the different kind of connectons (like main) and all the indexes
export interface ISourceData {
previousNode: string;
previousNodeOutput?: number; // If undefined "0" gets used
previousNodeRun?: number; // If undefined "0" gets used
}
// The data for all the different kind of connectons (like main) and all the indexes
export interface ITaskDataConnections {
// Key for each input type and because there can be multiple inputs of the same type it is an array
// null is also allowed because if we still need data for a later while executing the workflow set teompoary to null
@@ -1296,6 +1335,21 @@ export interface IWaitingForExecution {
};
}
export interface ITaskDataConnectionsSource {
// Key for each input type and because there can be multiple inputs of the same type it is an array
// null is also allowed because if we still need data for a later while executing the workflow set teompoary to null
// the nodes get as input TaskDataConnections which is identical to this one except that no null is allowed.
[key: string]: Array<ISourceData | null>;
}
export interface IWaitingForExecutionSource {
// Node name
[key: string]: {
// Run index
[key: number]: ITaskDataConnectionsSource;
};
}
export interface IWorkflowBase {
id?: number | string | any;
name: string;