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

@@ -4,7 +4,7 @@ import { Flags } from '@oclif/core';
import fs from 'fs';
import { diff } from 'json-diff';
import pick from 'lodash/pick';
import type { IRun, ITaskData, IWorkflowExecutionDataProcess } from 'n8n-workflow';
import type { IRun, ITaskData, IWorkflowBase, IWorkflowExecutionDataProcess } from 'n8n-workflow';
import { ApplicationError, jsonParse } from 'n8n-workflow';
import os from 'os';
import { sep } from 'path';
@@ -12,7 +12,6 @@ import { sep } from 'path';
import { ActiveExecutions } from '@/active-executions';
import type { User } from '@/databases/entities/user';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import type { IWorkflowDb } from '@/interfaces';
import { OwnershipService } from '@/services/ownership.service';
import { findCliWorkflowStart } from '@/utils';
import { WorkflowRunner } from '@/workflow-runner';
@@ -275,7 +274,7 @@ export class ExecuteBatch extends BaseCommand {
query.andWhere('workflows.id not in (:...skipIds)', { skipIds });
}
const allWorkflows = (await query.getMany()) as IWorkflowDb[];
const allWorkflows = (await query.getMany()) as IWorkflowBase[];
if (ExecuteBatch.debug) {
process.stdout.write(`Found ${allWorkflows.length} workflows to execute.\n`);
@@ -378,7 +377,7 @@ export class ExecuteBatch extends BaseCommand {
});
}
private async runTests(allWorkflows: IWorkflowDb[]): Promise<IResult> {
private async runTests(allWorkflows: IWorkflowBase[]): Promise<IResult> {
const result: IResult = {
totalWorkflows: allWorkflows.length,
slackMessage: '',
@@ -401,7 +400,7 @@ export class ExecuteBatch extends BaseCommand {
const promisesArray = [];
for (let i = 0; i < ExecuteBatch.concurrency; i++) {
const promise = new Promise(async (resolve) => {
let workflow: IWorkflowDb | undefined;
let workflow: IWorkflowBase | undefined;
while (allWorkflows.length > 0) {
workflow = allWorkflows.shift();
if (ExecuteBatch.cancelled) {
@@ -563,7 +562,7 @@ export class ExecuteBatch extends BaseCommand {
}
}
async startThread(workflowData: IWorkflowDb): Promise<IExecutionResult> {
async startThread(workflowData: IWorkflowBase): Promise<IExecutionResult> {
// This will be the object returned by the promise.
// It will be updated according to execution progress below.
const executionResult: IExecutionResult = {