UNPKG

@5minds/processcube_engine

Version:

The ProcessCube Engine. Stores and executes BPMNs.

71 lines (70 loc) 3.05 kB
import { BpmnType, EventType, FlowNodeInstanceState, Identity } from '@5minds/processcube_engine_sdk'; import { SignalEventReachedMessageInternal } from '../Contracts/index'; import { IdentityService, ProcessInstanceDatabaseAdapter } from '../Tools'; import { ProcessDefinitionMediator } from '../Tools/ProcessDefinitionMediator'; import { ExecuteProcessService } from './ExecuteProcessService'; import { ProcessTokenService } from './ProcessTokenService'; export type SignalPayload = { correlationId?: string; processDefinitionId?: string; processModelId?: string; embeddedProcessModelId?: string; processModelName?: string; processInstanceId?: string; parentProcessInstanceId?: string; flowNodeId?: string; flowNodeName?: string; flowNodeType?: BpmnType; flowNodeInstanceId?: string; previousFlowNodeInstanceId?: string; processInstanceOwner?: Identity; currentToken?: any; eventType?: EventType; eventName?: string; eventId?: string; identity?: Identity; triggerValue?: string; targetProcessInstanceId?: string; customCorrelationId?: string; flowNodeInstanceState?: FlowNodeInstanceState; signalReference: string; signalChannel?: string; }; export type TriggerSignalArgs = { signalReference: string; identity: Identity; flowNodeInstanceId?: string; customCorrelationId?: string; sourceCorrelationId?: string; token?: any; triggerValue?: string; signalChannel?: string; }; export declare class SignalEventService { private executeProcessService; private readonly processDefinitionMediator; private readonly processInstanceAdapter; private readonly processTokenService; private readonly logger; private subscriptions; private internalSubscriptions; private deployedSignalCatchEvents; private internalIdentity; constructor(processDefinitionMediator: ProcessDefinitionMediator, executeProcessService: ExecuteProcessService, identityService: IdentityService, processTokenService: ProcessTokenService, processInstanceAdapter: ProcessInstanceDatabaseAdapter); init(): Promise<void>; dispose(): void; throwSignal(data: SignalPayload, awaitAcknowledgement?: boolean, eventId?: string): Promise<void>; throwStartSignal(data: SignalPayload, awaitAcknowledgement?: boolean): Promise<void>; onSignal(signalReference: string, callback: (signal: SignalEventReachedMessageInternal) => void | Promise<void>, subscribeOnce?: boolean, processInstanceId?: string, triggerValue?: string, signalChannel?: string): string; unsubscribe(subscriptionId: string): void; acknowledge(eventId: string): void; private startProcessesWithSignalStartEvent; private getEventsToStart; private filterAlreadyStartedProcessInstances; private refreshCatchEventDefinitions; private getSignalCatchEventDefinitions; private computeTriggerValuesForSignalReference; private parseTriggerValueExpressions; private getCachedEvents; private distinctTriggerValues; }