UNPKG

@tachybase/module-workflow

Version:

A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.

60 lines (59 loc) 1.99 kB
import { Logger, Transaction, Transactionable } from '@tego/server'; import type Plugin from './Plugin'; import type { ExecutionModel, FlowNodeModel, JobModel } from './types'; export interface ProcessorOptions extends Transactionable { plugin: Plugin; [key: string]: any; } export default class Processor { execution: ExecutionModel; options: ProcessorOptions; static StatusMap: { 0: 0; 1: 1; [-1]: -1; [-2]: -2; [-3]: -3; [-4]: -4; [-5]: -5; [-6]: -6; }; logger: Logger; transaction: Transaction; nodes: FlowNodeModel[]; nodesMap: Map<number, FlowNodeModel>; jobsMap: Map<number, JobModel>; jobsMapByNodeKey: { [key: string]: any; }; lastSavedJob: JobModel | null; constructor(execution: ExecutionModel, options: ProcessorOptions); private makeNodes; private makeJobs; prepare(): Promise<void>; start(): Promise<void>; resume(job: JobModel): Promise<void>; private exec; run(node: any, input?: any): any; end(node: any, job: JobModel): Promise<any>; recall(node: any, job: any): Promise<any>; exit(s?: number): Promise<any>; saveJob(payload: any): Promise<any>; getBranches(node: FlowNodeModel): FlowNodeModel[]; findBranchStartNode(node: FlowNodeModel, parent?: FlowNodeModel): FlowNodeModel | null; findBranchParentNode(node: FlowNodeModel): FlowNodeModel | null; findBranchEndNode(node: FlowNodeModel): FlowNodeModel | null; findBranchParentJob(job: JobModel, node: FlowNodeModel): JobModel | null; findBranchLastJob(node: FlowNodeModel, job: JobModel): JobModel | null; getScope(sourceNodeId: number): { $currentForm: any; $context: any; $jobsMapByNodeKey: { [key: string]: any; }; $system: {}; $scopes: {}; $env: {}; }; getParsedValue(value: any, sourceNodeId: number, additionalScope?: object): any; }