Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add pairedItem support [WIP] #3012

Merged
merged 39 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f82466a
:sparkles: Add pairedItem support
janober Mar 18, 2022
ca14459
:shirt: Fix lint issue
janober Mar 18, 2022
af334da
:bug: Fix resolution in frontend
janober Mar 19, 2022
36b8907
:bug: Fix resolution issue
janober Mar 19, 2022
0652c62
:bug: Fix resolution in frontend
janober Mar 19, 2022
ea1a9fc
:bug: Fix another resolution issue in frontend
janober Mar 21, 2022
ecadc55
:zap: Try to automatically add pairedItem data if possible
janober Mar 21, 2022
6084e86
:zap: Cleanup
janober Mar 24, 2022
122c126
:zap: Display expression errors in editor UI
janober Mar 24, 2022
402c019
:bug: Fix issue that it did not display errors in production
janober Mar 29, 2022
30b92c4
:bug: Fix auto-fix of missing pairedItem data
janober Mar 29, 2022
978e4c5
:bug: Fix frontend resolution for not executed nodes
janober Mar 29, 2022
5c3bf13
:twisted_rightwards_arrows: Merge branch 'master' into pairedItem-sup…
janober Apr 16, 2022
885bf38
:zap: Fail execution on pairedItem resolve issue and display information
janober Apr 16, 2022
a33a3f0
:zap: Allow that pairedItem is only set to number if runIndex is 0
janober Apr 16, 2022
5ef87ac
:sparkles: Improve Expression Errors
janober Apr 17, 2022
09cd9c3
:zap: Remove no longer needed code
janober Apr 17, 2022
87f49d5
:twisted_rightwards_arrows: Merge branch 'master' into pairedItem-sup…
janober Apr 20, 2022
ed88e36
:zap: Make errors more helpful
janober Apr 24, 2022
e2855e9
:twisted_rightwards_arrows: Merge branch 'master' into pairedItem-sup…
janober Apr 24, 2022
3015498
:zap: Add additional errors
janober Apr 24, 2022
1d0c0d3
:shirt: Fix lint issue
janober Apr 24, 2022
cf21178
:twisted_rightwards_arrows: Merge branch 'master' into pairedItem-sup…
janober Apr 27, 2022
0986c95
:zap: Add pairedItem support to core nodes
janober Apr 28, 2022
0d2a482
:zap: Improve support in Merge-Node
janober Apr 28, 2022
52bd730
:twisted_rightwards_arrows: Merge branch 'master' into pairedItem-sup…
janober Apr 29, 2022
01ec740
:zap: Fix issue with not correctly converted incoming pairedItem data
janober Apr 29, 2022
6fb1071
:bug: Fix frontend resolve issue
janober Apr 29, 2022
bcaf960
:bug: Fix frontend parameter name display issue
janober Apr 29, 2022
69d2309
:zap: Improve errors
janober Apr 30, 2022
51bad0f
:shirt: Fix lint issue
janober Apr 30, 2022
4c07e11
:zap: Improve errors
janober Apr 30, 2022
4f2f246
:twisted_rightwards_arrows: Merge branch 'master' into pairedItem-sup…
janober Jun 2, 2022
b96e702
:zap: Make it possible to display parameter name in error messages
janober Jun 2, 2022
7f011b4
:zap: Improve error messages
janober Jun 3, 2022
4e172e1
:zap: Fix error message
janober Jun 3, 2022
f832c52
:zap: Improve error messages
janober Jun 3, 2022
f97c5b1
:zap: Add another error message
janober Jun 3, 2022
42fa3dd
:zap: Simplify
janober Jun 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/cli/src/ActiveWorkflowRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ export class ActiveWorkflowRunner {
data: {
main: data,
},
source: null,
},
];

Expand All @@ -603,6 +604,7 @@ export class ActiveWorkflowRunner {
contextData: {},
nodeExecutionStack,
waitingExecution: {},
waitingExecutionSource: {},
},
};

Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/CredentialsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export class CredentialsHelper extends ICredentialsHelper {
'internal',
defaultTimezone,
additionalKeys,
undefined,
'',
);

