UNPKG

@serenity-js/core

Version:

The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure

30 lines (26 loc) 930 B
import type { JSONObject } from 'tiny-types'; import { ensure, isDefined } from 'tiny-types'; import { CorrelationId, Description } from '../model'; import { Timestamp } from '../screenplay'; import { DomainEvent } from './DomainEvent'; /** * @group Events */ export class AsyncOperationAborted extends DomainEvent { static fromJSON(o: JSONObject): AsyncOperationAborted { return new AsyncOperationAborted( Description.fromJSON(o.description as string), CorrelationId.fromJSON(o.correlationId as string), Timestamp.fromJSON(o.timestamp as string), ); } constructor( public readonly description: Description, public readonly correlationId: CorrelationId, timestamp?: Timestamp, ) { super(timestamp); ensure('description', description, isDefined()); ensure('correlationId', correlationId, isDefined()); } }