@serenity-js/core
Version:
The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure
27 lines (23 loc) • 757 B
text/typescript
import type { JSONObject } from 'tiny-types';
import { ensure, isDefined } from 'tiny-types';
import { CorrelationId } from '../model';
import { Timestamp } from '../screenplay';
import { DomainEvent } from './DomainEvent';
/**
* @group Events
*/
export class AsyncOperationCompleted extends DomainEvent {
static fromJSON(o: JSONObject): AsyncOperationCompleted {
return new AsyncOperationCompleted(
CorrelationId.fromJSON(o.correlationId as string),
Timestamp.fromJSON(o.timestamp as string),
);
}
constructor(
public readonly correlationId: CorrelationId,
timestamp?: Timestamp,
) {
super(timestamp);
ensure('correlationId', correlationId, isDefined());
}
}