CabloyJS also has a workflow engine, is that what you want?

CabloyJS also has a workflow engine, is that what you want?

Preface

As we all know, NodeJS, as a back-end development language and operating environment, is good in everything but one NodeJS工作流引擎. CabloyJS 4.0 has been developed with emphasis NodeJS工作流引擎, and as a built-in basic core module, it has further expanded the application scenarios of NodeJS in the back-end, providing basic support for the in-depth research and development of various business business logics

Features of NodeJS workflow engine

  1. Easier configuration: adopt the configuration JSONfor process definition, bid farewell to the redundancy of XML configuration files
  2. Process definition: support historical version, support enable/disable
  3. Clearer architecture: 3.core modules are used to implement the architecture of the workflow engine with a layered mechanism, so that the workflow is no longer mysterious, and the source code no longer overlaps.

Module name

Description

a-flow

Process definition, process instance

a-flownode

Process node (active node)

a-flowtask

Process task

  1. Support 业务流程and审批流程
  2. And Atom三生三世combined, built a set of Atom-based 审批工作流. See: Atomic Phase (Sansheng III)
  3. And 表单验证combination of support nodes are arranged in different processes 读取字段权限and 修改字段权限. See: form validation
  4. AOPWorkflow logic can be customized by mechanism
  5. ListenerWorkflow logic can be customized by mechanism
  6. Open architecture supports more 流程节点customized development
  7. Contains a lot of 测试驱动code, you can quickly get started using workflow

Workflow demo

  1. Create a new draft:采购订单
  2. Select the one you want to use 流程定义, then submit it, and enter the draft into the corresponding审批流程
  3. Sign for the task and process the task
  4. The process is over and the draft is converted to归档

A minimal workflow definition

src/module/test-flow/backend/src/config/static/flowDef/set00_simple.js

  {
    listener: null,
    process: {
      nodes: [
        {
          id:'startEvent_1',
          name:'Start',
          type:'startEventNone',
        },
        {
          id:'endEvent_1',
          name:'End',
          type:'endEventNone',
        },
      ],
      edges: [
        {
          id:'edge_1',
          source:'startEvent_1',
          target:'endEvent_1',
        },
      ],
    },
  }

name

Description

listener

Listener, which can monitor various events of flow/node/task

process.nodes

Process node

process.nodes.type

Process node type

process.edges

Process transfer line

process.edges.source

source

process.edges.target

Whereabouts

An approval process definition

src/module/test-flow/backend/src/config/static/flowDef/set01_atomUserTask.js

  {
    listener: null,
    process: {
      nodes: [
        {
          id:'startEvent_1',
          name:'Drafting',
          type:'startEventAtom',
          options: {
            atom: {
              module: moduleInfo.relativeName,
              atomClassName:'purchaseOrder',
            },
            conditionExpression:'atom._flowDefKey===\'set01_atomUserTask\'',
          },
        },
        {
          id:'activity_1',
          name:'Review',
          type:'activityUserTask',
          options: {
            assignees: {
             //users: '1,2',
             //roles: '1,2',
              vars:'flowUser',
            },
            confirmation: false,
            bidding: false,
            completionCondition: {
             //passed: 1,
             //rejected: '100%',
            },
           //rejectedNode:null,
           //allowRejectTask: true,
           //allowCancelFlow: false,
            schema: {
              write: [
                'atomName',
                {
                  name:'description',
                  property: {
                    type:'string',
                    ebType:'text',
                    ebTitle:'Description',
                  },
                },
              ],
            },
          },
        },
        {
          id:'endEvent_1',
          name:'End',
          type:'endEventNone',
        },
      ],
      edges: [
        {
          id:'edge_1',
          source:'startEvent_1',
          target:'activity_1',
        },
        {
          id:'edge_2',
          source:'activity_1',
          target:'endEvent_1',
        },
      ],
    },
  }
  • process.nodes.type

name

Description

startEventAtom

开始事件节点(起草): Binding to the specified Atom type through options.atom and options.conditionExpression. Automatically start the matching workflow definition when the specified Atom is submitted

activityUserTask

用户任务节点: Can specify participants, whether to bid or not, completion conditions, read field permissions, write field permissions, etc.

endEventNone

结束事件节点

Related Links

Reference: https://cloud.tencent.com/developer/article/1763733 CabloyJS also has a workflow engine, is that what you want? -Cloud + Community-Tencent Cloud