mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
fix: Add only necessary information to executions (no-changelog) (#6916)
* fix: Add only necessary information to executions * Fix lint * fix: lint issue --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -61,6 +61,7 @@ import type {
|
|||||||
WorkflowTagMappingRepository,
|
WorkflowTagMappingRepository,
|
||||||
} from '@db/repositories';
|
} from '@db/repositories';
|
||||||
import type { LICENSE_FEATURES, LICENSE_QUOTAS } from './constants';
|
import type { LICENSE_FEATURES, LICENSE_QUOTAS } from './constants';
|
||||||
|
import type { WorkflowWithSharingsAndCredentials } from './workflows/workflows.types';
|
||||||
|
|
||||||
export interface IActivationError {
|
export interface IActivationError {
|
||||||
time: number;
|
time: number;
|
||||||
@@ -194,7 +195,7 @@ export interface IExecutionResponse extends IExecutionBase {
|
|||||||
retryOf?: string;
|
retryOf?: string;
|
||||||
retrySuccessId?: string;
|
retrySuccessId?: string;
|
||||||
waitTill?: Date | null;
|
waitTill?: Date | null;
|
||||||
workflowData: IWorkflowBase;
|
workflowData: IWorkflowBase | WorkflowWithSharingsAndCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flatted data to save memory when saving in database or transferring
|
// Flatted data to save memory when saving in database or transferring
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { ExecutionsService } from './executions.service';
|
|||||||
import type { ExecutionRequest } from '@/requests';
|
import type { ExecutionRequest } from '@/requests';
|
||||||
import type { IExecutionResponse, IExecutionFlattedResponse } from '@/Interfaces';
|
import type { IExecutionResponse, IExecutionFlattedResponse } from '@/Interfaces';
|
||||||
import { EEWorkflowsService as EEWorkflows } from '../workflows/workflows.services.ee';
|
import { EEWorkflowsService as EEWorkflows } from '../workflows/workflows.services.ee';
|
||||||
|
import type { WorkflowWithSharingsAndCredentials } from '@/workflows/workflows.types';
|
||||||
|
|
||||||
export class EEExecutionsService extends ExecutionsService {
|
export class EEExecutionsService extends ExecutionsService {
|
||||||
/**
|
/**
|
||||||
@@ -22,13 +23,21 @@ export class EEExecutionsService extends ExecutionsService {
|
|||||||
if (!execution) return;
|
if (!execution) return;
|
||||||
|
|
||||||
const relations = ['shared', 'shared.user', 'shared.role'];
|
const relations = ['shared', 'shared.user', 'shared.role'];
|
||||||
const workflow = await EEWorkflows.get({ id: execution.workflowId }, { relations });
|
const workflow = (await EEWorkflows.get(
|
||||||
|
{ id: execution.workflowId },
|
||||||
|
{ relations },
|
||||||
|
)) as WorkflowWithSharingsAndCredentials;
|
||||||
if (!workflow) return;
|
if (!workflow) return;
|
||||||
|
|
||||||
EEWorkflows.addOwnerAndSharings(workflow);
|
EEWorkflows.addOwnerAndSharings(workflow);
|
||||||
await EEWorkflows.addCredentialsToWorkflow(workflow, req.user);
|
await EEWorkflows.addCredentialsToWorkflow(workflow, req.user);
|
||||||
|
|
||||||
execution.workflowData = workflow;
|
execution.workflowData = {
|
||||||
|
...execution.workflowData,
|
||||||
|
ownedBy: workflow.ownedBy,
|
||||||
|
sharedWith: workflow.sharedWith,
|
||||||
|
usedCredentials: workflow.usedCredentials,
|
||||||
|
} as WorkflowWithSharingsAndCredentials;
|
||||||
|
|
||||||
return execution;
|
return execution;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user