mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): More decouplings from internal hooks (no-changelog) (#10099)
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
import { Container, Service } from 'typedi';
|
||||
import type { Variables } from '@db/entities/Variables';
|
||||
import { InternalHooks } from '@/InternalHooks';
|
||||
import { generateNanoId } from '@db/utils/generators';
|
||||
import { canCreateNewVariable } from './environmentHelpers';
|
||||
import { CacheService } from '@/services/cache/cache.service';
|
||||
import { VariablesRepository } from '@db/repositories/variables.repository';
|
||||
import { VariableCountLimitReachedError } from '@/errors/variable-count-limit-reached.error';
|
||||
import { VariableValidationError } from '@/errors/variable-validation.error';
|
||||
import { EventRelay } from '@/eventbus/event-relay.service';
|
||||
|
||||
@Service()
|
||||
export class VariablesService {
|
||||
constructor(
|
||||
protected cacheService: CacheService,
|
||||
protected variablesRepository: VariablesRepository,
|
||||
private readonly eventRelay: EventRelay,
|
||||
) {}
|
||||
|
||||
async getAllCached(): Promise<Variables[]> {
|
||||
@@ -70,7 +71,7 @@ export class VariablesService {
|
||||
}
|
||||
this.validateVariable(variable);
|
||||
|
||||
void Container.get(InternalHooks).onVariableCreated({ variable_type: variable.type });
|
||||
this.eventRelay.emit('variable-created', { variableType: variable.type });
|
||||
const saveResult = await this.variablesRepository.save(
|
||||
{
|
||||
...variable,
|
||||
|
||||
Reference in New Issue
Block a user