Refactor event bus and queue system; detect cycles in DI realization and make
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -1,27 +1,12 @@
|
||||
import {Event} from '../../event/Event'
|
||||
import {SecurityContext} from '../context/SecurityContext'
|
||||
import {Awaitable, JSONState} from '../../util'
|
||||
import {Authenticatable} from '../types'
|
||||
import {BaseEvent} from '../../support/bus'
|
||||
|
||||
/**
|
||||
* Event fired when a user is authenticated.
|
||||
*/
|
||||
export class AuthenticationEvent extends Event {
|
||||
export abstract class AuthenticationEvent extends BaseEvent {
|
||||
constructor(
|
||||
public readonly user: Authenticatable,
|
||||
public readonly context: SecurityContext,
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
async dehydrate(): Promise<JSONState> {
|
||||
return {
|
||||
user: await this.user.dehydrate(),
|
||||
contextName: this.context.name,
|
||||
}
|
||||
}
|
||||
|
||||
rehydrate(state: JSONState): Awaitable<void> { // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
// TODO fill this in
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,6 @@ import {AuthenticationEvent} from './AuthenticationEvent'
|
||||
/**
|
||||
* Event fired when a user is authenticated.
|
||||
*/
|
||||
export class UserAuthenticatedEvent extends AuthenticationEvent {}
|
||||
export class UserAuthenticatedEvent extends AuthenticationEvent {
|
||||
public readonly eventName = '@extollo/lib:UserAuthenticatedEvent'
|
||||
}
|
||||
|
||||
@@ -3,4 +3,6 @@ import {AuthenticationEvent} from './AuthenticationEvent'
|
||||
/**
|
||||
* Event raised when a user is re-authenticated to a security context
|
||||
*/
|
||||
export class UserAuthenticationResumedEvent extends AuthenticationEvent {}
|
||||
export class UserAuthenticationResumedEvent extends AuthenticationEvent {
|
||||
public readonly eventName = '@extollo/lib:UserAuthenticationResumedEvent'
|
||||
}
|
||||
|
||||
@@ -3,4 +3,6 @@ import {AuthenticationEvent} from './AuthenticationEvent'
|
||||
/**
|
||||
* Event fired when a user is unauthenticated.
|
||||
*/
|
||||
export class UserFlushedEvent extends AuthenticationEvent {}
|
||||
export class UserFlushedEvent extends AuthenticationEvent {
|
||||
public readonly eventName = '@extollo/lib:UserFlushedEvent'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user