mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
refactor(core): Abstract away duplication when finding first pinned trigger (no-changelog) (#5927)
This commit is contained in:
@@ -26,11 +26,13 @@ import type {
|
||||
IWorkflowExecutionDataProcess,
|
||||
} from '@/Interfaces';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
import config from '@/config';
|
||||
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import type { User } from '@db/entities/User';
|
||||
import omit from 'lodash/omit';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { PermissionChecker } from './UserManagement/PermissionChecker';
|
||||
import { isWorkflowIdValid } from './utils';
|
||||
import { UserService } from './user/user.service';
|
||||
@@ -575,6 +577,18 @@ export function validateWorkflowCredentialUsage(
|
||||
return newWorkflowVersion;
|
||||
}
|
||||
|
||||
export function getExecutionStartNode(data: IWorkflowExecutionDataProcess, workflow: Workflow) {
|
||||
let startNode;
|
||||
if (
|
||||
data.startNodes?.length === 1 &&
|
||||
Object.keys(data.pinData ?? {}).includes(data.startNodes[0])
|
||||
) {
|
||||
startNode = workflow.getNode(data.startNodes[0]) ?? undefined;
|
||||
}
|
||||
|
||||
return startNode;
|
||||
}
|
||||
|
||||
export async function getVariables(): Promise<IDataObject> {
|
||||
const variables = await Container.get(VariablesService).getAllCached();
|
||||
return Object.freeze(
|
||||
|
||||
Reference in New Issue
Block a user