@typescript-eda/domain
Version:
Core domain primitives for event-driven architecture
218 lines • 5.27 kB
JavaScript
"use strict";
// Copyright 2025-today Semantest Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContractLearningUpdatedEvent = exports.ContractUpdatedEvent = exports.ContractExecutedEvent = exports.ContractValidatedEvent = exports.ContractDiscoveredEvent = void 0;
/**
* @fileoverview Semantic automation contract-related events
* @author Semantest Team
* @module domain/semantic-automation/events/semantest-contract-events
*/
const event_1 = require("../../event");
/**
* Event fired when a new automation contract is discovered
*/
class ContractDiscoveredEvent extends event_1.Event {
constructor(payload) {
super(payload);
}
/**
* Get the discovered contract
*/
getContract() {
return this.payload.contract;
}
/**
* Get the domain where contract was discovered
*/
getDomain() {
return this.payload.domain;
}
/**
* Get discovery method
*/
getDiscoveryMethod() {
return this.payload.discoveryMethod;
}
/**
* Get discovery confidence score
*/
getConfidence() {
return this.payload.confidence;
}
/**
* Get discovery timestamp
*/
getTimestamp() {
return this.payload.timestamp;
}
}
exports.ContractDiscoveredEvent = ContractDiscoveredEvent;
/**
* Event fired when a contract is validated
*/
class ContractValidatedEvent extends event_1.Event {
constructor(payload) {
super(payload);
}
/**
* Get contract ID
*/
getContractId() {
return this.payload.contractId;
}
/**
* Get validation result
*/
getValidationResult() {
return this.payload.validationResult;
}
/**
* Check if validation passed
*/
isValid() {
return this.payload.validationResult.valid;
}
/**
* Get validation type
*/
getValidationType() {
return this.payload.validationType;
}
}
exports.ContractValidatedEvent = ContractValidatedEvent;
/**
* Event fired when a contract capability is executed
*/
class ContractExecutedEvent extends event_1.Event {
constructor(payload) {
super(payload);
}
/**
* Get contract ID
*/
getContractId() {
return this.payload.contractId;
}
/**
* Get executed capability name
*/
getCapabilityName() {
return this.payload.capabilityName;
}
/**
* Get execution parameters
*/
getParameters() {
return this.payload.parameters;
}
/**
* Get execution result
*/
getResult() {
return this.payload.result;
}
/**
* Check if execution was successful
*/
isSuccessful() {
return this.payload.result.success;
}
/**
* Get execution time in milliseconds
*/
getExecutionTime() {
return this.payload.result.executionTime;
}
}
exports.ContractExecutedEvent = ContractExecutedEvent;
/**
* Event fired when a contract is updated
*/
class ContractUpdatedEvent extends event_1.Event {
constructor(payload) {
super(payload);
}
/**
* Get contract ID
*/
getContractId() {
return this.payload.contractId;
}
/**
* Get previous version
*/
getPreviousVersion() {
return this.payload.previousVersion;
}
/**
* Get new version
*/
getNewVersion() {
return this.payload.newVersion;
}
/**
* Get list of changes
*/
getChanges() {
return this.payload.changes;
}
/**
* Get who updated the contract
*/
getUpdatedBy() {
return this.payload.updatedBy;
}
}
exports.ContractUpdatedEvent = ContractUpdatedEvent;
/**
* Event fired when contract learning is updated through AI/ML
*/
class ContractLearningUpdatedEvent extends event_1.Event {
constructor(payload) {
super(payload);
}
/**
* Get contract ID
*/
getContractId() {
return this.payload.contractId;
}
/**
* Get learning type
*/
getLearningType() {
return this.payload.learningType;
}
/**
* Get improvement details
*/
getImprovement() {
return this.payload.improvement;
}
/**
* Check if improvement was applied automatically
*/
wasAppliedAutomatically() {
return this.payload.improvement.appliedAutomatically;
}
/**
* Get improvement confidence score
*/
getConfidence() {
return this.payload.improvement.confidence;
}
}
exports.ContractLearningUpdatedEvent = ContractLearningUpdatedEvent;
//# sourceMappingURL=semantest-contract-events.js.map