refactor: remove startmetata

This commit is contained in:
Mutasem Aldmour 2024-11-12 12:37:51 +01:00
parent ba0502e589
commit 83abcea9ac
No known key found for this signature in database
GPG key ID: 3DFA8122BB7FD6B8
6 changed files with 24 additions and 33 deletions

View file

@ -397,13 +397,11 @@ export class RetrieverWorkflow implements INodeType {
items, items,
config?.getChild(), config?.getChild(),
{ {
startMetadata: {
parentExecution: { parentExecution: {
executionId: workflowProxy.$execution.id, executionId: workflowProxy.$execution.id,
workflowId: workflowProxy.$workflow.id, workflowId: workflowProxy.$workflow.id,
}, },
}, },
},
); );
} catch (error) { } catch (error) {
// Make sure a valid error gets returned that can by json-serialized else it will // Make sure a valid error gets returned that can by json-serialized else it will

View file

@ -455,12 +455,10 @@ export class ToolWorkflow implements INodeType {
let receivedData: ExecuteWorkflowData; let receivedData: ExecuteWorkflowData;
try { try {
receivedData = await this.executeWorkflow(workflowInfo, items, runManager?.getChild(), { receivedData = await this.executeWorkflow(workflowInfo, items, runManager?.getChild(), {
startMetadata: {
parentExecution: { parentExecution: {
executionId: workflowProxy.$execution.id, executionId: workflowProxy.$execution.id,
workflowId: workflowProxy.$workflow.id, workflowId: workflowProxy.$workflow.id,
}, },
},
}); });
subExecutionId = receivedData.executionId; subExecutionId = receivedData.executionId;
} catch (error) { } catch (error) {

View file

@ -36,8 +36,8 @@ import type {
ExecuteWorkflowOptions, ExecuteWorkflowOptions,
IWorkflowExecutionDataProcess, IWorkflowExecutionDataProcess,
EnvProviderState, EnvProviderState,
ITaskMetadata,
ExecuteWorkflowData, ExecuteWorkflowData,
RelatedExecution,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { Container } from 'typedi'; import { Container } from 'typedi';
@ -684,7 +684,7 @@ function hookFunctionsSaveWorker(): IWorkflowExecuteHooks {
export async function getRunData( export async function getRunData(
workflowData: IWorkflowBase, workflowData: IWorkflowBase,
inputData?: INodeExecutionData[], inputData?: INodeExecutionData[],
metadata?: ITaskMetadata, parentExecution?: RelatedExecution,
): Promise<IWorkflowExecutionDataProcess> { ): Promise<IWorkflowExecutionDataProcess> {
const mode = 'integrated'; const mode = 'integrated';
@ -704,7 +704,7 @@ export async function getRunData(
data: { data: {
main: [inputData], main: [inputData],
}, },
metadata, metadata: { parentExecution },
source: null, source: null,
}); });
@ -785,7 +785,7 @@ export async function executeWorkflow(
const runData = const runData =
options.loadedRunData ?? options.loadedRunData ??
(await getRunData(workflowData, options.inputData, options.startMetadata)); (await getRunData(workflowData, options.inputData, options.parentExecution));
const executionId = await activeExecutions.add(runData); const executionId = await activeExecutions.add(runData);

View file

@ -111,6 +111,7 @@ import type {
ISupplyDataFunctions, ISupplyDataFunctions,
WebhookType, WebhookType,
SchedulingFunctions, SchedulingFunctions,
RelatedExecution,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import {
NodeConnectionType, NodeConnectionType,
@ -3646,7 +3647,7 @@ export function getExecuteFunctions(
parentCallbackManager?: CallbackManager, parentCallbackManager?: CallbackManager,
options?: { options?: {
doNotWaitToFinish?: boolean; doNotWaitToFinish?: boolean;
startMetadata?: ITaskMetadata; parentExecution?: RelatedExecution;
}, },
): Promise<ExecuteWorkflowData> { ): Promise<ExecuteWorkflowData> {
return await additionalData return await additionalData
@ -3982,7 +3983,7 @@ export function getSupplyDataFunctions(
parentCallbackManager?: CallbackManager, parentCallbackManager?: CallbackManager,
options?: { options?: {
doNotWaitToFinish?: boolean; doNotWaitToFinish?: boolean;
startMetadata?: ITaskMetadata; parentExecution?: RelatedExecution;
}, },
): Promise<ExecuteWorkflowData> => ): Promise<ExecuteWorkflowData> =>
await additionalData await additionalData

View file

@ -231,13 +231,11 @@ export class ExecuteWorkflow implements INodeType {
[items[i]], [items[i]],
undefined, undefined,
{ {
startMetadata: {
parentExecution: { parentExecution: {
executionId: workflowProxy.$execution.id, executionId: workflowProxy.$execution.id,
workflowId: workflowProxy.$workflow.id, workflowId: workflowProxy.$workflow.id,
}, },
}, },
},
); );
const workflowResult = executionResult.data as INodeExecutionData[][]; const workflowResult = executionResult.data as INodeExecutionData[][];
@ -265,13 +263,11 @@ export class ExecuteWorkflow implements INodeType {
undefined, undefined,
{ {
doNotWaitToFinish: true, doNotWaitToFinish: true,
startMetadata: {
parentExecution: { parentExecution: {
executionId: workflowProxy.$execution.id, executionId: workflowProxy.$execution.id,
workflowId: workflowProxy.$workflow.id, workflowId: workflowProxy.$workflow.id,
}, },
}, },
},
); );
if (returnData.length === 0) { if (returnData.length === 0) {
@ -324,13 +320,11 @@ export class ExecuteWorkflow implements INodeType {
undefined, undefined,
{ {
doNotWaitToFinish: !waitForSubWorkflow, doNotWaitToFinish: !waitForSubWorkflow,
startMetadata: {
parentExecution: { parentExecution: {
executionId: workflowProxy.$execution.id, executionId: workflowProxy.$execution.id,
workflowId: workflowProxy.$workflow.id, workflowId: workflowProxy.$workflow.id,
}, },
}, },
},
); );
this.setMetadata({ this.setMetadata({

View file

@ -956,7 +956,7 @@ export type IExecuteFunctions = ExecuteFunctions.GetNodeParameterFn &
parentCallbackManager?: CallbackManager, parentCallbackManager?: CallbackManager,
options?: { options?: {
doNotWaitToFinish?: boolean; doNotWaitToFinish?: boolean;
startMetadata?: ITaskMetadata; parentExecution?: RelatedExecution;
}, },
): Promise<ExecuteWorkflowData>; ): Promise<ExecuteWorkflowData>;
getInputConnectionData( getInputConnectionData(
@ -2283,8 +2283,8 @@ export interface ExecuteWorkflowOptions {
loadedRunData?: IWorkflowExecutionDataProcess; loadedRunData?: IWorkflowExecutionDataProcess;
parentWorkflowSettings?: IWorkflowSettings; parentWorkflowSettings?: IWorkflowSettings;
parentCallbackManager?: CallbackManager; parentCallbackManager?: CallbackManager;
startMetadata?: ITaskMetadata;
doNotWaitToFinish?: boolean; doNotWaitToFinish?: boolean;
parentExecution?: RelatedExecution;
} }
export type AiEvent = export type AiEvent =