@steedos/workflow_time_trigger 2.6.1-beta.7 → 2.6.2-beta.3

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.
@@ -1,7 +1,7 @@
1
1
  name: workflow_notifications_actions
2
2
  type: lookup
3
3
  multiple: true
4
- label: 工作流操作:工作流通知
4
+ label: 工作流操作:消息提醒
5
5
  is_wide: true
6
6
  reference_to: workflow_notifications
7
7
  reference_to_field: name
@@ -0,0 +1,11 @@
1
+ /*
2
+ * @Author: 孙浩林 sunhaolin@steedos.com
3
+ * @Date: 2023-11-25 12:11:52
4
+ * @LastEditors: 孙浩林 sunhaolin@steedos.com
5
+ * @LastEditTime: 2023-11-25 12:12:36
6
+ * @FilePath: /steedos-platform-2.3/services/workflow_time_trigger/main/default/schedule/const.js
7
+ * @Description:
8
+ */
9
+ module.exports = {
10
+ DEFAULT_STEEDOS_CRON_WORKFLOW_RULE: '*/10 * * * * *', // 每十秒执行一次
11
+ }
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * @Author: sunhaolin@hotoa.com
3
3
  * @Date: 2022-11-12 13:18:28
4
- * @LastEditors: sunhaolin@hotoa.com
5
- * @LastEditTime: 2023-03-29 16:06:23
4
+ * @LastEditors: 孙浩林 sunhaolin@steedos.com
5
+ * @LastEditTime: 2023-11-25 13:03:30
6
6
  * @Description: 工作流时间触发器定时任务,用于将工作流规则中配置的时间触发器放入工作流操作执行队列
7
7
  */
8
8
  'use strict';
@@ -15,11 +15,13 @@ const _eval = require('eval')
15
15
 
16
16
  module.exports = {
17
17
  run: async function () {
18
- if (!process.env.STEEDOS_CRON_WORKFLOW_RULE) {
18
+ const steedosConfig = objectql.getSteedosConfig() || {};
19
+ const cron = steedosConfig.cron;
20
+ if (!cron || 'false' == cron.enabled) {
19
21
  return;
20
22
  }
21
23
 
22
- console.log('time_trigger schedule running...')
24
+ // console.log('time_trigger schedule running...')
23
25
  const intervalMinitues = 5 // 每5分钟执行一次
24
26
  const rule = `0 */${intervalMinitues} * * * *`
25
27
  let next = true;
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * @Author: sunhaolin@hotoa.com
3
3
  * @Date: 2022-11-12 17:53:55
4
- * @LastEditors: sunhaolin@hotoa.com
5
- * @LastEditTime: 2023-03-29 16:09:20
4
+ * @LastEditors: 孙浩林 sunhaolin@steedos.com
5
+ * @LastEditTime: 2023-11-25 13:03:27
6
6
  * @Description: 执行工作流时间触发器队列
7
7
  */
8
8
 
@@ -11,6 +11,7 @@
11
11
 
12
12
  const schedule = require('node-schedule');
13
13
  const objectql = require('@steedos/objectql');
14
+ const { DEFAULT_STEEDOS_CRON_WORKFLOW_RULE } = require('./consts')
14
15
 
15
16
  module.exports = {
16
17
  /*
@@ -25,12 +26,15 @@ module.exports = {
25
26
  */
26
27
  run: async function (options = {}) {
27
28
  // STEEDOS_CRON_WORKFLOW_RULE='*/10 * * * * *'
28
- const rule = process.env.STEEDOS_CRON_WORKFLOW_RULE
29
- if (!rule) {
29
+ const steedosConfig = objectql.getSteedosConfig() || {};
30
+ const cron = steedosConfig.cron;
31
+ if (!cron || 'false' == cron.enabled) {
30
32
  return;
31
33
  }
34
+ const rule = cron.workflow_rule_interval || DEFAULT_STEEDOS_CRON_WORKFLOW_RULE
32
35
 
33
- console.log('time_trigger_queue schedule running...')
36
+ // console.log('rule:', rule)
37
+ // console.log('time_trigger_queue schedule running...')
34
38
  const opt = {
35
39
  excuteBatchSize: 10,
36
40
  keepDocs: true,
@@ -66,7 +70,7 @@ module.exports = {
66
70
  if (updates_field_actions) {
67
71
  await objectql.runFieldUpdateActions(updates_field_actions, record_id);
68
72
  }
69
- // 工作流通知
73
+ // 消息提醒
70
74
  if (workflow_notifications_actions) {
71
75
  await objectql.runWorkflowNotifyActions(workflow_notifications_actions, record_id);
72
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/workflow_time_trigger",
3
- "version": "2.6.1-beta.7",
3
+ "version": "2.6.2-beta.3",
4
4
  "main": "package.service.js",
5
5
  "scripts": {},
6
6
  "license": "MIT",
@@ -9,8 +9,9 @@
9
9
  "access": "public"
10
10
  },
11
11
  "dependencies": {
12
+ "@steedos/objectql": "2.6.2-beta.3",
12
13
  "eval": "0.1.8",
13
14
  "node-schedule": "2.1.0"
14
15
  },
15
- "gitHead": "b12f271460ef3686face095e875aa38e8ddc4c7f"
16
+ "gitHead": "7842aa5d3023622c0e140009cfdd081180563bdd"
16
17
  }