@simitgroup/simpleapp-generator 1.5.0-alpha → 1.6.0-alpha
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.
- package/README.md +3 -1
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +10 -0
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/index.d.ts +2 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/keyvaluepair.d.ts +3 -0
- package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -0
- package/dist/buildinschemas/keyvaluepair.js +28 -0
- package/dist/buildinschemas/keyvaluepair.js.map +1 -0
- package/dist/buildinschemas/message.d.ts +3 -0
- package/dist/buildinschemas/message.d.ts.map +1 -0
- package/dist/buildinschemas/message.js +34 -0
- package/dist/buildinschemas/message.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +18 -1
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/systemmessage.d.ts +3 -0
- package/dist/buildinschemas/systemmessage.d.ts.map +1 -0
- package/dist/buildinschemas/systemmessage.js +43 -0
- package/dist/buildinschemas/systemmessage.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +37 -9
- package/dist/generate.js.map +1 -1
- package/dist/processors/bpmnbuilder.d.ts.map +1 -1
- package/dist/processors/bpmnbuilder.js +23 -32
- package/dist/processors/bpmnbuilder.js.map +1 -1
- package/dist/processors/jrxmlbuilder.d.ts +3 -0
- package/dist/processors/jrxmlbuilder.d.ts.map +1 -0
- package/dist/processors/jrxmlbuilder.js +57 -0
- package/dist/processors/jrxmlbuilder.js.map +1 -0
- package/dist/type.d.ts +6 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/branch.ts +10 -0
- package/src/buildinschemas/index.ts +2 -0
- package/src/buildinschemas/keyvaluepair.ts +26 -0
- package/src/buildinschemas/organization.ts +18 -1
- package/src/buildinschemas/systemmessage.ts +42 -0
- package/src/framework.ts +3 -2
- package/src/generate.ts +41 -13
- package/src/processors/bpmnbuilder.ts +34 -38
- package/src/processors/jrxmlbuilder.ts +38 -0
- package/src/type.ts +7 -1
- package/templates/basic/nest/apischema.ts.eta +1 -1
- package/templates/basic/nest/controller.ts.eta +37 -19
- package/templates/basic/nest/resolver.ts.eta +1 -1
- package/templates/basic/nest/service.ts.eta +22 -4
- package/templates/basic/nest/type.ts.eta +2 -2
- package/templates/basic/nuxt/pages.form.vue.eta +1 -1
- package/templates/basic/nuxt/pages.mobile.landing.vue.eta +4 -61
- package/templates/nest/src/app.module.ts.eta +2 -0
- package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +15 -0
- package/templates/nest/src/cloudapi/cloudapi.service.ts._eta +15 -0
- package/templates/nest/src/printapi/api/.gitignore.eta +4 -0
- package/templates/nest/src/printapi/api/.npmignore.eta +1 -0
- package/templates/nest/src/printapi/api/.openapi-generator/FILES.eta +8 -0
- package/templates/nest/src/printapi/api/.openapi-generator/VERSION.eta +1 -0
- package/templates/nest/src/printapi/api/.openapi-generator-ignore.eta +23 -0
- package/templates/nest/src/printapi/api/api.ts.eta +223 -0
- package/templates/nest/src/printapi/api/base.ts.eta +86 -0
- package/templates/nest/src/printapi/api/common.ts.eta +150 -0
- package/templates/nest/src/printapi/api/configuration.ts.eta +110 -0
- package/templates/nest/src/printapi/api/git_push.sh.eta +57 -0
- package/templates/nest/src/printapi/api/index.ts.eta +18 -0
- package/templates/nest/src/printapi/api/openapitools.json.eta +7 -0
- package/templates/nest/src/printapi/printapi.module.ts.eta +15 -0
- package/templates/nest/src/printapi/printapi.service.ts.eta +42 -0
- package/templates/nest/src/simpleapp/apischemas/index.ts._eta +25 -0
- package/templates/nest/src/simpleapp/generate/commons/robotuser.service.ts.eta +112 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +7 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +8 -5
- package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +73 -0
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +104 -0
- package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +77 -0
- package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +115 -0
- package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +71 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +29 -9
- package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +49 -0
- package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +52 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +0 -1
- package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +191 -0
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +208 -6
- package/templates/nest/src/simpleapp/generate/workflow/workflow.config.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +2 -2
- package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +33 -28
- package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +107 -20
- package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +4 -4
- package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +43 -0
- package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +70 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +10 -3
- package/templates/nest/src/simpleapp/types/index.ts._eta +11 -0
- package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts.eta +31 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +1 -1
- package/templates/nuxt/components/button/ButtonAction.vue._eta +11 -5
- package/templates/nuxt/components/form/{FormBranch.vue.eta → FormBranch.vue._eta} +1 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +38 -0
- package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +40 -0
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +147 -0
- package/templates/nuxt/components/list/ListItem.vue.eta +24 -0
- package/templates/nuxt/components/list/ListMessages.vue.eta +89 -0
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +1 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +93 -7
- package/templates/nuxt/components/text/TextBold.vue._eta +13 -0
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +11 -2
- package/templates/nuxt/composables/graphquery.generate.ts.eta +7 -7
- package/templates/nuxt/composables/hotvalue.generate.ts.eta +30 -0
- package/templates/nuxt/composables/pusher.ts._eta +13 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -3
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +20 -0
- package/templates/nuxt/composables/workflow.generate.ts.eta +9 -4
- package/templates/nuxt/layouts/mobile.vue._eta +31 -42
- package/templates/nuxt/nuxt.config.ts._eta +2 -2
- package/templates/nuxt/othermodules.d.ts.eta +449 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/[id].vue._eta +40 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/{index.vue.eta → index.vue.aetaz} +16 -13
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +21 -15
- package/templates/nuxt/plugins/40.pusher.ts.eta +18 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +7 -1
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +4 -1
- package/templates/nuxt/types/schema.ts.eta +8 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +3 -5
- package/templates/printformats/template.jrxml._eta +27 -0
- package/templates/project/groups/admin.json.eta +6 -1
- package/templates/project/jsonschemas/branch.json._eta +113 -0
- package/templates/project/jsonschemas/invoice.json._eta +5 -1
- package/templates/project/jsonschemas/organization.json._eta +111 -0
- package/templates/project/lang/default._json +70 -150
- package/templates/workflow/next/listener.ts.eta +6 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts._eta +0 -26
- /package/templates/nest/src/simpleapp/services/{autoinc.service.ts.eta → autoinc.service.ts.etaxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{branch.service.ts.eta → branch.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{docno.service.ts.eta → docno.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{org.service.ts.eta → org.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{perm.service.ts.eta → perm.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{tenant.service.ts.eta → tenant.service.ts.etaxxx} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
3
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-
|
|
4
|
+
* last change 2024-04-23
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import {
|
|
8
8
|
Injectable,
|
|
9
9
|
InternalServerErrorException,
|
|
10
10
|
Logger,
|
|
11
|
+
Inject,
|
|
11
12
|
} from '@nestjs/common';
|
|
12
13
|
import {
|
|
13
14
|
IExecution,
|
|
@@ -19,13 +20,17 @@ import {
|
|
|
19
20
|
BPMNServer,
|
|
20
21
|
Execution,
|
|
21
22
|
} from 'bpmn-server';
|
|
23
|
+
import { UserResolverService } from '../../services/userresolver.service';
|
|
22
24
|
import { moddleOptions } from 'bpmn-server/dist/elements/js-bpmn-moddle';
|
|
23
25
|
let mydelegate: WorkflowDelegate;
|
|
24
26
|
@Injectable()
|
|
25
27
|
export class WorkflowDelegate implements IAppDelegate {
|
|
26
28
|
protected logger = new Logger();
|
|
27
29
|
server: BPMNServer;
|
|
28
|
-
|
|
30
|
+
|
|
31
|
+
@Inject(UserResolverService)
|
|
32
|
+
servicesProvider: UserResolverService;
|
|
33
|
+
|
|
29
34
|
constructor() {}
|
|
30
35
|
getServicesProvider = (execution: Execution) => this.servicesProvider;
|
|
31
36
|
|
|
@@ -60,7 +65,7 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
60
65
|
|
|
61
66
|
async messageThrown(messageId, data, messageMatchingKey: any, item: Item) {
|
|
62
67
|
const msgId = item.node.messageId;
|
|
63
|
-
item.context.logger.log('Message Issued' + msgId);
|
|
68
|
+
// item.context.logger.log('Message Issued' + msgId);
|
|
64
69
|
// issue it back for others to receive
|
|
65
70
|
const resp = await item.context.engine.throwMessage(
|
|
66
71
|
msgId,
|
|
@@ -68,19 +73,19 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
68
73
|
messageMatchingKey,
|
|
69
74
|
);
|
|
70
75
|
if (resp && resp.instance) {
|
|
71
|
-
item.context.logger.log(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
76
|
+
// item.context.logger.log(
|
|
77
|
+
// ' invoked another process ' +
|
|
78
|
+
// resp.instance.id +
|
|
79
|
+
// ' for ' +
|
|
80
|
+
// resp.instance.name,
|
|
81
|
+
// );
|
|
77
82
|
} else await this.issueMessage(messageId, data);
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
async issueMessage(messageId, data) {}
|
|
81
86
|
async issueSignal(signalId, data) {}
|
|
82
87
|
async signalThrown(signalId, data, messageMatchingKey: any, item: Item) {
|
|
83
|
-
item.context.logger.log('Signal Issued' + signalId);
|
|
88
|
+
// item.context.logger.log('Signal Issued' + signalId);
|
|
84
89
|
|
|
85
90
|
const resp = await item.context.engine.throwSignal(
|
|
86
91
|
signalId,
|
|
@@ -88,27 +93,27 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
88
93
|
messageMatchingKey,
|
|
89
94
|
);
|
|
90
95
|
if (resp && resp.instance) {
|
|
91
|
-
item.context.logger.log(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
);
|
|
96
|
+
// item.context.logger.log(
|
|
97
|
+
// ' invoked another process ' +
|
|
98
|
+
// resp.instance.id +
|
|
99
|
+
// ' for ' +
|
|
100
|
+
// resp.instance.name,
|
|
101
|
+
// );
|
|
97
102
|
} else await this.issueSignal(signalId, data);
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
consoleKeyTypes = (obj1) => {
|
|
101
106
|
const keys = Object.getOwnPropertyNames(obj1);
|
|
102
|
-
console.log('consoleKeyTypesconsoleKeyTypesconsoleKeyTypes', keys);
|
|
107
|
+
// console.log('consoleKeyTypesconsoleKeyTypesconsoleKeyTypes', keys);
|
|
103
108
|
for (let k = 0; k < keys.length; k++) {
|
|
104
109
|
const key = keys[k];
|
|
105
110
|
|
|
106
111
|
if (!obj1[key]) {
|
|
107
|
-
console.log(key, 'empty ');
|
|
112
|
+
// console.log(key, 'empty ');
|
|
108
113
|
} else if (typeof obj1[key] == 'object') {
|
|
109
|
-
console.log(key, typeof obj1[key], Object.keys(obj1[key]));
|
|
114
|
+
// console.log(key, typeof obj1[key], Object.keys(obj1[key]));
|
|
110
115
|
} else {
|
|
111
|
-
console.log(key, typeof obj1[key], obj1[key]);
|
|
116
|
+
// console.log(key, typeof obj1[key], obj1[key]);
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
};
|
|
@@ -165,8 +170,8 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
165
170
|
return (${script});`;
|
|
166
171
|
result = Function(js).bind(scope)();
|
|
167
172
|
} catch (exc) {
|
|
168
|
-
console.log('error in script evaluation', js);
|
|
169
|
-
console.log(exc);
|
|
173
|
+
// console.log('error in script evaluation', js);
|
|
174
|
+
// console.log(exc);
|
|
170
175
|
}
|
|
171
176
|
return result;
|
|
172
177
|
}
|
|
@@ -183,13 +188,13 @@ export class WorkflowDelegate implements IAppDelegate {
|
|
|
183
188
|
var output=this.output;
|
|
184
189
|
${script}`;
|
|
185
190
|
result = await new AsyncFunction(js).bind(scope)();
|
|
186
|
-
scope.token.log('..executing js is done ' + scope.id);
|
|
191
|
+
// scope.token.log('..executing js is done ' + scope.id);
|
|
187
192
|
} catch (exc) {
|
|
188
|
-
scope.token.log(
|
|
189
|
-
|
|
190
|
-
);
|
|
191
|
-
console.log('error in script execution', js);
|
|
192
|
-
console.log(exc);
|
|
193
|
+
// scope.token.log(
|
|
194
|
+
// 'ERROR in executing Script ' + exc.message + '\n' + script,
|
|
195
|
+
// );
|
|
196
|
+
// console.log('error in script execution', js);
|
|
197
|
+
// console.log(exc);
|
|
193
198
|
}
|
|
194
199
|
return result;
|
|
195
200
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { error } from 'console';
|
|
1
2
|
/**
|
|
2
3
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
4
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-04-
|
|
5
|
+
* last change 2024-04-21
|
|
5
6
|
* Author: Ks Tan
|
|
6
7
|
*/
|
|
7
8
|
import { WorkflowConfig } from './workflow.config';
|
|
@@ -30,16 +31,19 @@ import {
|
|
|
30
31
|
Logger as bpmnlogger,
|
|
31
32
|
BPMN_TYPE,
|
|
32
33
|
EXECUTION_EVENT,
|
|
34
|
+
ILogger,
|
|
33
35
|
} from 'bpmn-server';
|
|
34
36
|
// import { configuration } from './configuration';
|
|
35
37
|
import { UserContext } from '../commons/user.context';
|
|
36
38
|
import { WorkflowName } from '../types';
|
|
39
|
+
// import { UserResolverService } from '../../services/userresolver.service';
|
|
40
|
+
|
|
37
41
|
//import * as formschemas from '../../workflow/formschema';
|
|
38
42
|
export {
|
|
39
43
|
WorkflowSettingApiSchema,
|
|
40
44
|
WorkflowDataApiSchema,
|
|
41
45
|
} from './workflow.type';
|
|
42
|
-
|
|
46
|
+
import { SimpleAppRobotUserService } from 'src/simpleapp/generate/commons/robotuser.service';
|
|
43
47
|
@Injectable()
|
|
44
48
|
export class WorkflowService {
|
|
45
49
|
protected bpmnServer: BPMNServer;
|
|
@@ -47,8 +51,29 @@ export class WorkflowService {
|
|
|
47
51
|
constructor(
|
|
48
52
|
private workflowconfig: WorkflowConfig,
|
|
49
53
|
private eventEmitter: EventEmitter2,
|
|
54
|
+
// private userResolverService: UserResolverService,
|
|
55
|
+
private robotUserService: SimpleAppRobotUserService,
|
|
50
56
|
) {
|
|
51
|
-
|
|
57
|
+
const config = this.workflowconfig.getConfig();
|
|
58
|
+
class HiddenLogger implements ILogger {
|
|
59
|
+
setOptions() {}
|
|
60
|
+
clear() {}
|
|
61
|
+
get() {
|
|
62
|
+
return [] as any[];
|
|
63
|
+
}
|
|
64
|
+
debug() {}
|
|
65
|
+
warn() {}
|
|
66
|
+
info() {}
|
|
67
|
+
reportError(err: any) {
|
|
68
|
+
// console.log('report Error:', err);
|
|
69
|
+
}
|
|
70
|
+
async save(filename: any) {}
|
|
71
|
+
log() {}
|
|
72
|
+
error(err: any) {
|
|
73
|
+
// console.log('Error:', err);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.bpmnServer = new BPMNServer(config, new HiddenLogger());
|
|
52
77
|
this.bpmnServer.listener.on(
|
|
53
78
|
'all',
|
|
54
79
|
async (event) => await this.applyEventListener(event),
|
|
@@ -60,14 +85,14 @@ export class WorkflowService {
|
|
|
60
85
|
* @param appuser
|
|
61
86
|
* @returns array of usertask
|
|
62
87
|
*/
|
|
63
|
-
async getActorUserTask(appuser: UserContext
|
|
88
|
+
async getActorUserTask(appuser: UserContext) {
|
|
64
89
|
const tmp: any[] = await this.bpmnServer.dataStore.findItems({
|
|
65
90
|
'items.status': 'wait',
|
|
66
91
|
'data.tenantId': appuser.getTenantId(),
|
|
67
92
|
//filter uid properties base on function
|
|
68
93
|
$or: [
|
|
69
|
-
{ 'items.assignee': appuser.
|
|
70
|
-
{ 'items.candidateUsers': appuser.
|
|
94
|
+
{ 'items.assignee': appuser.getUid() },
|
|
95
|
+
{ 'items.candidateUsers': appuser.getId() },
|
|
71
96
|
{ 'items.candidateGroups': appuser.getGroups() },
|
|
72
97
|
],
|
|
73
98
|
});
|
|
@@ -101,7 +126,7 @@ export class WorkflowService {
|
|
|
101
126
|
* @returns array of usertask
|
|
102
127
|
*/
|
|
103
128
|
async getMyUserTask(appuser: UserContext) {
|
|
104
|
-
return await this.getActorUserTask(appuser
|
|
129
|
+
return await this.getActorUserTask(appuser);
|
|
105
130
|
}
|
|
106
131
|
|
|
107
132
|
/**
|
|
@@ -326,19 +351,19 @@ export class WorkflowService {
|
|
|
326
351
|
) {
|
|
327
352
|
//run as event, it wont have transaction
|
|
328
353
|
appuser.setDBSession(undefined);
|
|
329
|
-
|
|
330
|
-
if (!data
|
|
331
|
-
|
|
354
|
+
|
|
355
|
+
if (!data) data = {};
|
|
356
|
+
|
|
332
357
|
//sometimes data is Mongoose object instead of pure data, need serialize and deserialize to remove that
|
|
333
|
-
data=JSON.parse(JSON.stringify(data))
|
|
334
|
-
|
|
358
|
+
data = JSON.parse(JSON.stringify(data));
|
|
359
|
+
|
|
335
360
|
try {
|
|
336
361
|
// console.log('startWorkflow started: ', workflowName);
|
|
337
|
-
|
|
362
|
+
|
|
338
363
|
data.tenantId = appuser.getTenantId();
|
|
339
364
|
data.orgId = appuser.getOrgId();
|
|
340
365
|
data.branchId = appuser.getBranchId();
|
|
341
|
-
|
|
366
|
+
|
|
342
367
|
const result = await this.bpmnServer.engine.start(
|
|
343
368
|
workflowName,
|
|
344
369
|
data,
|
|
@@ -423,9 +448,14 @@ export class WorkflowService {
|
|
|
423
448
|
schema: schema,
|
|
424
449
|
};
|
|
425
450
|
} else {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
451
|
+
return {
|
|
452
|
+
processName: processName,
|
|
453
|
+
elementId: elementId,
|
|
454
|
+
schema: 'default',
|
|
455
|
+
};
|
|
456
|
+
//throw new InternalServerErrorException(
|
|
457
|
+
// `Cannot resolve schema from invalid formKey '${schema}', example: 'jsonschema://SimpleApproveReject' or 'custom://your-custom-key'`,
|
|
458
|
+
//);
|
|
429
459
|
}
|
|
430
460
|
} else {
|
|
431
461
|
throw new NotFoundException(
|
|
@@ -468,6 +498,8 @@ export class WorkflowService {
|
|
|
468
498
|
* @param event bpmn-server event instance
|
|
469
499
|
*/
|
|
470
500
|
async applyEventListener(event) {
|
|
501
|
+
// console.log("Workflow", event.context.instance.name,", ID:",event.context.item.element.id,
|
|
502
|
+
// ", Type: " ,event.context.item.element.type, ", name: ", event.context.item.element.name, ", event type: ", event.event)
|
|
471
503
|
if (event.context.item) {
|
|
472
504
|
const workflowName: string = event.context.instance.name;
|
|
473
505
|
const eventType: EXECUTION_EVENT = event.event;
|
|
@@ -477,6 +509,7 @@ export class WorkflowService {
|
|
|
477
509
|
const elementProps = event.context.item.element.def;
|
|
478
510
|
// const usertaskinput = event.context.item.input ?? null;
|
|
479
511
|
const data = event.context.instance.data;
|
|
512
|
+
const appuser = this.robotUserService.prepareAppUser(data);
|
|
480
513
|
const vars = {};
|
|
481
514
|
Object.assign(vars, event.context.item.input);
|
|
482
515
|
event.context.item.input = {};
|
|
@@ -495,7 +528,12 @@ export class WorkflowService {
|
|
|
495
528
|
else if (eventType == EXECUTION_EVENT.node_wait)
|
|
496
529
|
usertaskeventtype = 'wait';
|
|
497
530
|
// console.log("event-------=================================",eventType,usertaskeventtype)
|
|
531
|
+
const assignee = event.context.item.assignee;
|
|
532
|
+
const candidateUsers = event.context.item.candidateUsers;
|
|
533
|
+
const candidateGroups = event.context.item.candidateGroups;
|
|
534
|
+
|
|
498
535
|
if (usertaskeventtype) {
|
|
536
|
+
('');
|
|
499
537
|
const props: UserTaskData = {
|
|
500
538
|
workflowName: workflowName,
|
|
501
539
|
eventType: usertaskeventtype,
|
|
@@ -504,9 +542,9 @@ export class WorkflowService {
|
|
|
504
542
|
elementName: elementName,
|
|
505
543
|
elementProps: {
|
|
506
544
|
startedAt: event.context.item.startedAt,
|
|
507
|
-
assignee:
|
|
508
|
-
candidateGroups:
|
|
509
|
-
candidateUsers:
|
|
545
|
+
assignee: assignee,
|
|
546
|
+
candidateGroups: candidateGroups,
|
|
547
|
+
candidateUsers: candidateUsers,
|
|
510
548
|
dueDate: event.context.item.dueDate,
|
|
511
549
|
followUpDate: event.context.item.followUpDate,
|
|
512
550
|
priority: event.context.item.priority,
|
|
@@ -516,8 +554,12 @@ export class WorkflowService {
|
|
|
516
554
|
vars: vars,
|
|
517
555
|
options: options,
|
|
518
556
|
};
|
|
557
|
+
|
|
558
|
+
//send notification
|
|
519
559
|
this.eventEmitter.emit(
|
|
520
560
|
`${workflowName}.${elementId}.${usertaskeventtype}`,
|
|
561
|
+
appuser,
|
|
562
|
+
|
|
521
563
|
props,
|
|
522
564
|
);
|
|
523
565
|
}
|
|
@@ -542,6 +584,7 @@ export class WorkflowService {
|
|
|
542
584
|
};
|
|
543
585
|
this.eventEmitter.emit(
|
|
544
586
|
`${workflowName}.${elementId}.${servicetaskeventtype}`,
|
|
587
|
+
// appuser,
|
|
545
588
|
props,
|
|
546
589
|
);
|
|
547
590
|
}
|
|
@@ -551,4 +594,48 @@ export class WorkflowService {
|
|
|
551
594
|
}
|
|
552
595
|
}
|
|
553
596
|
}
|
|
597
|
+
|
|
598
|
+
// async userResolver(
|
|
599
|
+
// appuser: UserContext,
|
|
600
|
+
// userids: string | string[] | undefined,
|
|
601
|
+
// data: any,
|
|
602
|
+
// ) {
|
|
603
|
+
// if (!userids) return undefined;
|
|
604
|
+
// if (typeof userids == 'string') userids = [userids];
|
|
605
|
+
// if (!Array.isArray(userids)) return undefined;
|
|
606
|
+
// const newids: string[] = [];
|
|
607
|
+
// for (let i = 0; i < userids.length; i++) {
|
|
608
|
+
// let uid = userids[i].trim();
|
|
609
|
+
// if (
|
|
610
|
+
// uid.substring(0, 1) == '@' &&
|
|
611
|
+
// uid.includes('[') &&
|
|
612
|
+
// uid.includes(']')
|
|
613
|
+
// ) {
|
|
614
|
+
// const regextype = /(?<=\@)(.*?)(?=\[)/;
|
|
615
|
+
// const regexvalue = /(?<=\[)(.*?)(?=\])/;
|
|
616
|
+
|
|
617
|
+
// const usertype = uid.match(regextype)[0].trim();
|
|
618
|
+
// const typevalue = uid.match(regexvalue)[0].trim();
|
|
619
|
+
// let idvalue = '';
|
|
620
|
+
// if (typevalue.substring(0, 6) == '$data.') {
|
|
621
|
+
// const fieldpath = typevalue.replace('$data.', '');
|
|
622
|
+
// idvalue = this.readFieldFromData(fieldpath, data);
|
|
623
|
+
// }
|
|
624
|
+
|
|
625
|
+
// uid = await this.userResolverService.resolve(
|
|
626
|
+
// appuser,
|
|
627
|
+
// usertype,
|
|
628
|
+
// idvalue,
|
|
629
|
+
// data,
|
|
630
|
+
// );
|
|
631
|
+
// }
|
|
632
|
+
// if (uid) newids.push(uid);
|
|
633
|
+
// }
|
|
634
|
+
|
|
635
|
+
// return newids;
|
|
636
|
+
// }
|
|
637
|
+
|
|
638
|
+
// readFieldFromData(path: string, data: any) {
|
|
639
|
+
// return path.split('.').reduce((o, i) => o[i], data);
|
|
640
|
+
// }
|
|
554
641
|
}
|
|
@@ -9,9 +9,9 @@ import { UserContext } from '../commons/user.context';
|
|
|
9
9
|
export type WorkflowSettingApiSchema = {
|
|
10
10
|
userServiceUrl: string;
|
|
11
11
|
callBackUrl?: string;
|
|
12
|
-
assignee?: string;
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
assignee?: string|string[];
|
|
13
|
+
candidateGroups?: string | string[];
|
|
14
|
+
candidateUsers?: string | string[];
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export type WorkflowDataApiSchema = {
|
|
@@ -70,7 +70,7 @@ export type UserTaskData = {
|
|
|
70
70
|
vars:any
|
|
71
71
|
elementProps: {
|
|
72
72
|
startedAt: string;
|
|
73
|
-
assignee?: string;
|
|
73
|
+
assignee?: string|string[];
|
|
74
74
|
candidateGroups?: string | string[];
|
|
75
75
|
candidateUsers?: string | string[];
|
|
76
76
|
dueDate?: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. It is changable
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2024-04-24
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { InjectModel } from '@nestjs/mongoose';
|
|
9
|
+
import { Model } from 'mongoose';
|
|
10
|
+
import { Injectable } from '@nestjs/common';
|
|
11
|
+
import { UserContext } from '../generate/commons/user.context';
|
|
12
|
+
import { SystemmessageProcessor } from '../generate/processors/sysmsg.processor';
|
|
13
|
+
//import { Systemmessage,SystemmessageHooks} from '../generate/types';
|
|
14
|
+
import * as types from '../generate/types';
|
|
15
|
+
export { Systemmessage } from '../generate/types';
|
|
16
|
+
|
|
17
|
+
@Injectable()
|
|
18
|
+
export class SystemmessageService extends SystemmessageProcessor {
|
|
19
|
+
public hooks: types.SystemmessageHooks = {
|
|
20
|
+
afterCreate : async(appuser:UserContext,data:types.Systemmessage) =>
|
|
21
|
+
await this.afterCreate(appuser,data)
|
|
22
|
+
};
|
|
23
|
+
constructor(@InjectModel('Systemmessage') mydoc: Model<types.Systemmessage>) {
|
|
24
|
+
super(mydoc);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async runDefault(appuser: UserContext) {
|
|
28
|
+
return await this.search(appuser, { uid: appuser.getUid() });
|
|
29
|
+
}
|
|
30
|
+
async afterCreate(appuser:UserContext,data:types.Systemmessage){
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/***************************** begin x-document-api definitions *****************************************/
|
|
35
|
+
async runReadmsg(appuser:UserContext,id:string){
|
|
36
|
+
const data = await this.findById(appuser, id);
|
|
37
|
+
data.read=true
|
|
38
|
+
await await this.findIdThenUpdate(appuser,id,data)
|
|
39
|
+
return data
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/***************************** end x-document-api definitions *****************************************/
|
|
43
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. It is changable
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2024-04-24
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Injectable } from '@nestjs/common';
|
|
9
|
+
import { SimpleAppRobotUserService } from '../generate/commons/robotuser.service';
|
|
10
|
+
import { UserContext } from '../generate/commons/user.context';
|
|
11
|
+
import { UserService } from './user.service';
|
|
12
|
+
import { TeacherService } from './teacher.service';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@Injectable()
|
|
16
|
+
export class UserResolverService {
|
|
17
|
+
constructor(
|
|
18
|
+
private userService: UserService,
|
|
19
|
+
private teacherService: TeacherService,
|
|
20
|
+
private robotUserService: SimpleAppRobotUserService,
|
|
21
|
+
) {}
|
|
22
|
+
async teacher(assignvalue: string, data: any) {
|
|
23
|
+
console.log('assign value for teacher', assignvalue);
|
|
24
|
+
|
|
25
|
+
const appuser = this.robotUserService.prepareAppUser(data);
|
|
26
|
+
console.log('gettenant', appuser.getBranchFilter());
|
|
27
|
+
return this.resolve(appuser, 'teacher', assignvalue, data);
|
|
28
|
+
}
|
|
29
|
+
async resolve(appuser: UserContext, usertype: string, id: string, data: any) {
|
|
30
|
+
let result = '';
|
|
31
|
+
switch (usertype) {
|
|
32
|
+
case 'user':
|
|
33
|
+
result = await this.resolveUser(appuser, id, data);
|
|
34
|
+
break;
|
|
35
|
+
case 'teacher':
|
|
36
|
+
result = await this.resolveTeacher(appuser, id, data);
|
|
37
|
+
break;
|
|
38
|
+
|
|
39
|
+
case 'group':
|
|
40
|
+
// result = await this.resolveTeacher(appuser,id,data)
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getUser(appuser: UserContext, email: string) {
|
|
47
|
+
if (!email) return undefined;
|
|
48
|
+
console.log('get user from email ', email);
|
|
49
|
+
const user = await this.userService.search(appuser, { email: email });
|
|
50
|
+
console.log('user result', user);
|
|
51
|
+
if (user && user.length > 0) return user[0].uid;
|
|
52
|
+
else return undefined;
|
|
53
|
+
}
|
|
54
|
+
async resolveTeacher(
|
|
55
|
+
appuser: UserContext,
|
|
56
|
+
id: string | undefined,
|
|
57
|
+
data: any,
|
|
58
|
+
) {
|
|
59
|
+
if (!id) return undefined;
|
|
60
|
+
console.log('Find teacher::', id);
|
|
61
|
+
const teacher = await this.teacherService.findById(appuser, id);
|
|
62
|
+
console.log('teacher', teacher);
|
|
63
|
+
return this.getUser(appuser, teacher.email);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async resolveUser(appuser: UserContext, id: string | undefined, data: any) {
|
|
67
|
+
const user = await this.userService.findById(appuser, id);
|
|
68
|
+
return user.uid;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -8,7 +8,10 @@ import { Module } from '@nestjs/common';
|
|
|
8
8
|
import { MongooseModule } from '@nestjs/mongoose';
|
|
9
9
|
import {DocNumberFormatGenerator} from './generate/commons/docnogenerator.service'
|
|
10
10
|
import { AuditTrail } from './generate/commons/audittrail.service';
|
|
11
|
+
import { CloudApiModule } from 'src/cloudapi/cloudapi.module';
|
|
12
|
+
import { PrintApiModule } from 'src/printapi/printapi.module';
|
|
11
13
|
|
|
14
|
+
import { UserResolverService } from './services/userresolver.service';
|
|
12
15
|
// auto import modules
|
|
13
16
|
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
14
17
|
<% let obj = it.modules[i]%>
|
|
@@ -24,6 +27,7 @@ import { WorkflowDelegate } from './generate/workflow/workflow.delegate';
|
|
|
24
27
|
import { WorkflowConfig } from './generate/workflow/workflow.config';
|
|
25
28
|
import { WorkflowService } from './generate/workflow/workflow.service';
|
|
26
29
|
import { WorkflowUserService } from './generate/workflow/workflow.userservice';
|
|
30
|
+
import { SimpleAppRobotUserService } from './generate/commons/robotuser.service';
|
|
27
31
|
<%for(let i=0; i<it.allbpmn.length;i++){%>
|
|
28
32
|
<%let bpmn = it.allbpmn[i]%>
|
|
29
33
|
import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/workflows/listeners/<%=bpmn%>.listener';
|
|
@@ -37,6 +41,8 @@ import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/w
|
|
|
37
41
|
|
|
38
42
|
@Module({
|
|
39
43
|
imports: [
|
|
44
|
+
CloudApiModule,
|
|
45
|
+
PrintApiModule,
|
|
40
46
|
MongooseModule.forFeature([
|
|
41
47
|
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
42
48
|
<% let obj = it.modules[i]%>
|
|
@@ -46,6 +52,7 @@ import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/w
|
|
|
46
52
|
],
|
|
47
53
|
controllers: [<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Controller,<%}%> ProfileController,WorkflowController],
|
|
48
54
|
providers: [
|
|
55
|
+
SimpleAppRobotUserService,
|
|
49
56
|
AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %>
|
|
50
57
|
<%= it.modules[i].docname %>Service,
|
|
51
58
|
<%= it.modules[i].docname %>Resolver,
|
|
@@ -53,11 +60,11 @@ import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/w
|
|
|
53
60
|
<%for(let i=0; i<it.allbpmn.length;i++){%>
|
|
54
61
|
<%let bpmn = it.allbpmn[i]%>
|
|
55
62
|
<%=capitalizeFirstLetter(bpmn)%>ListenerService,
|
|
56
|
-
<%}%>
|
|
63
|
+
<%}%> UserResolverService,
|
|
57
64
|
],
|
|
58
|
-
exports:[AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %>
|
|
65
|
+
exports:[SimpleAppRobotUserService,AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %>
|
|
59
66
|
<%= it.modules[i].docname %>Service,
|
|
60
67
|
<%= it.modules[i].docname %>Resolver,
|
|
61
|
-
<%}%> ProfileService,WorkflowDelegate,WorkflowConfig,WorkflowService,WorkflowUserService,]
|
|
68
|
+
<%}%> ProfileService,WorkflowDelegate,WorkflowConfig,WorkflowService,WorkflowUserService,UserResolverService,]
|
|
62
69
|
})
|
|
63
70
|
export class GenerateModule {}
|
|
@@ -11,6 +11,17 @@ export type ForeignKey = {
|
|
|
11
11
|
[key:string]:any
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
export type CodeLabelValue = {
|
|
15
|
+
_id: string
|
|
16
|
+
code: string
|
|
17
|
+
label: string
|
|
18
|
+
value: number
|
|
19
|
+
}
|
|
20
|
+
export class KeyValue {
|
|
21
|
+
key: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
export type UserPermission = {
|
|
15
26
|
permId: string;
|
|
16
27
|
branchId: number
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator.
|
|
3
|
+
* DONT CHANGE THIS FILE !!
|
|
4
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
5
|
+
* last change 2024-03-19
|
|
6
|
+
* Author: Ks Tan
|
|
7
|
+
*/
|
|
8
|
+
import { Inject, Injectable, Logger } from '@nestjs/common';
|
|
9
|
+
import { InjectModel } from '@nestjs/mongoose';
|
|
10
|
+
import { Model } from 'mongoose';
|
|
11
|
+
import { UserContext } from 'src/simpleapp/generate/commons/user.context';
|
|
12
|
+
import { User } from 'src/simpleapp/services/user.service';
|
|
13
|
+
import { Permission } from 'src/simpleapp/services/perm.service';
|
|
14
|
+
import { SimpleAppRobotUserService } from 'src/simpleapp/generate/commons/robotuser.service';
|
|
15
|
+
|
|
16
|
+
@Injectable()
|
|
17
|
+
export class SimpleAppListenerService {
|
|
18
|
+
private systemAccessToken: string;
|
|
19
|
+
private expired: string;
|
|
20
|
+
logger = new Logger();
|
|
21
|
+
@InjectModel('User') private readonly usermodel: Model<User>;
|
|
22
|
+
@InjectModel('Permission') private readonly permmodel: Model<Permission>;
|
|
23
|
+
@Inject(SimpleAppRobotUserService)
|
|
24
|
+
private robotuser:SimpleAppRobotUserService;
|
|
25
|
+
|
|
26
|
+
constructor() {}
|
|
27
|
+
|
|
28
|
+
prepareAppUser(data: any) {
|
|
29
|
+
return this.robotuser.prepareAppUser(data)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -21,7 +21,7 @@ const CustomTailwind = usePassThrough(
|
|
|
21
21
|
// buttonContainer:{class:'hidden'},
|
|
22
22
|
},
|
|
23
23
|
card:{
|
|
24
|
-
root:{class:'bg-white dark:bg-gray-800 shadow p-
|
|
24
|
+
root:{class:'bg-white dark:bg-gray-800 shadow p-2 rounded-2xl'},
|
|
25
25
|
// title:{class:''},
|
|
26
26
|
// header:{class:''}
|
|
27
27
|
},
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ButtonDefault v-if="!actionName" :animate="animate"
|
|
3
|
-
|
|
2
|
+
<ButtonDefault v-if="!actionName" :animate="animate"
|
|
3
|
+
><slot></slot>def</ButtonDefault
|
|
4
|
+
>
|
|
5
|
+
<ButtonPrimary
|
|
6
|
+
v-else-if="['create', 'update','print'].includes(actionName)"
|
|
7
|
+
:animate="animate"
|
|
4
8
|
><slot></slot
|
|
5
9
|
></ButtonPrimary>
|
|
6
|
-
<ButtonDanger
|
|
10
|
+
<ButtonDanger
|
|
11
|
+
v-else-if="['delete', 'void'].includes(actionName)"
|
|
12
|
+
:animate="animate"
|
|
7
13
|
><slot></slot
|
|
8
14
|
></ButtonDanger>
|
|
9
|
-
<ButtonWarning v-else
|
|
15
|
+
<ButtonWarning v-else :animate="animate"><slot></slot></ButtonWarning>
|
|
10
16
|
</template>
|
|
11
17
|
<script setup lang="ts">
|
|
12
18
|
/**
|
|
@@ -15,5 +21,5 @@
|
|
|
15
21
|
* last change 2024-03-01
|
|
16
22
|
* author: Ks Tan
|
|
17
23
|
*/
|
|
18
|
-
const props = defineProps<{ actionName?: string; animate?:boolean }>();
|
|
24
|
+
const props = defineProps<{ actionName?: string; animate?: boolean }>();
|
|
19
25
|
</script>
|