UNPKG

@serenity-js/core

Version:

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

43 lines 1.58 kB
import { ensure, isDefined } from 'tiny-types'; import { Path } from '../io/index.js'; import { Artifact, CorrelationId, Name } from '../model/index.js'; import { Timestamp } from '../screenplay/index.js'; import { DomainEvent } from './DomainEvent.js'; /** * @group Events */ export class ArtifactArchived extends DomainEvent { sceneId; name; type; path; artifactTimestamp; static fromJSON(o) { return new ArtifactArchived(CorrelationId.fromJSON(o.sceneId), Name.fromJSON(o.name), Artifact.ofType(o.type), Path.fromJSON(o.path), Timestamp.fromJSON(o.artifactTimestamp), Timestamp.fromJSON(o.timestamp)); } constructor(sceneId, name, type, path, artifactTimestamp, timestamp) { super(timestamp); this.sceneId = sceneId; this.name = name; this.type = type; this.path = path; this.artifactTimestamp = artifactTimestamp; ensure('sceneId', sceneId, isDefined()); ensure('name', name, isDefined()); ensure('type', type, isDefined()); ensure('path', path, isDefined()); ensure('artifactTimestamp', artifactTimestamp, isDefined()); } toJSON() { return { sceneId: this.sceneId.toJSON(), name: this.name.toJSON(), type: this.type.name, path: this.path.toJSON(), createdAt: this.artifactTimestamp.toJSON(), timestamp: this.timestamp.toJSON(), artifactTimestamp: this.artifactTimestamp.toJSON(), }; } } //# sourceMappingURL=ArtifactArchived.js.map