mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Refactor execution contexts to reduce code duplication, and improve type-safety (no-changelog) (#12138)
This commit is contained in:
committed by
GitHub
parent
e6985f79db
commit
ec54333f78
@@ -943,7 +943,7 @@ type BaseExecutionFunctions = FunctionsBaseWithRequiredKeys<'getMode'> & {
|
||||
getContext(type: ContextType): IContextObject;
|
||||
getExecuteData(): IExecuteData;
|
||||
getWorkflowDataProxy(itemIndex: number): IWorkflowDataProxyData;
|
||||
getInputSourceData(inputIndex?: number, inputName?: string): ISourceData;
|
||||
getInputSourceData(inputIndex?: number, connectionType?: NodeConnectionType): ISourceData;
|
||||
getExecutionCancelSignal(): AbortSignal | undefined;
|
||||
onExecutionCancellation(handler: () => unknown): void;
|
||||
logAiEvent(eventName: AiEvent, msg?: string | undefined): void;
|
||||
@@ -962,11 +962,11 @@ export type IExecuteFunctions = ExecuteFunctions.GetNodeParameterFn &
|
||||
},
|
||||
): Promise<ExecuteWorkflowData>;
|
||||
getInputConnectionData(
|
||||
inputName: NodeConnectionType,
|
||||
connectionType: NodeConnectionType,
|
||||
itemIndex: number,
|
||||
inputIndex?: number,
|
||||
): Promise<unknown>;
|
||||
getInputData(inputIndex?: number, inputName?: string): INodeExecutionData[];
|
||||
getInputData(inputIndex?: number, connectionType?: NodeConnectionType): INodeExecutionData[];
|
||||
getNodeInputs(): INodeInputConfiguration[];
|
||||
getNodeOutputs(): INodeOutputConfiguration[];
|
||||
putExecutionToWait(waitTill: Date): Promise<void>;
|
||||
@@ -1013,7 +1013,7 @@ export type IExecuteFunctions = ExecuteFunctions.GetNodeParameterFn &
|
||||
};
|
||||
|
||||
export interface IExecuteSingleFunctions extends BaseExecutionFunctions {
|
||||
getInputData(inputIndex?: number, inputName?: string): INodeExecutionData;
|
||||
getInputData(inputIndex?: number, connectionType?: NodeConnectionType): INodeExecutionData;
|
||||
getItemIndex(): number;
|
||||
getNodeParameter(
|
||||
parameterName: string,
|
||||
@@ -1127,7 +1127,7 @@ export interface IWebhookFunctions extends FunctionsBaseWithRequiredKeys<'getMod
|
||||
getBodyData(): IDataObject;
|
||||
getHeaderData(): IncomingHttpHeaders;
|
||||
getInputConnectionData(
|
||||
inputName: NodeConnectionType,
|
||||
connectionType: NodeConnectionType,
|
||||
itemIndex: number,
|
||||
inputIndex?: number,
|
||||
): Promise<unknown>;
|
||||
@@ -2372,9 +2372,6 @@ export interface IWorkflowExecuteAdditionalData {
|
||||
mode: WorkflowExecuteMode,
|
||||
envProviderState: EnvProviderState,
|
||||
executeData?: IExecuteData,
|
||||
defaultReturnRunIndex?: number,
|
||||
selfData?: IDataObject,
|
||||
contextNodeName?: string,
|
||||
): Promise<Result<T, E>>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1357,8 +1357,8 @@ export class Workflow {
|
||||
if (node.executeOnce === true) {
|
||||
// If node should be executed only once so use only the first input item
|
||||
const newInputData: ITaskDataConnections = {};
|
||||
for (const inputName of Object.keys(inputData)) {
|
||||
newInputData[inputName] = inputData[inputName].map((input) => {
|
||||
for (const connectionType of Object.keys(inputData)) {
|
||||
newInputData[connectionType] = inputData[connectionType].map((input) => {
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
return input && input.slice(0, 1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user