refactor(core): Rename EventRelay to EventService (no-changelog) (#10110)

This commit is contained in:
Iván Ovejero
2024-07-19 12:55:38 +02:00
committed by GitHub
parent 222a0862bd
commit aba1c64500
36 changed files with 203 additions and 195 deletions

View File

@@ -12,7 +12,7 @@ import type { SourceControlPreferences } from './types/sourceControlPreferences'
import type { SourceControlledFile } from './types/sourceControlledFile';
import { SOURCE_CONTROL_DEFAULT_BRANCH } from './constants';
import type { ImportResult } from './types/importResult';
import { EventRelay } from '@/eventbus/event-relay.service';
import { EventService } from '@/eventbus/event.service';
import { getRepoType } from './sourceControlHelper.ee';
import { SourceControlGetStatus } from './types/sourceControlGetStatus';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
@@ -22,7 +22,7 @@ export class SourceControlController {
constructor(
private readonly sourceControlService: SourceControlService,
private readonly sourceControlPreferencesService: SourceControlPreferencesService,
private readonly eventRelay: EventRelay,
private readonly eventService: EventService,
) {}
@Get('/preferences', { middlewares: [sourceControlLicensedMiddleware], skipAuth: true })
@@ -83,7 +83,7 @@ export class SourceControlController {
const resultingPreferences = this.sourceControlPreferencesService.getPreferences();
// #region Tracking Information
// located in controller so as to not call this multiple times when updating preferences
this.eventRelay.emit('source-control-settings-updated', {
this.eventService.emit('source-control-settings-updated', {
branchName: resultingPreferences.branchName,
connected: resultingPreferences.connected,
readOnlyInstance: resultingPreferences.branchReadOnly,
@@ -128,7 +128,7 @@ export class SourceControlController {
}
await this.sourceControlService.init();
const resultingPreferences = this.sourceControlPreferencesService.getPreferences();
this.eventRelay.emit('source-control-settings-updated', {
this.eventService.emit('source-control-settings-updated', {
branchName: resultingPreferences.branchName,
connected: resultingPreferences.connected,
readOnlyInstance: resultingPreferences.branchReadOnly,

View File

@@ -30,7 +30,7 @@ import type { TagEntity } from '@db/entities/TagEntity';
import type { Variables } from '@db/entities/Variables';
import type { SourceControlWorkflowVersionId } from './types/sourceControlWorkflowVersionId';
import type { ExportableCredential } from './types/exportableCredential';
import { EventRelay } from '@/eventbus/event-relay.service';
import { EventService } from '@/eventbus/event.service';
import { TagRepository } from '@db/repositories/tag.repository';
import { Logger } from '@/Logger';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
@@ -52,7 +52,7 @@ export class SourceControlService {
private sourceControlExportService: SourceControlExportService,
private sourceControlImportService: SourceControlImportService,
private tagRepository: TagRepository,
private readonly eventRelay: EventRelay,
private readonly eventService: EventService,
) {
const { gitFolder, sshFolder, sshKeyName } = sourceControlPreferencesService;
this.gitFolder = gitFolder;
@@ -292,7 +292,7 @@ export class SourceControlService {
});
// #region Tracking Information
this.eventRelay.emit(
this.eventService.emit(
'source-control-user-finished-push-ui',
getTrackingInformationFromPostPushResult(statusResult),
);
@@ -370,7 +370,7 @@ export class SourceControlService {
}
// #region Tracking Information
this.eventRelay.emit(
this.eventService.emit(
'source-control-user-finished-pull-ui',
getTrackingInformationFromPullResult(statusResult),
);
@@ -424,12 +424,12 @@ export class SourceControlService {
// #region Tracking Information
if (options.direction === 'push') {
this.eventRelay.emit(
this.eventService.emit(
'source-control-user-started-push-ui',
getTrackingInformationFromPrePushResult(sourceControlledFiles),
);
} else if (options.direction === 'pull') {
this.eventRelay.emit(
this.eventService.emit(
'source-control-user-started-pull-ui',
getTrackingInformationFromPullResult(sourceControlledFiles),
);

View File

@@ -6,14 +6,14 @@ 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';
import { EventService } from '@/eventbus/event.service';
@Service()
export class VariablesService {
constructor(
protected cacheService: CacheService,
protected variablesRepository: VariablesRepository,
private readonly eventRelay: EventRelay,
private readonly eventService: EventService,
) {}
async getAllCached(): Promise<Variables[]> {
@@ -71,7 +71,7 @@ export class VariablesService {
}
this.validateVariable(variable);
this.eventRelay.emit('variable-created', { variableType: variable.type });
this.eventService.emit('variable-created', { variableType: variable.type });
const saveResult = await this.variablesRepository.save(
{
...variable,