@steedos/standard-process-approval 2.2.55-beta.16

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.
Files changed (61) hide show
  1. package/main/default/applications/.gitkeep +0 -0
  2. package/main/default/applications/process_automation.app.yml +49 -0
  3. package/main/default/client/action_field_updates.client.js +155 -0
  4. package/main/default/client/core.client.js +134 -0
  5. package/main/default/client/process.client.js +211 -0
  6. package/main/default/client/process_node.client.js +36 -0
  7. package/main/default/client/workflow_notifications.client.js +74 -0
  8. package/main/default/objectTranslations/action_field_updates.en/action_field_updates.en.objectTranslation.yml +69 -0
  9. package/main/default/objectTranslations/action_field_updates.zh-CN/action_field_updates.zh-CN.objectTranslation.yml +72 -0
  10. package/main/default/objectTranslations/process_definition.en/process_definition.en.objectTranslation.yml +150 -0
  11. package/main/default/objectTranslations/process_definition.zh-CN/process_definition.zh-CN.objectTranslation.yml +145 -0
  12. package/main/default/objectTranslations/process_flows.en/process_flows.en.objectTranslation.yml +41 -0
  13. package/main/default/objectTranslations/process_flows.zh-CN/process_flows.zh-CN.objectTranslation.yml +41 -0
  14. package/main/default/objectTranslations/process_flows_criteria.en/process_flows_criteria.en.objectTranslation.yml +38 -0
  15. package/main/default/objectTranslations/process_flows_criteria.zh-CN/process_flows_criteria.zh-CN.objectTranslation.yml +38 -0
  16. package/main/default/objectTranslations/process_flows_criteria_action.en/process_flows_criteria_action.en.objectTranslation.yml +47 -0
  17. package/main/default/objectTranslations/process_flows_criteria_action.zh-CN/process_flows_criteria_action.zh-CN.objectTranslation.yml +47 -0
  18. package/main/default/objectTranslations/process_instance.en/process_instance.en.objectTranslation.yml +63 -0
  19. package/main/default/objectTranslations/process_instance.zh-CN/process_instance.zh-CN.objectTranslation.yml +63 -0
  20. package/main/default/objectTranslations/process_instance_history.en/process_instance_history.en.objectTranslation.yml +109 -0
  21. package/main/default/objectTranslations/process_instance_history.zh-CN/process_instance_history.zh-CN.objectTranslation.yml +109 -0
  22. package/main/default/objectTranslations/process_instance_node.en/process_instance_node.en.objectTranslation.yml +59 -0
  23. package/main/default/objectTranslations/process_instance_node.zh-CN/process_instance_node.zh-CN.objectTranslation.yml +59 -0
  24. package/main/default/objectTranslations/process_node.en/process_node.en.objectTranslation.yml +120 -0
  25. package/main/default/objectTranslations/process_node.zh-CN/process_node.zh-CN.objectTranslation.yml +116 -0
  26. package/main/default/objectTranslations/workflow_notifications.en/workflow_notifications.en.objectTranslation.yml +41 -0
  27. package/main/default/objectTranslations/workflow_notifications.zh-CN/workflow_notifications.zh-CN.objectTranslation.yml +44 -0
  28. package/main/default/objectTranslations/workflow_rule.en/workflow_rule.en.objectTranslation.yml +53 -0
  29. package/main/default/objectTranslations/workflow_rule.zh-CN/workflow_rule.zh-CN.objectTranslation.yml +60 -0
  30. package/main/default/objects/process/approval/process_definition.action.js +65 -0
  31. package/main/default/objects/process/approval/process_definition.function.js +39 -0
  32. package/main/default/objects/process/approval/process_definition.object.yml +313 -0
  33. package/main/default/objects/process/approval/process_node.object.yml +267 -0
  34. package/main/default/objects/process/flows/process_flows.object.yml +48 -0
  35. package/main/default/objects/process/flows/process_flows_criteria.object.yml +46 -0
  36. package/main/default/objects/process/flows/process_flows_criteria_action.object.yml +56 -0
  37. package/main/default/objects/process/process_instance/process_instance.object.yml +65 -0
  38. package/main/default/objects/process/process_instance/process_instance_history.action.js +26 -0
  39. package/main/default/objects/process/process_instance/process_instance_history.object.yml +153 -0
  40. package/main/default/objects/process/process_instance/process_instance_node.object.yml +59 -0
  41. package/main/default/objects/workflow-actions/action_field_updates.action.js +33 -0
  42. package/main/default/objects/workflow-actions/action_field_updates.object.yml +197 -0
  43. package/main/default/objects/workflow-actions/workflow_notifications.action.js +33 -0
  44. package/main/default/objects/workflow-actions/workflow_notifications.object.yml +107 -0
  45. package/main/default/objects/workflow-actions/workflow_rule.action.js +33 -0
  46. package/main/default/objects/workflow-actions/workflow_rule.object.yml +112 -0
  47. package/main/default/permissionsets/.gitkeep +0 -0
  48. package/main/default/profiles/.gitkeep +0 -0
  49. package/main/default/tabs/.gitkeep +0 -0
  50. package/main/default/triggers/.gitkeep +0 -0
  51. package/main/default/triggers/action_field_updates.trigger.js +175 -0
  52. package/main/default/triggers/process_definition.trigger.js +132 -0
  53. package/main/default/triggers/process_instance_history.trigger.js +42 -0
  54. package/main/default/triggers/process_node.trigger.js +232 -0
  55. package/main/default/triggers/workflow_notifications.trigger.js +236 -0
  56. package/main/default/triggers/workflow_rule.trigger.js +96 -0
  57. package/package.json +16 -0
  58. package/package.service.js +75 -0
  59. package/public/.md +3 -0
  60. package/src/.md +3 -0
  61. package/webapp/.md +1 -0
