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.

24 lines (23 loc) 941 B
import { Transactionable } from '@tego/server'; import type Plugin from '../Plugin'; import type Processor from '../Processor'; import type { FlowNodeModel } from '../types'; export interface IJob { status: number; result?: unknown; [key: string]: unknown; } export type InstructionResult = IJob | Promise<IJob> | null; export type Runner = (node: FlowNodeModel, input: any, processor: Processor) => InstructionResult; export type InstructionInterface = { run: Runner; resume?: Runner; getScope?: (node: FlowNodeModel, data: any, processor: Processor) => any; duplicateConfig?: (node: FlowNodeModel, options: Transactionable) => object | Promise<object>; }; export declare abstract class Instruction implements InstructionInterface { workflow: Plugin; constructor(workflow: Plugin); abstract run(node: FlowNodeModel, input: any, processor: Processor): InstructionResult; } export default Instruction;