@nocobase/plugin-workflow 0.7.0-alpha.58 → 0.7.0-alpha.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,57 +12,49 @@ var _default = {
12
12
  name: 'key',
13
13
  type: 'uid'
14
14
  }, {
15
- interface: 'string',
16
15
  type: 'string',
17
16
  name: 'title',
18
17
  title: '工作流名称',
19
18
  required: true
20
19
  }, {
21
- interface: 'boolean',
22
20
  type: 'boolean',
23
21
  name: 'enabled',
24
22
  title: '启用',
25
23
  defaultValue: false
26
24
  }, {
27
- interface: 'textarea',
28
25
  type: 'text',
29
26
  name: 'description',
30
27
  title: '描述'
31
28
  }, {
32
- interface: 'select',
33
29
  type: 'string',
34
30
  title: '触发方式',
35
31
  name: 'type',
36
32
  required: true
37
33
  }, {
38
- interface: 'json',
39
34
  type: 'jsonb',
40
35
  title: '触发配置',
41
36
  name: 'config',
42
37
  required: true,
43
38
  defaultValue: {}
44
39
  }, {
45
- interface: 'boolean',
46
40
  type: 'boolean',
47
41
  title: '使用事务',
48
42
  name: 'useTransaction',
49
43
  defaultValue: true
50
44
  }, {
51
- interface: 'linkTo',
52
45
  type: 'hasMany',
53
46
  name: 'nodes',
54
47
  target: 'flow_nodes',
55
48
  title: '流程节点'
56
49
  }, {
57
- interface: 'linkTo',
58
50
  type: 'hasMany',
59
51
  name: 'executions',
60
52
  target: 'executions',
61
53
  title: '触发执行'
62
54
  }, {
63
- type: 'boolean',
55
+ type: 'integer',
64
56
  name: 'executed',
65
- defaultValue: false
57
+ defaultValue: 0
66
58
  }, {
67
59
  type: 'boolean',
68
60
  name: 'current',
@@ -11,7 +11,7 @@ export default class WorkflowModel extends Model {
11
11
  type: string;
12
12
  config: any;
13
13
  useTransaction: boolean;
14
- executed: boolean;
14
+ executed: number;
15
15
  createdAt: Date;
16
16
  updatedAt: Date;
17
17
  nodes: FlowNodeModel[];
@@ -59,21 +59,20 @@ class WorkflowModel extends _database().Model {
59
59
  }, {
60
60
  transaction
61
61
  });
62
+ const executed = yield _this.countExecutions({
63
+ transaction
64
+ }); // NOTE: not to trigger afterUpdate hook here
65
+
66
+ yield _this.update({
67
+ executed
68
+ }, {
69
+ transaction,
70
+ hooks: false
71
+ });
62
72
  execution.workflow = _this;
63
73
  yield execution.start({
64
74
  transaction
65
- });
66
-
67
- if (!_this.executed) {
68
- // NOTE: not to trigger afterUpdate hook here
69
- yield _this.update({
70
- executed: true
71
- }, {
72
- transaction,
73
- hooks: false
74
- });
75
- } // @ts-ignore
76
-
75
+ }); // @ts-ignore
77
76
 
78
77
  if (transaction && (!options.transaction || options.transaction.finished)) {
79
78
  yield transaction.commit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-workflow",
3
- "version": "0.7.0-alpha.58",
3
+ "version": "0.7.0-alpha.59",
4
4
  "main": "lib/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "licenses": [
@@ -10,14 +10,14 @@
10
10
  }
11
11
  ],
12
12
  "dependencies": {
13
- "@nocobase/actions": "0.7.0-alpha.58",
14
- "@nocobase/database": "0.7.0-alpha.58",
15
- "@nocobase/server": "0.7.0-alpha.58",
16
- "@nocobase/utils": "0.7.0-alpha.58",
13
+ "@nocobase/actions": "0.7.0-alpha.59",
14
+ "@nocobase/database": "0.7.0-alpha.59",
15
+ "@nocobase/server": "0.7.0-alpha.59",
16
+ "@nocobase/utils": "0.7.0-alpha.59",
17
17
  "json-templates": "^4.2.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@nocobase/test": "0.7.0-alpha.58"
20
+ "@nocobase/test": "0.7.0-alpha.59"
21
21
  },
22
- "gitHead": "19ee42257edf17804d548ffd5ba9ddff6dc775d1"
22
+ "gitHead": "c90e5aee4c8257a3ab7ff492e69cb568cccff8b5"
23
23
  }