import { BaseError, EngineEvent, EngineEventType, FlowNodeInstance, FlowNodeInstanceState, LogLevel, Logger, Model, Subscription } from '@5minds/processcube_engine_sdk'; import { DataObjectValueCollection, FlowNodeInstanceTypeSpecificData, OnInterruptionCallback } from '../../Contracts/InternalDataModels/index'; import { FlowNodeInstanceDatabaseAdapter } from '../../Tools/DatabaseAdaptersSequelize/index'; import { EventMiddlewareHandler } from '../../Tools/EventMiddlewareHandler'; import { ProcessInstance } from '../ProcessInstance'; import { FlowNodeHandlerFactory } from './FlowNodeHandlerFactory'; export type InternalEngineEvent = Omit; export declare abstract class FlowNodeHandler { protected readonly flowNode: TFlowNode; protected readonly processInstance: ProcessInstance; protected set flowNodeInstanceId(value: string); protected get flowNodeInstanceId(): string; protected previousFlowNodeInstanceId: string; protected state: FlowNodeInstanceState; protected processToken: Record; protected terminationSubscription: Subscription; protected processErrorSubscription: Subscription; protected tokenChangedSubscription: Subscription; protected flowNodeHandlerFactory: FlowNodeHandlerFactory; protected flowNodeInstanceAdapter: FlowNodeInstanceDatabaseAdapter; protected eventMiddlewareHandler: EventMiddlewareHandler; protected logger: Logger; protected startedAt: Date; protected finishedAt: Date; private _flowNodeInstanceId; private loggingMetaData; private interruptionCallback; constructor(eventMiddlewareHandler: EventMiddlewareHandler, flowNodeHandlerFactory: FlowNodeHandlerFactory, flowNodeInstanceAdapter: FlowNodeInstanceDatabaseAdapter, flowNode: TFlowNode, processInstance: ProcessInstance, namespace: string); /** * Gets the callback that gets called when the Flow Node was interrupted. * This happens, when an interrupting Boundary Event was triggered, or the Process Instance gets terminated. */ protected get onInterruptedCallback(): OnInterruptionCallback; protected set onInterruptedCallback(value: OnInterruptionCallback); getInstanceId(): string; getFlowNode(): TFlowNode; abstract execute(previousFlowNodeInstanceId?: string, previousResult?: any, executionCanceledCallback?: Function, triggeredByFlowNodeInstanceId?: string): Promise; abstract resume(flowNodeInstanceForHandler: FlowNodeInstance, allFlowNodeInstances: Array, executionCanceledCallback?: Function): Promise; cancel(processToken: Record): Promise; protected beforeExecute(): Promise; protected afterExecute(): Promise; /** * Hook for triggering Flow Node execution. Includes "beforeExecute" and "afterExecute" hooks. */ protected abstract startExecution(executionCanceledCallback?: Function): Promise>; /** * Hook for triggering Flow Node resumption. Includes "beforeExecute" and "afterExecute" hooks. */ protected abstract resumeFromState(flowNodeInstance: FlowNodeInstance, processFlowNodeInstances?: Array, resumptionCanceledCallback?: Function): Promise>; /** * Hook for resuming a Flow Node Handler that is currently in a suspended state. */ protected resumeAfterSuspend(flowNodeInstance: FlowNodeInstance, resumptionCanceledCallback?: Function): Promise>; /** * Main hook for executing and a FlowNode type specific handler. */ protected executeHandler(resumptionCanceledCallback?: Function): Promise>; protected persistOnEnter(previousFlowNodeInstanceIds?: Array, typeData?: TFlowNodeData): Promise; protected persistOnSuspend(updatedTokenPayload?: any, typeData?: TFlowNodeData): Promise; protected persistOnExit(typeData?: TFlowNodeData): Promise; protected persistOnCancel(typeData?: TFlowNodeData): Promise; protected persistOnTerminate(typeData?: TFlowNodeData): Promise; protected persistOnError(error: BaseError, typeData?: TFlowNodeData): Promise; protected subscribeToProcessTermination(rejectionFunction: Function): Subscription; protected subscribeToProcessError(rejectionFunction: Function): Subscription; protected subscribeToMiddlewareEvent(): void; protected handleNextFlowNode(nextFlowNode: Model.Base.FlowNode, allFlowNodeInstancesToResume?: Array): Promise; protected findNextFlowNodeInstance(allFlowNodeInstances: Array, nextFlowNodeId: string): FlowNodeInstance; protected handleError(error: BaseError, resolveCallback: Function, rejectCallback: Function): Promise; protected ensureHasClaim(): Promise; /** * Executes all expressions for updating some meta property on the containing ProcessInstance. * For example "engine.setProcessInstanceMetadata.propertyName" or "engine.setCorrelationMetadata.propertyName". * * These expressions can be found within the FlowNode's extension properties. * * @async */ protected executeRuntimePropertyExpressionsOnFlowNode(): Promise>; protected postEventToEventMiddlewares(payload: InternalEngineEvent): Promise; private setCorrelationMetadata; private setProcessInstanceMetadata; private runPreScript; protected runPostScript(): Promise; protected runOutgoingDataObjectExpressions(): Promise; private parseDataObjectExpression; protected logFlowNodePersistenceEvent(eventType: EngineEventType, logLevel: LogLevel, additionalData?: Record): Promise; private publishProcessInstanceMetadataChangedNotification; private publishCorrelationMetadataChangedNotification; }