@@ -0,0 +1,236 @@
1
+ const _ = require("underscore");
2
+ const util = require('@steedos/standard-objects').util;
3
+ const objectql = require("@steedos/objectql");
4
+ const InternalData = require('@steedos/standard-objects').internalData;
5
+
6
+ const getInternalWorkflowNotifications = function(sourceWorkflowNotifications, filters){
7
+ let dbWorkflowNotifications = Creator.getCollection("workflow_notifications").find(filters, {fields:{_id:1, name:1}}).fetch();
8
+ let workflowNotifications = [];
9
+
10
+ if(!filters.is_system){
11
+ _.forEach(sourceWorkflowNotifications, function(doc){
12
+ if(!_.find(dbWorkflowNotifications, function(p){
13
+ return p.name === doc.name
14
+ })){
15
+ workflowNotifications.push(doc);
16
+ }
17
+ })
18
+ }
19
+ return workflowNotifications;
20
+ }
21
+
22
+ module.exports = {
23
+ beforeInsert: async function () {
24
+ await util.checkAPIName(this.object_name, 'name', this.doc.name, undefined, [['is_system','!=', true]]);
25
+ },
26
+ beforeUpdate: async function () {
27
+ if (_.has(this.doc, 'name')) {
28
+ await util.checkAPIName(this.object_name, 'name', this.doc.name, this.id, [['is_system','!=', true]]);
29
+ }
30
+ },
31
+ afterFind: async function(){
32
+ let filters = InternalData.parserFilters(this.query.filters)
33
+ let workflowNotifications = [];
34
+ if(filters.name && filters.name.$in){
35
+ for(let _name of filters.name.$in){
36
+ let workflowNotification = objectql.getWorkflowNotification(_name);
37
+ if(workflowNotification){
38
+ workflowNotifications.push(workflowNotification);
39
+ }
40
+ }
41
+ }else if(filters._id && !filters._id.$ne){
42
+ let notification = objectql.getWorkflowNotification(filters._id);
43
+ if(notification){
44
+ workflowNotifications.push(notification);
45
+ }
46
+ }else if(filters.object_name){
47
+ workflowNotifications = objectql.getObjectWorkflowNotifications(filters.object_name);
48
+ delete filters.object_name;
49
+ }else{
50
+ workflowNotifications = objectql.getAllWorkflowNotifications();
51
+ }
52
+
53
+ if(filters._id && filters._id.$ne){
54
+ if(!_.isArray(filters._id.$ne)){
55
+ filters._id.$ne = [filters._id.$ne]
56
+ }
57
+ for(let neid of filters._id.$ne){
58
+ workflowNotifications = _.filter(workflowNotifications, function(item){
59
+ return item._id !== neid
60
+ })
61
+ }
62
+ }
63
+
64
+ workflowNotifications = getInternalWorkflowNotifications(workflowNotifications, filters);
65
+
66
+ if(workflowNotifications && workflowNotifications.length>0){
67
+ this.data.values = this.data.values.concat(workflowNotifications)
68
+ }
69
+ },
70
+ afterAggregate: async function(){
71
+ let filters = InternalData.parserFilters(this.query.filters)
72
+ let workflowNotifications = [];
73
+ if(filters._id && filters._id.$in){
74
+ for(let id of filters._id.$in){
75
+ let workflowNotification = objectql.getWorkflowNotification(id);
76
+ if(workflowNotification){
77
+ workflowNotifications.push(workflowNotification);
78
+ }
79
+ }
80
+ }else if(filters._id && !filters._id.$ne){
81
+ let notification = objectql.getWorkflowNotification(filters._id);
82
+ if(notification){
83
+ workflowNotifications.push(notification);
84
+ }
85
+ }else if(filters.object_name){
86
+ workflowNotifications = objectql.getObjectWorkflowNotifications(filters.object_name);
87
+ delete filters.object_name;
88
+ }else{
89
+ workflowNotifications = objectql.getAllWorkflowNotifications();
90
+ }
91
+
92
+ if(filters._id && filters._id.$ne){
93
+ if(!_.isArray(filters._id.$ne)){
94
+ filters._id.$ne = [filters._id.$ne]
95
+ }
96
+ for(let neid of filters._id.$ne){
97
+ workflowNotifications = _.filter(workflowNotifications, function(item){
98
+ return item._id !== neid
99
+ })
100
+ }
101
+ }
102
+ },
103
+ afterFind: async function(){
104
+ let filters = InternalData.parserFilters(this.query.filters)
105
+ let workflowNotifications = [];
106
+ if(filters.name && filters.name.$in){
107
+ for(let _name of filters.name.$in){
108
+ let workflowNotification = objectql.getWorkflowNotification(_name);
109
+ if(workflowNotification){
110
+ workflowNotifications.push(workflowNotification);
111
+ }
112
+ }
113
+ }else if(filters._id && !filters._id.$ne){
114
+ let notification = objectql.getWorkflowNotification(filters._id);
115
+ if(notification){
116
+ workflowNotifications.push(notification);
117
+ }
118
+ }else if(filters.object_name){
119
+ workflowNotifications = objectql.getObjectWorkflowNotifications(filters.object_name);
120
+ delete filters.object_name;
121
+ }else{
122
+ workflowNotifications = objectql.getAllWorkflowNotifications();
123
+ }
124
+
125
+ if(filters._id && filters._id.$ne){
126
+ if(!_.isArray(filters._id.$ne)){
127
+ filters._id.$ne = [filters._id.$ne]
128
+ }
129
+ for(let neid of filters._id.$ne){
130
+ workflowNotifications = _.filter(workflowNotifications, function(item){
131
+ return item._id !== neid
132
+ })
133
+ }
134
+ }
135
+
136
+ workflowNotifications = getInternalWorkflowNotifications(workflowNotifications, filters);
137
+
138
+ if(workflowNotifications && workflowNotifications.length>0){
139
+ this.data.values = this.data.values.concat(workflowNotifications)
140
+ }
141
+ },
142
+ afterAggregate: async function(){
143
+ let filters = InternalData.parserFilters(this.query.filters)
144
+ let workflowNotifications = [];
145
+ if(filters._id && filters._id.$in){
146
+ for(let id of filters._id.$in){
147
+ let workflowNotification = objectql.getWorkflowNotification(id);
148
+ if(workflowNotification){
149
+ workflowNotifications.push(workflowNotification);
150
+ }
151
+ }
152
+ }else if(filters._id && !filters._id.$ne){
153
+ let notification = objectql.getWorkflowNotification(filters._id);
154
+ if(notification){
155
+ workflowNotifications.push(notification);
156
+ }
157
+ }else if(filters.object_name){
158
+ workflowNotifications = objectql.getObjectWorkflowNotifications(filters.object_name);
159
+ delete filters.object_name;
160
+ }else{
161
+ workflowNotifications = objectql.getAllWorkflowNotifications();
162
+ }
163
+
164
+ if(filters._id && filters._id.$ne){
165
+ if(!_.isArray(filters._id.$ne)){
166
+ filters._id.$ne = [filters._id.$ne]
167
+ }
168
+ for(let neid of filters._id.$ne){
169
+ workflowNotifications = _.filter(workflowNotifications, function(item){
170
+ return item._id !== neid
171
+ })
172
+ }
173
+ }
174
+
175
+ workflowNotifications = getInternalWorkflowNotifications(workflowNotifications, filters);
176
+
177
+ if(workflowNotifications && workflowNotifications.length>0){
178
+ this.data.values = this.data.values.concat(workflowNotifications)
179
+ }
180
+ },
181
+ afterCount: async function(){
182
+ let filters = InternalData.parserFilters(this.query.filters)
183
+ let workflowNotifications = [];
184
+ if(filters._id && filters._id.$in){
185
+ for(let id of filters._id.$in){
186
+ let workflowNotification = objectql.getWorkflowNotification(id);
187
+ if(workflowNotification){
188
+ workflowNotifications.push(workflowNotification);
189
+ }
190
+ }
191
+ }else if(filters._id && !filters._id.$ne){
192
+ let notification = objectql.getWorkflowNotification(filters._id);
193
+ if(notification){
194
+ workflowNotifications.push(notification);
195
+ }
196
+ }else if(filters.object_name){
197
+ workflowNotifications = objectql.getObjectWorkflowNotifications(filters.object_name);
198
+ delete filters.object_name;
199
+ }else{
200
+ workflowNotifications = objectql.getAllWorkflowNotifications();
201
+ }
202
+
203
+ if(filters._id && filters._id.$ne){
204
+ if(!_.isArray(filters._id.$ne)){
205
+ filters._id.$ne = [filters._id.$ne]
206
+ }
207
+ for(let neid of filters._id.$ne){
208
+ workflowNotifications = _.filter(workflowNotifications, function(item){
209
+ return item._id !== neid
210
+ })
211
+ }
212
+ }
213
+
214
+ workflowNotifications = getInternalWorkflowNotifications(workflowNotifications, filters);
215
+
216
+ if(workflowNotifications && workflowNotifications.length>0){
217
+ this.data.values = this.data.values + workflowNotifications.length
218
+ }
219
+ },
220
+ afterFindOne: async function(){
221
+ if(_.isEmpty(this.data.values)){
222
+ let id = this.id
223
+
224
+ let dbNotification = Creator.getCollection("workflow_notifications").find({name: id}).fetch();
225
+ if(dbNotification && dbNotification.length > 0){
226
+ this.data.values = dbNotification[0];
227
+ return;
228
+ }
229
+
230
+ let workflowNotification = objectql.getWorkflowNotification(id);
231
+ if(workflowNotification){
232
+ this.data.values = workflowNotification;
233
+ }
234
+ }
235
+ },
236
+ }
@@ -0,0 +1,96 @@
1
+ /*
2
+ * @Author: sunhaolin@hotoa.com
3
+ * @Date: 2021-08-30 12:06:41
4
+ * @LastEditors: sunhaolin@hotoa.com
5
+ * @LastEditTime: 2022-07-29 16:03:50
6
+ * @Description:
7
+ */
8
+ const _ = require("underscore");
9
+ const util = require('@steedos/standard-objects').util;
10
+ const objectql = require("@steedos/objectql");
11
+ const InternalData = require('@steedos/standard-objects').internalData;
12
+
13
+ const getInternalWorkflowRules = function(sourceWorkflowRules, filters){
14
+ let dbWorkflowRules = Creator.getCollection("workflow_rule").find(filters, {fields:{_id:1, name:1}}).fetch();
15
+ let workflowRules = [];
16
+
17
+ if(!filters.is_system){
18
+ _.forEach(sourceWorkflowRules, function(doc){
19
+ if(!_.find(dbWorkflowRules, function(p){
20
+ return p.name === doc.name
21
+ })){
22
+ workflowRules.push(doc);
23
+ }
24
+ })
25
+ }
26
+ return workflowRules;
27
+ }
28
+
29
+ module.exports = {
30
+ beforeInsert: async function () {
31
+ await util.checkAPIName(this.object_name, 'name', this.doc.name, undefined, [['is_system','!=', true]]);
32
+
33
+ },
34
+ beforeUpdate: async function () {
35
+ if (_.has(this.doc, 'name')) {
36
+ await util.checkAPIName(this.object_name, 'name', this.doc.name, this.id, [['is_system','!=', true]]);
37
+ }
38
+ },
39
+ afterFind: async function(){
40
+ let filters = InternalData.parserFilters(this.query.filters)
41
+ let workflowRules = [];
42
+ if(filters.object_name){
43
+ workflowRules = objectql.getObjectWorkflowRules(filters.object_name);
44
+ delete filters.object_name;
45
+ }else{
46
+ workflowRules = objectql.getAllWorkflowRules();
47
+ }
48
+
49
+ workflowRules = getInternalWorkflowRules(workflowRules, filters);
50
+
51
+ if(workflowRules && workflowRules.length>0){
52
+ this.data.values = this.data.values.concat(workflowRules)
53
+ }
54
+ },
55
+ afterAggregate: async function(){
56
+ let filters = InternalData.parserFilters(this.query.filters)
57
+ let workflowRules = [];
58
+ if(filters.object_name){
59
+ workflowRules = objectql.getObjectWorkflowRules(filters.object_name);
60
+ delete filters.object_name;
61
+ }else{
62
+ workflowRules = objectql.getAllWorkflowRules();
63
+ }
64
+
65
+ workflowRules = getInternalWorkflowRules(workflowRules, filters);
66
+
67
+ if(workflowRules && workflowRules.length>0){
68
+ this.data.values = this.data.values.concat(workflowRules)
69
+ }
70
+ },
71
+ afterCount: async function(){
72
+ let filters = InternalData.parserFilters(this.query.filters)
73
+ let workflowRules = [];
74
+ if(filters.object_name){
75
+ workflowRules = objectql.getObjectWorkflowRules(filters.object_name);
76
+ delete filters.object_name;
77
+ }else{
78
+ workflowRules = objectql.getAllWorkflowRules();
79
+ }
80
+
81
+ workflowRules = getInternalWorkflowRules(workflowRules, filters);
82
+
83
+ if(workflowRules && workflowRules.length>0){
84
+ this.data.values = this.data.values + workflowRules.length
85
+ }
86
+ },
87
+ afterFindOne: async function(){
88
+ if(_.isEmpty(this.data.values)){
89
+ let id = this.id
90
+ let workflowRule = objectql.getWorkflowRule(id);
91
+ if(workflowRule){
92
+ this.data.values = workflowRule;
93
+ }
94
+ }
95
+ },
96
+ }
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@steedos/standard-process-approval",
3
+ "version": "2.2.55-beta.16",
4
+ "main": "package.service.js",
5
+ "private": false,
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "keywords": [
10
+ "steedos"
11
+ ],
12
+ "description": "steedos package",
13
+ "repository": {},
14
+ "license": "MIT",
15
+ "dependencies": {}
16
+ }
@@ -0,0 +1,75 @@
1
+ /*
2
+ * @Author: sunhaolin@hotoa.com
3
+ * @Date: 2022-07-29 09:40:31
4
+ * @LastEditors: sunhaolin@hotoa.com
5
+ * @LastEditTime: 2022-07-29 14:37:14
6
+ * @Description:
7
+ */
8
+ "use strict";
9
+ const project = require('./package.json');
10
+ const packageName = project.name;
11
+ const packageLoader = require('@steedos/service-meteor-package-loader');
12
+ /**
13
+ * @typedef {import('moleculer').Context} Context Moleculer's Context
14
+ */
15
+ module.exports = {
16
+ name: packageName,
17
+ namespace: "steedos",
18
+ mixins: [packageLoader],
19
+ /**
20
+ * Settings
21
+ */
22
+ settings: {
23
+ packageInfo: {
24
+ path: __dirname,
25
+ name: packageName
26
+ }
27
+ },
28
+
29
+ /**
30
+ * Dependencies
31
+ */
32
+ dependencies: ['~packages-standard-objects'],
33
+
34
+ /**
35
+ * Actions
36
+ */
37
+ actions: {
38
+
39
+ },
40
+
41
+ /**
42
+ * Events
43
+ */
44
+ events: {
45
+
46
+ },
47
+
48
+ /**
49
+ * Methods
50
+ */
51
+ methods: {
52
+
53
+ },
54
+
55
+ /**
56
+ * Service created lifecycle event handler
57
+ */
58
+ async created() {
59
+
60
+ },
61
+
62
+ /**
63
+ * Service started lifecycle event handler
64
+ */
65
+ async started() {
66
+
67
+ },
68
+
69
+ /**
70
+ * Service stopped lifecycle event handler
71
+ */
72
+ async stopped() {
73
+
74
+ }
75
+ };
package/public/.md ADDED
@@ -0,0 +1,3 @@
1
+ ### 静态公开资源文件
2
+
3
+ - 此文件夹中的文件自动添加到根路由
package/src/.md ADDED
@@ -0,0 +1,3 @@
1
+ ### src
2
+
3
+ - 软件包不会加载此文件夹下的文件, 可用于存放ts文件等
package/webapp/.md ADDED
@@ -0,0 +1 @@
1
+ - 存放web项目