Expand Down Expand Up @@ -366,6 +367,7 @@ export class CredentialsHelper extends ICredentialsHelper {
mode,
timezone,
{},
undefined,
false,
decryptedData,
) as ICredentialDataDecryptedObject;
Expand Down Expand Up @@ -398,6 +400,7 @@ export class CredentialsHelper extends ICredentialsHelper {
defaultTimezone,
{},
undefined,
undefined,
decryptedData,
) as ICredentialDataDecryptedObject;
}
Expand Down Expand Up @@ -642,6 +645,7 @@ export class CredentialsHelper extends ICredentialsHelper {
inputData,
runIndex,
nodeTypeCopy,
{ node, data: {}, source: null },
NodeExecuteFunctions,
credentialsDecrypted,
);
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/src/WebhookHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export async function executeWebhook(
executionMode,
additionalData.timezone,
additionalKeys,
undefined,
'onReceived',
);
const responseCode = workflow.expression.getSimpleParameterValue(
Expand All @@ -206,6 +207,7 @@ export async function executeWebhook(
executionMode,
additionalData.timezone,
additionalKeys,
undefined,
200,
) as number;

Expand All @@ -215,6 +217,7 @@ export async function executeWebhook(
executionMode,
additionalData.timezone,
additionalKeys,
undefined,
'firstEntryJson',
);

Expand Down Expand Up @@ -288,6 +291,7 @@ export async function executeWebhook(
additionalData.timezone,
additionalKeys,
undefined,
undefined,
) as {
entries?:
| Array<{
Expand Down Expand Up @@ -373,6 +377,7 @@ export async function executeWebhook(
data: {
main: webhookResultData.workflowData,
},
source: null,
});

runExecutionData =
Expand Down Expand Up @@ -546,6 +551,7 @@ export async function executeWebhook(
additionalData.timezone,
additionalKeys,
undefined,
undefined,
);

if (responsePropertyName !== undefined) {
Expand All @@ -559,6 +565,7 @@ export async function executeWebhook(
additionalData.timezone,
additionalKeys,
undefined,
undefined,
);

if (responseContentType !== undefined) {
Expand Down Expand Up @@ -603,6 +610,7 @@ export async function executeWebhook(
executionMode,
additionalData.timezone,
additionalKeys,
undefined,
'data',
);

Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/WorkflowExecuteAdditionalData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ export function hookFunctionsPreExecute(parentProcessMode?: string): IWorkflowEx
contextData: {},
nodeExecutionStack: [],
waitingExecution: {},
waitingExecutionSource: {},
},
};
}
Expand Down Expand Up @@ -752,6 +753,7 @@ export async function getRunData(
data: {
main: [inputData],
},
source: null,
});

const runExecutionData: IRunExecutionData = {
Expand All @@ -763,6 +765,7 @@ export async function getRunData(
contextData: {},
nodeExecutionStack,
waitingExecution: {},
waitingExecutionSource: {},
},
};

Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/WorkflowHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export async function executeErrorWorkflow(
],
],
},
source: null,
});

const runExecutionData: IRunExecutionData = {
Expand All @@ -200,6 +201,7 @@ export async function executeErrorWorkflow(
contextData: {},
nodeExecutionStack,
waitingExecution: {},
waitingExecutionSource: {},
},
};

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/LoadNodeParameterOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export class LoadNodeParameterOptions {
inputData,
runIndex,
tempNode,
{ node: node!, source: null, data: {} },
NodeExecuteFunctions,
);

Expand Down
26 changes: 25 additions & 1 deletion packages/core/src/NodeExecuteFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
WorkflowDataProxy,
WorkflowExecuteMode,
LoggerProxy as Logger,
IExecuteData,
} from 'n8n-workflow';

