Refactor event bus and queue system; detect cycles in DI realization and make
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-01-26 19:37:54 -06:00
parent 506fb55c74
commit 6d1cf18680
69 changed files with 1673 additions and 720 deletions

View File

@@ -1,6 +1,6 @@
import {Event} from '../event/Event'
import {Awaitable, JSONState, UniversalPath} from '../util'
import {Awaitable, UniversalPath} from '../util'
import {ExtolloAwareNodeModule} from './types'
import {BaseEvent} from './bus'
/**
* An event indicating that an NPM package has been discovered
@@ -9,7 +9,7 @@ import {ExtolloAwareNodeModule} from './types'
* Application services can listen for this event to register
* various discovery logic (e.g. automatically boot units
*/
export class PackageDiscovered extends Event {
export class PackageDiscovered extends BaseEvent {
constructor(
public packageConfig: ExtolloAwareNodeModule,
public packageJson: UniversalPath,
@@ -17,17 +17,9 @@ export class PackageDiscovered extends Event {
super()
}
dehydrate(): Awaitable<JSONState> {
return {
packageConfig: this.packageConfig as JSONState,
packageJson: this.packageJson.toString(),
}
}
eventName = '@extollo/lib.PackageDiscovered'
rehydrate(state: JSONState): Awaitable<void> {
if ( typeof state === 'object' ) {
this.packageConfig = (state.packageConfig as ExtolloAwareNodeModule)
this.packageJson = new UniversalPath(String(state.packageJson))
}
shouldBroadcast(): Awaitable<boolean> {
return false
}
}