@5minds/processcube_engine
Version:
The ProcessCube Engine. Stores and executes BPMNs.
158 lines (157 loc) • 5.39 kB
TypeScript
import { BpmnType, EventType, GenericFlowNodeInstanceQuery, UserTaskConfig, UserTaskConfigModel } from '@5minds/processcube_engine_sdk';
import { DataObjectValueCollection } from './DataObjectInstance';
export type PersistOnStateChangeAdditionalData = {
finishedAt?: Date;
typeData?: FlowNodeInstanceTypeSpecificData;
tokenPayload?: any;
error?: Error;
dataObjectValues?: DataObjectValueCollection;
triggeredByFlowNodeInstanceId?: string;
};
export type PersistDataObjectData = {
processDefinitionId: string;
processModelId: string;
embeddedProcessModelId?: string;
processInstanceId: string;
flowNodeInstanceId?: string;
dataObjectValues?: DataObjectValueCollection;
};
/**
* For internal use only - A generic FlowNode Instance query, coupled with the ID of the requesting user.
* Used for authorization checks.
*/
export type InternalFlowNodeInstanceQuery = GenericFlowNodeInstanceQuery & {
requestingUserEmail?: string;
requestingUserId?: string;
requestingUserName?: string;
};
export type CreateFlowNodeInstanceRequest<TTokenPayload> = {
flowNodeInstanceId: string;
flowNodeId: string;
flowNodeName?: string;
flowNodeLane?: string;
flowNodeType: BpmnType;
eventType?: EventType;
previousFlowNodeInstanceId?: string;
parentProcessInstanceId?: string;
processDefinitionId: string;
processModelId: string;
embeddedProcessModelId?: string;
processInstanceId: string;
correlationId: string;
currentToken: TTokenPayload;
multiInstanceMetadataId?: string;
ownerId: string;
flowNodeInstanceTypeData?: FlowNodeInstanceTypeSpecificData;
triggeredByFlowNodeInstanceId?: string;
};
export type FlowNodeInstanceTypeSpecificData = CallActivityInstanceData | CatchEventInstanceData | ThrowEventInstanceData | ManualTaskInstanceData | UserTaskInstanceData | ReceiveTaskInstanceData | SendTaskInstanceData | ExternalServiceTaskInstanceData | HttpServiceTaskInstanceData | SubprocessInstanceData;
export type CallActivityInstanceData = {
type: FlowNodeInstanceDataTypes.callActivity;
/**
* The ID of the Process Model that the Call Activity should start.
*/
targetProcessModelId: string;
/**
* The ID of the Start Event at which the Call Activity should start the target process.
*/
startEventId: string;
/**
* The ID of the Process Instance that the Call Activity started.
*/
childProcessInstanceId: string;
};
export type SubprocessInstanceData = {
type: FlowNodeInstanceDataTypes.subprocess;
/**
* The ID of the Process Instance that the Subprocess started.
*/
childProcessInstanceId: string;
/**
* The ID of the Start Event at which the Subprocess started.
*/
startEventId: string;
};
export type CatchEventInstanceData = {
type: FlowNodeInstanceDataTypes.catchEvent;
eventName: string;
/**
* If set, the event will only fire, if the received event is matching the specific triggerValue.
* Used by Message- and Signal- Events only.
*/
triggerValue?: string;
/**
* The ID of the FlowNodeInstance that triggered the Catch Event.
*/
triggeredByFlowNodeInstanceId?: string;
};
export type ThrowEventInstanceData = {
type: FlowNodeInstanceDataTypes.throwEvent;
eventName: string;
/**
* If set, any process triggered by this event will use the following correlation id.
* Used by Message- and Signal- Events only.
*/
customCorrelationId?: string;
};
export type ManualTaskInstanceData = {
type: FlowNodeInstanceDataTypes.manualTask;
/**
* The ID of the User that finished (aka 'resumed') the Manual Task.
*/
finishedByUserId?: string;
};
export type UserTaskInstanceData = {
type: FlowNodeInstanceDataTypes.userTask;
/**
* The ID of the User that reserved the User Task.
*/
actualOwnerId?: string;
/**
* The ID of the User that finished (aka 'resumed') the User Task.
*/
finishedByUserId?: string;
userTaskConfig?: UserTaskConfig;
userTaskConfigModel?: UserTaskConfigModel;
assignedUserIds?: Array<string>;
};
export type ReceiveTaskInstanceData = {
type: FlowNodeInstanceDataTypes.receiveTask;
/**
* The ID of the Send Task that triggered the Receive Task.
*/
triggeredByFlowNodeInstanceId?: string;
};
export type SendTaskInstanceData = {
type: FlowNodeInstanceDataTypes.sendTask;
/**
* The ID of the Send Task that triggered the Receive Task.
*/
triggeredByFlowNodeInstanceId?: string;
};
export type ExternalServiceTaskInstanceData = {
type: FlowNodeInstanceDataTypes.externalServiceTask;
externalTaskId: string;
topic: string;
isSingleTry: boolean;
state?: string;
};
export type HttpServiceTaskInstanceData = {
type: FlowNodeInstanceDataTypes.httpServiceTask;
method: string;
url: string;
body?: any;
headers?: Array<Record<string, string>>;
};
export declare enum FlowNodeInstanceDataTypes {
httpServiceTask = "HttpServiceTask",
externalServiceTask = "ExternalServiceTask",
callActivity = "CallActivity",
catchEvent = "CatchEvent",
throwEvent = "ThrowEvent",
manualTask = "ManualTask",
userTask = "UserTask",
receiveTask = "ReceiveTask",
sendTask = "SendTask",
subprocess = "Subprocess"
}