n8n/packages/cli/src/workflow-hook-context.service.ts
Konstantin Tieber 19fef9be1b
Some checks are pending
CI: Master (Build, Test, Lint) / Build for Github Cache (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (22.x) (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (24.15.0) (push) Waiting to run
CI: Master (Build, Test, Lint) / Lint (push) Waiting to run
CI: Master (Build, Test, Lint) / Performance (push) Waiting to run
CI: Master (Build, Test, Lint) / Notify Slack on failure (push) Blocked by required conditions
feat(core): Support checking for workflow tags existing in preExecute hook (#30440)
2026-05-19 18:23:18 +00:00

20 lines
510 B
TypeScript

import { TagRepository } from '@n8n/db';
import { Service } from '@n8n/di';
/**
* Exposes methods for common helpers to use in workflow lifecycle hooks.
*/
@Service()
export class WorkflowHookContextService {
constructor(private readonly tagRepository: TagRepository) {}
async getWorkflowTags(workflowId: string): Promise<string[]> {
const tags = await this.tagRepository.find({
where: { workflows: { id: workflowId } },
select: { name: true },
});
return tags.map(({ name }) => name);
}
}