mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(Code Node): Warning if pairedItem absent or could not be auto mapped (#11737)
Co-authored-by: Shireen Missi <shireen@n8n.io>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
import type { INodeExecutionData, IDataObject } from 'n8n-workflow';
|
||||
import { NodeExecutionOutput } from 'n8n-workflow';
|
||||
|
||||
export function isObject(maybe: unknown): maybe is { [key: string]: unknown } {
|
||||
return (
|
||||
@@ -36,3 +37,26 @@ export function standardizeOutput(output: IDataObject) {
|
||||
standardizeOutputRecursive(output);
|
||||
return output;
|
||||
}
|
||||
|
||||
export const addPostExecutionWarning = (
|
||||
returnData: INodeExecutionData[],
|
||||
inputItemsLength: number,
|
||||
) => {
|
||||
if (
|
||||
returnData.length !== inputItemsLength ||
|
||||
returnData.some((item) => item.pairedItem === undefined)
|
||||
) {
|
||||
return new NodeExecutionOutput(
|
||||
[returnData],
|
||||
[
|
||||
{
|
||||
message:
|
||||
'To make sure expressions after this node work, return the input items that produced each output item. <a target="_blank" href="https://docs.n8n.io/data/data-mapping/data-item-linking/item-linking-code-node/">More info</a>',
|
||||
location: 'outputPane',
|
||||
},
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return [returnData];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user