refactor(core): Use IWorkflowBase over WorkflowEntity in most places (#13225)

This commit is contained in:
Tomi Turtiainen
2025-02-13 10:54:11 +02:00
committed by GitHub
parent 11cf1cd23a
commit f001edb2a2
54 changed files with 190 additions and 192 deletions

View File

@@ -9,10 +9,10 @@ import type {
WorkflowExecuteMode,
WorkflowOperationError,
NodeOperationError,
IWorkflowBase,
} from 'n8n-workflow';
import { v4 as uuid } from 'uuid';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { VariablesService } from '@/environments.ee/variables/variables.service.ee';
@@ -103,7 +103,7 @@ export function getDataLastExecutedNodeData(inputData: IRun): ITaskData | undefi
/**
* Set node ids if not already set
*/
export function addNodeIds(workflow: WorkflowEntity) {
export function addNodeIds(workflow: IWorkflowBase) {
const { nodes } = workflow;
if (!nodes) return;
@@ -115,7 +115,7 @@ export function addNodeIds(workflow: WorkflowEntity) {
}
// Checking if credentials of old format are in use and run a DB check if they might exist uniquely
export async function replaceInvalidCredentials(workflow: WorkflowEntity): Promise<WorkflowEntity> {
export async function replaceInvalidCredentials<T extends IWorkflowBase>(workflow: T): Promise<T> {
const { nodes } = workflow;
if (!nodes) return workflow;