@5minds/processcube_engine
Version:
The ProcessCube Engine. Stores and executes BPMNs.
73 lines • 4.33 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StartSignalEventHandler = void 0;
const inversify_1 = require("inversify");
const processcube_engine_sdk_1 = require("@5minds/processcube_engine_sdk");
const index_1 = require("../../../Contracts/index");
const DatabaseAdaptersSequelize_1 = require("../../../Tools/DatabaseAdaptersSequelize/");
const EventMiddlewareHandler_1 = require("../../../Tools/EventMiddlewareHandler");
const ProcessInstance_1 = require("../../ProcessInstance");
const FlowNodeHandlerFactory_1 = require("../FlowNodeHandlerFactory");
const StartEventHandler_1 = require("./StartEventHandler");
let StartSignalEventHandler = class StartSignalEventHandler extends StartEventHandler_1.StartEventHandler {
constructor(eventMiddlewareHandler, flowNodeHandlerFactory, flowNodeInstanceDatabaseAdapter, startEventModel, processInstance) {
super(eventMiddlewareHandler, flowNodeHandlerFactory, flowNodeInstanceDatabaseAdapter, startEventModel, processInstance, 'signal_start_event_handler');
}
get signalStartEvent() {
return this.flowNode;
}
async persistOnTerminate() {
await super.persistOnTerminate({
type: index_1.FlowNodeInstanceDataTypes.catchEvent,
eventName: this.signalStartEvent.signalEventDefinition.name,
triggerValue: this.signalStartEvent.triggerValueInToken,
triggeredByFlowNodeInstanceId: this.triggeredByFlowNodeInstanceId,
});
}
async persistOnError(error) {
await super.persistOnError(error, {
type: index_1.FlowNodeInstanceDataTypes.catchEvent,
eventName: this.signalStartEvent.signalEventDefinition?.name,
triggerValue: this.signalStartEvent.triggerValueInToken,
triggeredByFlowNodeInstanceId: this.triggeredByFlowNodeInstanceId,
});
}
async persistOnExit() {
if (this.signalStartEvent.signalEventDefinition?.name === undefined) {
const errorToThrow = new processcube_engine_sdk_1.BadRequestError('Signal Start Event does not have a signal name assigned.', 'process');
errorToThrow.additionalInformation = {
flowNodeInstanceId: this.flowNodeInstanceId,
flowNodeId: this.signalStartEvent.id,
flowNodeName: this.signalStartEvent.name,
processInstanceId: this.processInstance.getProcessInstanceId(),
processModelId: this.processInstance.getProcessModelId(),
embeddedProcessModelId: this.processInstance.getEmbeddedProcessModelId(),
correlationId: this.processInstance.getCorrelationId(),
};
throw errorToThrow;
}
await super.persistOnExit({
type: index_1.FlowNodeInstanceDataTypes.catchEvent,
eventName: this.signalStartEvent.signalEventDefinition.name,
triggerValue: this.signalStartEvent.triggerValueInToken,
triggeredByFlowNodeInstanceId: this.triggeredByFlowNodeInstanceId,
});
}
};
exports.StartSignalEventHandler = StartSignalEventHandler;
exports.StartSignalEventHandler = StartSignalEventHandler = __decorate([
(0, inversify_1.injectable)(),
__metadata("design:paramtypes", [EventMiddlewareHandler_1.EventMiddlewareHandler,
FlowNodeHandlerFactory_1.FlowNodeHandlerFactory,
DatabaseAdaptersSequelize_1.FlowNodeInstanceDatabaseAdapter, Object, ProcessInstance_1.ProcessInstance])
], StartSignalEventHandler);
//# sourceMappingURL=StartSignalEventHandler.js.map