import { FlowNodeInstance, FlowNodeInstanceState, Logger, Model } from '@5minds/processcube_engine_sdk'; import { FlowNodeInstanceTypeSpecificData } from '../../../Contracts/InternalDataModels/index'; import { FlowNodeInstanceDatabaseAdapter } from '../../../Tools/DatabaseAdaptersSequelize/index'; import { EventMiddlewareHandler } from '../../../Tools/EventMiddlewareHandler'; import { ProcessInstance } from '../../ProcessInstance'; import { InternalEngineEvent } from '../FlowNodeHandler'; import { FlowNodeHandlerFactory } from '../FlowNodeHandlerFactory'; export type BoundaryEventTriggerData = { boundaryInstanceId: string; nextFlowNode: Model.Base.FlowNode; interruptHandler: boolean; eventPayload?: any; }; export type BoundaryEventTriggerCallback = (data: BoundaryEventTriggerData) => void | Promise; /** * The base implementation for a BoundaryEventHandler. */ export declare abstract class BoundaryEventHandler { protected attachedFlowNodeInstanceId: string; protected readonly processInstance: ProcessInstance; protected boundaryEventModel: TBoundaryEvent; protected processToken: Record; protected flowNodeInstanceDatabaseAdapter: FlowNodeInstanceDatabaseAdapter; protected eventMiddlewareHandler: EventMiddlewareHandler; protected flowNodeHandlerFactory: FlowNodeHandlerFactory; protected boundaryEventInstanceId: string; protected flowNodeInstance?: FlowNodeInstance; protected state: FlowNodeInstanceState; protected logger: Logger; eventWasTriggered: boolean; protected executionPromise: { promise: Promise; controller: AbortController; isPending: boolean; }; protected executionFinishCallback: Function; protected startedAt: Date; protected finishedAt: Date; protected triggeredByFlowNodeInstanceId: string; protected lastWrittenDataObjectValues: Record; constructor(eventMiddlewareHandler: EventMiddlewareHandler, flowNodeInstanceDatabaseAdapter: FlowNodeInstanceDatabaseAdapter, flowNodeHandlerFactory: FlowNodeHandlerFactory, boundaryEventModel: TBoundaryEvent, processInstance: ProcessInstance, processTokenOfAttachedFlowNode: Record, namespace: string); protected createExecutionPromise(executor: (resolve?: (value?: any) => void, reject?: (reason?: any) => void) => void): { promise: Promise; controller: AbortController; isPending: boolean; }; protected get boundaryEventInstance(): FlowNodeInstance; protected set boundaryEventInstance(boundaryEventInstance: FlowNodeInstance); getInstanceId(): string; getModelId(): string; getModelName(): string; getState(): FlowNodeInstanceState; abstract execute(onTriggeredCallback: BoundaryEventTriggerCallback, attachedFlowNodeInstanceId: string, decoratedFlowNodeRejectFunc: Function): Promise; abstract resume(boundaryEventInstance: FlowNodeInstance, onTriggeredCallback: BoundaryEventTriggerCallback, attachedFlowNodeInstanceId: string, decoratedFlowNodeRejectFunc: Function, flowNodeInstances?: Array): Promise; finish(): Promise; cancel(): Promise; getNextFlowNode(): Model.Base.FlowNode; protected initialize(attachedFlowNodeInstanceId: string, boundaryEventInstance?: FlowNodeInstance, typeData?: FlowNodeInstanceTypeSpecificData): Promise; protected saveTokenInDataObjects(token: Record | Array, boundaryEventModelId: string): Promise; protected executeRuntimePropertyExpressionsOnFlowNode(): Promise>; protected postEventToEventMiddlewares(payload: InternalEngineEvent): Promise; protected persistOnEnter(typeData?: FlowNodeInstanceTypeSpecificData): Promise; protected persistOnExit(): Promise; protected persistOnCancel(): Promise; protected persistOnError(error: Error): Promise; protected sendBoundaryEventWaitingNotification(eventName?: string): void; protected sendBoundaryEventTriggeredNotification(eventName?: string): void; protected sendBoundaryEventFinishedNotification(eventName?: string): void; protected runPreScript(): Promise; protected runPostScript(): Promise; protected boundaryEventWasTriggered(flowNodeInstances: Array): boolean; protected handleNextFlowNodes(flowNodeInstances?: Array): Promise; private setCorrelationMetadata; private setProcessInstanceMetadata; private logFlowNodePersistenceEvent; private publishProcessInstanceMetadataChangedNotification; private publishCorrelationMetadataChangedNotification; private buildEventMessage; private runOutgoingDataObjectExpressions; private parseDataObjectExpression; private persistDataObjectValues; }