import { Agent } from 'https';
Expand Down Expand Up @@ -1447,6 +1448,7 @@ export function getNodeParameter(
mode: WorkflowExecuteMode,
timezone: string,
additionalKeys: IWorkflowDataProxyAdditionalKeys,
executeData?: IExecuteData,
fallbackValue?: any,
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object {
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
Expand All @@ -1472,11 +1474,13 @@ export function getNodeParameter(
mode,
timezone,
additionalKeys,
executeData,
);

returnData = cleanupParameterData(returnData);
} catch (e) {
e.message += ` [Error in parameter: "${parameterName}"]`;
if (e.context) e.context.parameter = parameterName;
e.cause = value;
throw e;
}

Expand Down Expand Up @@ -1543,6 +1547,7 @@ export function getNodeWebhookUrl(
mode,
timezone,
additionalKeys,
undefined,
false,
) as boolean;
return NodeHelpers.getNodeWebhookUrl(baseUrl, workflow.id!, node, path.toString(), isFullPath);
Expand Down Expand Up @@ -1673,6 +1678,7 @@ export function getExecutePollFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
undefined,
fallbackValue,
);
},
Expand Down Expand Up @@ -1827,6 +1833,7 @@ export function getExecuteTriggerFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
undefined,
fallbackValue,
);
},
Expand Down Expand Up @@ -1940,6 +1947,7 @@ export function getExecuteFunctions(
inputData: ITaskDataConnections,
node: INode,
additionalData: IWorkflowExecuteAdditionalData,
executeData: IExecuteData,
mode: WorkflowExecuteMode,
): IExecuteFunctions {
return ((workflow, runExecutionData, connectionInputData, inputData, node) => {
Expand All @@ -1959,6 +1967,7 @@ export function getExecuteFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
executeData,
);
},
async executeWorkflow(
Expand Down Expand Up @@ -2035,6 +2044,7 @@ export function getExecuteFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
executeData,
fallbackValue,
);
},
Expand All @@ -2050,6 +2060,9 @@ export function getExecuteFunctions(
getTimezone: (): string => {
return getTimezone(workflow, additionalData);
},
getExecuteData: (): IExecuteData => {
return executeData;
},
getWorkflow: () => {
return getWorkflowMetadata(workflow);
},
Expand All @@ -2065,6 +2078,7 @@ export function getExecuteFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
executeData,
);
return dataProxy.getDataProxy();
},
Expand Down Expand Up @@ -2199,6 +2213,7 @@ export function getExecuteSingleFunctions(
node: INode,
itemIndex: number,
additionalData: IWorkflowExecuteAdditionalData,
executeData: IExecuteData,
mode: WorkflowExecuteMode,
): IExecuteSingleFunctions {
return ((workflow, runExecutionData, connectionInputData, inputData, node, itemIndex) => {
Expand All @@ -2219,6 +2234,7 @@ export function getExecuteSingleFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
executeData,
);
},
getContext(type: string): IContextObject {
Expand Down Expand Up @@ -2276,6 +2292,9 @@ export function getExecuteSingleFunctions(
getTimezone: (): string => {
return getTimezone(workflow, additionalData);
},
getExecuteData: (): IExecuteData => {
return executeData;
},
getNodeParameter: (
parameterName: string,
fallbackValue?: any,
Expand All @@ -2296,6 +2315,7 @@ export function getExecuteSingleFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
executeData,
fallbackValue,
);
},
Expand All @@ -2314,6 +2334,7 @@ export function getExecuteSingleFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
executeData,
);
return dataProxy.getDataProxy();
},
Expand Down Expand Up @@ -2471,6 +2492,7 @@ export function getLoadOptionsFunctions(
'internal' as WorkflowExecuteMode,
additionalData.timezone,
getAdditionalKeys(additionalData),
undefined,
fallbackValue,
);
},
Expand Down Expand Up @@ -2601,6 +2623,7 @@ export function getExecuteHookFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
undefined,
fallbackValue,
);
},
Expand Down Expand Up @@ -2763,6 +2786,7 @@ export function getExecuteWebhookFunctions(
mode,
additionalData.timezone,
getAdditionalKeys(additionalData),
undefined,
fallbackValue,
);
},
Expand Down
Loading