@5minds/processcube_engine
Version:
The ProcessCube Engine. Stores and executes BPMNs.
538 lines • 29.1 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
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 __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BoundaryEventHandler = void 0;
const dayjs_1 = __importDefault(require("dayjs"));
const inversify_1 = require("inversify");
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
const uuid = __importStar(require("uuid"));
const processcube_engine_sdk_1 = require("@5minds/processcube_engine_sdk");
const index_1 = require("../../../Contracts/InternalMessages/index");
const AbortablePromise_1 = require("../../../Tools/AbortablePromise");
const index_2 = require("../../../Tools/DatabaseAdaptersSequelize/index");
const EventAggregator_1 = __importDefault(require("../../../Tools/EventAggregator"));
const EventMiddlewareHandler_1 = require("../../../Tools/EventMiddlewareHandler");
const ProcessInstance_1 = require("../../ProcessInstance");
const FlowNodeHandlerFactory_1 = require("../FlowNodeHandlerFactory");
/**
* The base implementation for a BoundaryEventHandler.
*/
let BoundaryEventHandler = class BoundaryEventHandler {
attachedFlowNodeInstanceId;
processInstance;
boundaryEventModel;
processToken;
flowNodeInstanceDatabaseAdapter;
eventMiddlewareHandler;
flowNodeHandlerFactory;
boundaryEventInstanceId;
flowNodeInstance; // Only set during FlowNode resumption.
state = processcube_engine_sdk_1.FlowNodeInstanceState.running;
logger;
eventWasTriggered = false;
executionPromise;
executionFinishCallback;
startedAt;
finishedAt;
triggeredByFlowNodeInstanceId;
lastWrittenDataObjectValues;
constructor(eventMiddlewareHandler, flowNodeInstanceDatabaseAdapter, flowNodeHandlerFactory, boundaryEventModel, processInstance, processTokenOfAttachedFlowNode, namespace) {
this.eventMiddlewareHandler = eventMiddlewareHandler;
this.flowNodeInstanceDatabaseAdapter = flowNodeInstanceDatabaseAdapter;
this.flowNodeHandlerFactory = flowNodeHandlerFactory;
this.boundaryEventModel = boundaryEventModel;
this.boundaryEventInstanceId = uuid.v4();
this.processToken = processTokenOfAttachedFlowNode ? { ...processTokenOfAttachedFlowNode } : {};
this.processInstance = processInstance;
this.logger = new processcube_engine_sdk_1.Logger(namespace, {
correlationId: this.processInstance.getCorrelationId(),
processInstanceId: this.processInstance.getProcessInstanceId(),
flowNodeInstanceId: this.boundaryEventInstanceId,
flowNodeId: this.boundaryEventModel.id,
});
}
createExecutionPromise(executor) {
this.executionPromise = {
controller: new AbortController(),
isPending: true,
promise: null,
};
this.executionPromise.promise = new AbortablePromise_1.AbortablePromise((res, rej, onAbort) => {
this.executionPromise.isPending = true;
onAbort(() => {
this.executionPromise.isPending = false;
});
executor((value) => {
this.executionPromise.isPending = false;
res(value);
}, (reason) => {
this.executionPromise.isPending = false;
rej(reason);
});
}, { signal: this.executionPromise.controller.signal });
return this.executionPromise;
}
get boundaryEventInstance() {
return this.flowNodeInstance;
}
set boundaryEventInstance(boundaryEventInstance) {
this.flowNodeInstance = boundaryEventInstance;
this.state = boundaryEventInstance.state;
this.boundaryEventInstanceId = boundaryEventInstance.flowNodeInstanceId;
}
getInstanceId() {
return this.boundaryEventInstanceId;
}
getModelId() {
return this.boundaryEventModel.id;
}
getModelName() {
return this.boundaryEventModel.name;
}
getState() {
return this.boundaryEventInstance?.state ?? this.state;
}
async finish() {
if (this.state === processcube_engine_sdk_1.FlowNodeInstanceState.finished || this.state === processcube_engine_sdk_1.FlowNodeInstanceState.canceled || this.state === processcube_engine_sdk_1.FlowNodeInstanceState.error) {
return;
}
try {
this.sendBoundaryEventFinishedNotification(this.boundaryEventModel.name);
if (!this.eventWasTriggered) {
await this.cancel();
return;
}
if (!this.boundaryEventModel.cancelActivity && this.eventWasTriggered && this.executionFinishCallback != null) {
this.executionFinishCallback();
}
await this.persistOnExit();
}
catch (error) {
this.persistOnError(error);
throw error;
}
}
async cancel() {
if (this.executionPromise?.isPending) {
this.executionPromise.controller.abort();
}
if (this.state === processcube_engine_sdk_1.FlowNodeInstanceState.canceled || this.state === processcube_engine_sdk_1.FlowNodeInstanceState.finished || this.state === processcube_engine_sdk_1.FlowNodeInstanceState.error) {
return;
}
if (!this.eventWasTriggered) {
await this.persistOnCancel();
}
else {
await this.persistOnExit();
}
}
getNextFlowNode() {
const nextFlowNodes = this.processInstance.getProcessModelFacade().getNextFlowNodesFor(this.boundaryEventModel);
return nextFlowNodes && nextFlowNodes.length > 0 ? nextFlowNodes.pop() : undefined;
}
async initialize(attachedFlowNodeInstanceId, boundaryEventInstance, typeData) {
this.attachedFlowNodeInstanceId = attachedFlowNodeInstanceId;
if (!boundaryEventInstance) {
await this.runPreScript();
await this.persistOnEnter(typeData);
this.sendBoundaryEventWaitingNotification();
}
else {
this.boundaryEventInstance = boundaryEventInstance;
}
}
async saveTokenInDataObjects(token, boundaryEventModelId) {
this.lastWrittenDataObjectValues = await this.runOutgoingDataObjectExpressions(token, boundaryEventModelId);
await this.persistDataObjectValues();
}
async executeRuntimePropertyExpressionsOnFlowNode() {
const correlationMetdata = await this.setCorrelationMetadata();
const processInstanceMetadata = await this.setProcessInstanceMetadata();
return {
correlationMetdata,
processInstanceMetadata,
};
}
async postEventToEventMiddlewares(payload) {
const runtimeExpressionParameters = this.processInstance.buildRuntimeExpressionDataForFlowNodeInstance({
currentFlowNode: this.boundaryEventModel,
currentToken: this.processToken,
previousFlowNode: this.processInstance.getProcessModelFacade().getPreviousFlowNodesFor(this.boundaryEventModel)?.pop(),
allowNonObjectResults: false,
});
await this.eventMiddlewareHandler.triggerEvent((0, lodash_clonedeep_1.default)(payload), runtimeExpressionParameters);
}
async persistOnEnter(typeData) {
const flowNodeLane = this.processInstance.getProcessModelFacade().getLaneForFlowNode(this.boundaryEventModel.attachedToRef);
this.state = processcube_engine_sdk_1.FlowNodeInstanceState.running;
this.startedAt = dayjs_1.default.utc().toDate();
const request = {
flowNodeInstanceId: this.boundaryEventInstanceId,
flowNodeId: this.boundaryEventModel.id,
flowNodeType: this.boundaryEventModel.bpmnType,
flowNodeName: this.boundaryEventModel.name,
flowNodeLane: flowNodeLane?.name ?? '',
eventType: this.boundaryEventModel.eventType,
correlationId: this.processInstance.getCorrelationId(),
processDefinitionId: this.processInstance.getProcessDefinitionId(),
processModelId: this.processInstance.getProcessModelId(),
embeddedProcessModelId: this.processInstance.getEmbeddedProcessModelId(),
processInstanceId: this.processInstance.getProcessInstanceId(),
ownerId: this.processInstance.getOwner().userId,
currentToken: this.processToken,
previousFlowNodeInstanceId: this.attachedFlowNodeInstanceId,
parentProcessInstanceId: this.processInstance.getParentProcessInstance()?.getProcessInstanceId(),
flowNodeInstanceTypeData: typeData,
};
await this.flowNodeInstanceDatabaseAdapter.persistOnEnter(request);
await this.logFlowNodePersistenceEvent(processcube_engine_sdk_1.EngineEventType.OnFlowNodeEntered, processcube_engine_sdk_1.LogLevel.debug, { triggeredByFlowNodeInstanceId: this.triggeredByFlowNodeInstanceId });
}
async persistOnExit() {
this.state = processcube_engine_sdk_1.FlowNodeInstanceState.finished;
this.finishedAt = dayjs_1.default.utc().toDate();
const data = {
finishedAt: this.finishedAt,
tokenPayload: this.processToken,
triggeredByFlowNodeInstanceId: this.triggeredByFlowNodeInstanceId,
};
const metadata = await this.executeRuntimePropertyExpressionsOnFlowNode();
await this.flowNodeInstanceDatabaseAdapter.persistOnExit(this.boundaryEventInstanceId, data);
await this.logFlowNodePersistenceEvent(processcube_engine_sdk_1.EngineEventType.OnFlowNodeExited, processcube_engine_sdk_1.LogLevel.debug, {
writtenDataObjectValues: this.lastWrittenDataObjectValues,
writtenCorrelationMetadata: metadata.correlationMetdata,
writtenProcessInstanceMetadata: metadata.processInstanceMetadata,
});
}
async persistOnCancel() {
this.state = processcube_engine_sdk_1.FlowNodeInstanceState.canceled;
this.finishedAt = dayjs_1.default.utc().toDate();
const data = {
finishedAt: this.finishedAt,
tokenPayload: this.processToken,
};
await this.flowNodeInstanceDatabaseAdapter.persistOnCancel(this.boundaryEventInstanceId, data);
await this.logFlowNodePersistenceEvent(processcube_engine_sdk_1.EngineEventType.OnFlowNodeCanceled, processcube_engine_sdk_1.LogLevel.debug);
}
async persistOnError(error) {
this.state = processcube_engine_sdk_1.FlowNodeInstanceState.error;
this.finishedAt = dayjs_1.default.utc().toDate();
const data = {
finishedAt: this.finishedAt,
tokenPayload: this.processToken,
error: error,
};
await this.flowNodeInstanceDatabaseAdapter.persistOnError(this.boundaryEventInstanceId, data);
await this.logFlowNodePersistenceEvent(processcube_engine_sdk_1.EngineEventType.OnFlowNodeError, processcube_engine_sdk_1.LogLevel.error);
}
sendBoundaryEventWaitingNotification(eventName) {
const message = this.buildEventMessage(eventName);
EventAggregator_1.default.publish(index_1.eventAggregatorSettings.messagePaths.boundaryEventWaiting, message);
}
sendBoundaryEventTriggeredNotification(eventName) {
const message = this.buildEventMessage(eventName);
EventAggregator_1.default.publish(index_1.eventAggregatorSettings.messagePaths.boundaryEventTriggered, message);
}
sendBoundaryEventFinishedNotification(eventName) {
const message = this.buildEventMessage(eventName);
EventAggregator_1.default.publish(index_1.eventAggregatorSettings.messagePaths.boundaryEventFinished, message);
}
async runPreScript() {
if (!this.boundaryEventModel.preScript) {
return;
}
const result = await this.processInstance.executeRuntimeExpression({
expression: this.boundaryEventModel.preScript,
currentFlowNode: this.boundaryEventModel,
currentToken: this.processToken,
previousFlowNode: this.processInstance.getProcessModelFacade().getPreviousFlowNodesFor(this.boundaryEventModel)?.pop(),
allowNonObjectResults: false,
});
this.processToken = result ?? {};
}
async runPostScript() {
if (!this.boundaryEventModel.postScript) {
return;
}
const result = await this.processInstance.executeRuntimeExpression({
expression: this.boundaryEventModel.postScript,
currentFlowNode: this.boundaryEventModel,
currentToken: this.processToken,
previousFlowNode: this.processInstance.getProcessModelFacade().getPreviousFlowNodesFor(this.boundaryEventModel)?.pop(),
allowNonObjectResults: false,
});
this.processToken = result ?? {};
}
boundaryEventWasTriggered(flowNodeInstances) {
if (!flowNodeInstances) {
return false;
}
const boundaryEventHasFollowUps = flowNodeInstances?.some((entry) => {
return entry.previousFlowNodeInstanceId === this.boundaryEventInstanceId;
});
return boundaryEventHasFollowUps || this.boundaryEventInstance?.state === processcube_engine_sdk_1.FlowNodeInstanceState.finished;
}
async handleNextFlowNodes(flowNodeInstances) {
const nextFlowNodes = this.processInstance.getProcessModelFacade().getNextFlowNodesFor(this.boundaryEventModel);
if (!nextFlowNodes || nextFlowNodes.length === 0) {
return;
}
const nextFlowNode = nextFlowNodes[0];
const handlerForNextFlowNode = this.flowNodeHandlerFactory.create(nextFlowNode, this.processInstance);
const flowNodeInstance = flowNodeInstances?.find((fni) => fni.flowNodeId === nextFlowNode.id && fni.previousFlowNodeInstanceId === this.boundaryEventInstanceId);
if (flowNodeInstance) {
return handlerForNextFlowNode.resume(flowNodeInstance, flowNodeInstances);
}
return handlerForNextFlowNode.execute(this.boundaryEventInstanceId, this.processToken);
}
async setCorrelationMetadata() {
const correlationMetadataProperties = this.boundaryEventModel.extensionElements?.camundaExtensionProperties?.filter((property) => property.name.startsWith('engine.setCorrelationMetadata.')) ?? [];
if (!correlationMetadataProperties || correlationMetadataProperties.length == 0) {
return;
}
const changedMetaData = {};
for (const property of correlationMetadataProperties) {
const metadataKey = property.name.replace('engine.setCorrelationMetadata.', '').trim();
if (!metadataKey) {
const correlationPropertyNameMissing = new processcube_engine_sdk_1.BadRequestError("Must provide a name with 'engine.setCorrelationMetadata' expressions!", 'process');
correlationPropertyNameMissing.additionalInformation = {
processInstanceId: this.processInstance.getProcessInstanceId(),
correlationId: this.processInstance.getCorrelationId(),
flowNodeId: this.boundaryEventModel.id,
flowNodeName: this.boundaryEventModel.name,
metaDataKey: metadataKey,
};
throw correlationPropertyNameMissing;
}
changedMetaData[metadataKey] = await this.processInstance.setCorrelationMetadataValue(metadataKey, property.value, this.boundaryEventModel, this.boundaryEventInstanceId, this.processToken);
}
await this.publishCorrelationMetadataChangedNotification(changedMetaData);
return changedMetaData;
}
async setProcessInstanceMetadata() {
const processMetadataProperties = this.boundaryEventModel.extensionElements?.camundaExtensionProperties?.filter((property) => property.name.startsWith('engine.setProcessInstanceMetadata.')) ?? [];
if (!processMetadataProperties || processMetadataProperties.length == 0) {
return;
}
const changedMetaData = {};
for (const property of processMetadataProperties) {
const metadataKey = property.name.replace('engine.setProcessInstanceMetadata.', '').trim();
if (!metadataKey) {
const processInstancePropertyNameMissing = new processcube_engine_sdk_1.BadRequestError("Failure in process: Must provide a name with 'engine.setProcessInstanceMetadata' expressions!", 'process');
processInstancePropertyNameMissing.additionalInformation = {
processInstanceId: this.processInstance.getProcessInstanceId(),
correlationId: this.processInstance.getCorrelationId(),
flowNodeId: this.boundaryEventModel.id,
flowNodeName: this.boundaryEventModel.name,
metaDataKey: metadataKey,
};
throw processInstancePropertyNameMissing;
}
changedMetaData[metadataKey] = await this.processInstance.setProcessInstanceMetadataValue(metadataKey, property.value, this.boundaryEventModel, this.boundaryEventInstanceId);
}
this.publishProcessInstanceMetadataChangedNotification(changedMetaData);
return changedMetaData;
}
async logFlowNodePersistenceEvent(eventType, logLevel, additionalData = {}) {
const now = dayjs_1.default.utc().toDate();
const currentFlowNodeMetadata = processcube_engine_sdk_1.FlowNodeViewModelFactory.getViewModel(this.boundaryEventModel, {
processModelId: this.processInstance.getProcessModelId(),
processModelName: this.processInstance.getProcessModelName(),
});
await this.postEventToEventMiddlewares({
correlationId: this.processInstance.getCorrelationId(),
eventType: eventType,
flowNodeId: this.boundaryEventModel.id,
flowNodeName: this.boundaryEventModel.name,
flowNodeType: this.boundaryEventModel.bpmnType,
flowNodeLane: this.processInstance.getProcessModelFacade().getLaneForFlowNode(this.boundaryEventModel.id)?.name,
flowNodeInstanceId: this.boundaryEventInstanceId,
currentFlowNode: currentFlowNodeMetadata,
logLevel: logLevel,
processInstanceId: this.processInstance.getProcessInstanceId(),
parentProcessInstanceId: this.processInstance.getParentProcessInstance()?.getProcessInstanceId(),
processModelId: this.processInstance.getProcessModelId(),
embeddedProcessModelId: this.processInstance.getEmbeddedProcessModelId(),
processModelName: this.processInstance.getProcessModelName(),
processDefinitionId: this.processInstance.getProcessDefinitionId(),
processDefinitionHash: this.processInstance.getProcessDefinitionHash(),
timestamp: now,
flowNodeEnteredAt: this.startedAt,
flowNodeExitedAt: this.finishedAt,
processStartedAt: this.processInstance.getStartedAt(),
tokenPayload: this.processToken,
...additionalData,
});
}
publishProcessInstanceMetadataChangedNotification(changedMetadata) {
const message = {
correlationId: this.processInstance.getCorrelationId(),
processDefinitionId: this.processInstance.getProcessDefinitionId(),
processModelId: this.processInstance.getProcessModelId(),
embeddedProcessModelId: this.processInstance.getEmbeddedProcessModelId(),
processModelName: this.processInstance.getProcessModelName(),
processInstanceId: this.processInstance.getProcessInstanceId(),
flowNodeId: this.boundaryEventModel.id,
flowNodeName: this.boundaryEventModel.name,
flowNodeType: this.boundaryEventModel.bpmnType,
flowNodeLane: this.processInstance.getProcessModelFacade().getLaneForFlowNode(this.boundaryEventModel.id)?.name,
flowNodeInstanceId: this.boundaryEventInstanceId,
processInstanceOwner: this.processInstance.getOwner(),
currentToken: this.processToken ?? {},
changedMetadata: changedMetadata,
};
EventAggregator_1.default.publish(index_1.eventAggregatorSettings.messagePaths.processInstanceMetadataChanged, message);
}
async publishCorrelationMetadataChangedNotification(changedMetadata) {
const message = {
correlationId: this.processInstance.getCorrelationId(),
processDefinitionId: this.processInstance.getProcessDefinitionId(),
processModelId: this.processInstance.getProcessModelId(),
embeddedProcessModelId: this.processInstance.getEmbeddedProcessModelId(),
processModelName: this.processInstance.getProcessModelName(),
processInstanceId: this.processInstance.getProcessInstanceId(),
flowNodeId: this.boundaryEventModel.id,
flowNodeName: this.boundaryEventModel.name,
flowNodeType: this.boundaryEventModel.bpmnType,
flowNodeLane: this.processInstance.getProcessModelFacade().getLaneForFlowNode(this.boundaryEventModel.id)?.name,
flowNodeInstanceId: this.boundaryEventInstanceId,
processInstanceOwner: this.processInstance.getOwner(),
currentToken: this.processToken ?? {},
changedMetadata: changedMetadata,
};
await new Promise((resolve) => {
const publishMetadataChangesToProcessInstances = index_1.eventAggregatorSettings.messagePaths.changeCorrelationMetadata.replace(index_1.eventAggregatorSettings.messageParams.correlationId, this.processInstance.getCorrelationId());
EventAggregator_1.default.publish(publishMetadataChangesToProcessInstances, message, resolve);
});
EventAggregator_1.default.publish(index_1.eventAggregatorSettings.messagePaths.correlationMetadataChanged, message);
}
buildEventMessage(eventName) {
return {
correlationId: this.processInstance.getCorrelationId(),
processDefinitionId: this.processInstance.getProcessDefinitionId(),
processModelId: this.processInstance.getProcessModelId(),
embeddedProcessModelId: this.processInstance.getEmbeddedProcessModelId(),
processModelName: this.processInstance.getProcessModelName(),
processInstanceId: this.processInstance.getProcessInstanceId(),
parentProcessInstanceId: this.processInstance.getParentProcessInstance()?.getProcessInstanceId(),
flowNodeId: this.boundaryEventModel.id,
flowNodeName: this.boundaryEventModel.name,
flowNodeType: this.boundaryEventModel.bpmnType,
flowNodeLane: this.processInstance.getProcessModelFacade().getLaneForFlowNode(this.boundaryEventModel.id)?.name,
flowNodeInstanceId: this.boundaryEventInstanceId,
processInstanceOwner: this.processInstance.getOwner(),
currentToken: this.processToken,
eventName: eventName,
eventType: this.boundaryEventModel.eventType,
};
}
async runOutgoingDataObjectExpressions(token, boundaryEventModelId) {
if (this.executionPromise?.controller.signal.aborted) {
return;
}
const dataObjectOutputReferences = this.processInstance.getProcessModelFacade().getOutputDataObjectReferencesForFlowNode(boundaryEventModelId);
if (dataObjectOutputReferences.length === 0) {
return;
}
const dataObjectValueCollection = {};
for (const dataObjectReference of dataObjectOutputReferences) {
const dataOutputAssociation = this.boundaryEventModel.dataOutputAssociations.find((entry) => entry.targetRef === dataObjectReference.id);
const dataObjectValue = dataOutputAssociation.dataSource?.length > 0 ? await this.parseDataObjectExpression(dataOutputAssociation.dataSource, dataObjectReference.id, token) : token;
dataObjectValueCollection[dataObjectReference.id] = dataObjectValue;
this.processInstance.getDataObjectFacade().storeValue(dataObjectReference.id, dataObjectValue);
}
return dataObjectValueCollection;
}
async parseDataObjectExpression(expression, dataObjectId, token) {
try {
const payload = await this.processInstance.executeRuntimeExpression({
expression: expression,
currentFlowNode: this.boundaryEventModel,
currentToken: token,
dataObjectId: dataObjectId,
allowNonObjectResults: false,
});
return payload;
}
catch (error) {
const parserError = new processcube_engine_sdk_1.BadRequestError(`Failed to execute DataObject expression!`, error.category);
const additionalInformation = {
expression: expression,
dataObjectId: dataObjectId,
currentDataObjectValue: this.processInstance.getDataObjectFacade().getValue(dataObjectId) ?? {},
correlationId: this.processInstance.getCorrelationId(),
flowNodeInstanceId: this.boundaryEventInstanceId,
flowNodeId: this.boundaryEventModel.id,
processInstanceId: this.processInstance.getProcessInstanceId(),
originalErrorMessage: error.message,
};
parserError.additionalInformation = additionalInformation;
this.logger.error(parserError.message, additionalInformation);
throw parserError;
}
}
async persistDataObjectValues() {
if (this.executionPromise?.controller.signal.aborted) {
return;
}
return this.flowNodeInstanceDatabaseAdapter.saveDataObjectInstances({
processDefinitionId: this.processInstance.getProcessDefinitionId(),
processInstanceId: this.processInstance.getProcessInstanceId(),
processModelId: this.processInstance.getProcessModelId(),
embeddedProcessModelId: this.processInstance.getEmbeddedProcessModelId(),
dataObjectValues: this.lastWrittenDataObjectValues,
flowNodeInstanceId: this.boundaryEventInstanceId,
});
}
};
exports.BoundaryEventHandler = BoundaryEventHandler;
exports.BoundaryEventHandler = BoundaryEventHandler = __decorate([
(0, inversify_1.injectable)(),
__metadata("design:paramtypes", [EventMiddlewareHandler_1.EventMiddlewareHandler,
index_2.FlowNodeInstanceDatabaseAdapter,
FlowNodeHandlerFactory_1.FlowNodeHandlerFactory, Object, ProcessInstance_1.ProcessInstance, Object, String])
], BoundaryEventHandler);
//# sourceMappingURL=BoundaryEventHandler.js.map