refactor: application dependency management (#2363)

This commit is contained in:
Mo
2023-07-23 15:54:31 -05:00
committed by GitHub
parent e698b1c990
commit a77535456c
299 changed files with 7415 additions and 4890 deletions

View File

@@ -4,7 +4,6 @@ import { log, removeFromArray } from '@standardnotes/utils'
import { EventObserver } from '../Event/EventObserver'
import { ApplicationServiceInterface } from './ApplicationServiceInterface'
import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface'
import { ApplicationStage } from '../Application/ApplicationStage'
import { InternalEventPublishStrategy } from '../Internal/InternalEventPublishStrategy'
import { DiagnosticInfo } from '../Diagnostics/ServiceDiagnostics'
@@ -93,19 +92,14 @@ export abstract class AbstractService<EventName = string, EventData = unknown>
return promise
}
/**
* Application instances will call this function directly when they arrive
* at a certain migratory state.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async handleApplicationStage(_stage: ApplicationStage): Promise<void> {
// optional override
}
getServiceName(): string {
return this.constructor.name
}
isApplicationService(): true {
return true
}
log(..._args: unknown[]): void {
if (this.loggingEnabled) {
// eslint-disable-next-line prefer-rest-params

View File

@@ -1,4 +1,3 @@
import { ApplicationStage } from '../Application/ApplicationStage'
import { ServiceDiagnostics } from '../Diagnostics/ServiceDiagnostics'
import { EventObserver } from '../Event/EventObserver'
@@ -7,6 +6,5 @@ export interface ApplicationServiceInterface<E, D> extends ServiceDiagnostics {
addEventObserver(observer: EventObserver<E, D>): () => void
blockDeinit(): Promise<void>
deinit(): void
handleApplicationStage(stage: ApplicationStage): Promise<void>
log(message: string, ...args: unknown[]): void
}