@things-factory/process 6.0.57 → 6.0.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.
Files changed (58) hide show
  1. package/client/pages/event/event-importer.ts +97 -0
  2. package/client/pages/event/event-list-page.ts +348 -0
  3. package/client/pages/gateway/gateway-importer.ts +97 -0
  4. package/client/pages/gateway/gateway-list-page.ts +348 -0
  5. package/client/route.ts +8 -0
  6. package/dist-client/pages/event/event-importer.d.ts +22 -0
  7. package/dist-client/pages/event/event-importer.js +100 -0
  8. package/dist-client/pages/event/event-importer.js.map +1 -0
  9. package/dist-client/pages/event/event-list-page.d.ts +62 -0
  10. package/dist-client/pages/event/event-list-page.js +326 -0
  11. package/dist-client/pages/event/event-list-page.js.map +1 -0
  12. package/dist-client/pages/gateway/gateway-importer.d.ts +22 -0
  13. package/dist-client/pages/gateway/gateway-importer.js +100 -0
  14. package/dist-client/pages/gateway/gateway-importer.js.map +1 -0
  15. package/dist-client/pages/gateway/gateway-list-page.d.ts +62 -0
  16. package/dist-client/pages/gateway/gateway-list-page.js +326 -0
  17. package/dist-client/pages/gateway/gateway-list-page.js.map +1 -0
  18. package/dist-client/route.d.ts +1 -1
  19. package/dist-client/route.js +6 -0
  20. package/dist-client/route.js.map +1 -1
  21. package/dist-client/tsconfig.tsbuildinfo +1 -1
  22. package/dist-server/routes.js +52 -0
  23. package/dist-server/routes.js.map +1 -1
  24. package/dist-server/service/index.js +3 -3
  25. package/dist-server/service/index.js.map +1 -1
  26. package/dist-server/tsconfig.tsbuildinfo +1 -1
  27. package/helps/process/event.md +160 -0
  28. package/helps/process/gateway.md +160 -0
  29. package/package.json +10 -10
  30. package/server/routes.ts +52 -0
  31. package/server/service/index.ts +27 -15
  32. package/things-factory.config.js +3 -1
  33. package/dist-server/controllers/process-instance/assign.js +0 -41
  34. package/dist-server/controllers/process-instance/assign.js.map +0 -1
  35. package/dist-server/controllers/process-instance/draft.js +0 -74
  36. package/dist-server/controllers/process-instance/draft.js.map +0 -1
  37. package/dist-server/controllers/process-instance/issue.js +0 -105
  38. package/dist-server/controllers/process-instance/issue.js.map +0 -1
  39. package/dist-server/controllers/process-instance/pick.js +0 -33
  40. package/dist-server/controllers/process-instance/pick.js.map +0 -1
  41. package/dist-server/controllers/process-thread/delegate.js +0 -36
  42. package/dist-server/controllers/process-thread/delegate.js.map +0 -1
  43. package/dist-server/controllers/process-thread/restart.js +0 -36
  44. package/dist-server/controllers/process-thread/restart.js.map +0 -1
  45. package/dist-server/controllers/process-thread/save.js +0 -38
  46. package/dist-server/controllers/process-thread/save.js.map +0 -1
  47. package/dist-server/controllers/process-thread/submit.js +0 -37
  48. package/dist-server/controllers/process-thread/submit.js.map +0 -1
  49. package/dist-server/service/process/process-model-type.js +0 -138
  50. package/dist-server/service/process/process-model-type.js.map +0 -1
  51. package/dist-server/service/process-summary/index.js +0 -8
  52. package/dist-server/service/process-summary/index.js.map +0 -1
  53. package/dist-server/service/process-summary/process-summary-query.js +0 -109
  54. package/dist-server/service/process-summary/process-summary-query.js.map +0 -1
  55. package/dist-server/service/process-summary/process-summary.js +0 -28
  56. package/dist-server/service/process-summary/process-summary.js.map +0 -1
  57. package/dist-server/service/process-thread/process-thread-history.js +0 -194
  58. package/dist-server/service/process-thread/process-thread-history.js.map +0 -1
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.issue = void 0;
4
- const process_1 = require("../../service/process/process");
5
- const process_instance_1 = require("../../service/process-instance/process-instance");
6
- const common_1 = require("../common");
7
- const submit_1 = require("../process-thread/submit");
8
- async function issue(processInstance, context) {
9
- const { domain, user, tx } = context.state;
10
- const issuedAt = new Date();
11
- var { id, name, description, assignees, uiType, uiSource, viewType, viewSource, dueAt, priority, approvalLine, processId, processType, assigneeRole, supervisoryRole, input } = processInstance;
12
- var origin = id
13
- ? await tx.getRepository(process_instance_1.ProcessInstance).findOne({
14
- where: { domain: { id: domain.id }, id },
15
- relations: [
16
- 'domain',
17
- 'process',
18
- 'assigneeRole',
19
- 'supervisoryRole',
20
- 'updater',
21
- 'creator',
22
- 'starter',
23
- 'terminator'
24
- ]
25
- })
26
- : null;
27
- /*
28
- Prerequisites for a Task to Be Issued.
29
- - The previous state of the task should be Draft.
30
- */
31
- if (origin && origin.state !== process_instance_1.ProcessInstanceStatus.Draft) {
32
- throw new Error(context.t(`error.process-instance is already issued`, {
33
- id: id,
34
- state: origin.state
35
- }));
36
- }
37
- var repository = tx.getRepository(process_1.Process);
38
- var process = (origin === null || origin === void 0 ? void 0 : origin.process) ||
39
- (await repository.findOne({
40
- where: { domain: { id: domain.id }, id: processId },
41
- relations: ['assigneeRole', 'supervisoryRole']
42
- }));
43
- if (!process) {
44
- throw new Error(context.t('error.process not found', {
45
- process: processId
46
- }));
47
- }
48
- if (!origin) {
49
- processInstance.name = name || process.name;
50
- processInstance.description = description || process.description;
51
- processInstance.processType = processType || process.processType;
52
- processInstance.uiType = uiType || process.uiType;
53
- processInstance.uiSource = uiSource || process.uiSource;
54
- processInstance.viewType = viewType || process.viewType;
55
- processInstance.viewSource = viewSource || process.viewSource;
56
- processInstance.assigneeRole = assigneeRole || process.assigneeRole;
57
- processInstance.supervisoryRole = supervisoryRole || process.supervisoryRole;
58
- processInstance.priority = priority !== null && priority !== void 0 ? priority : process.priority;
59
- if (!assignees || !approvalLine) {
60
- processInstance.adhocType = 'standard';
61
- processInstance.refBy = processId;
62
- if (!assignees) {
63
- assignees = processInstance.assignees = process.assignees;
64
- }
65
- if (!approvalLine) {
66
- approvalLine = processInstance.approvalLine = process.approvalLine;
67
- }
68
- if (!dueAt && process.standardTime) {
69
- processInstance.dueAt = new Date(issuedAt.getTime() + process.standardTime * 1000);
70
- }
71
- }
72
- }
73
- const processSearchKeys = (0, common_1.fillProcessSearchKeys)(process === null || process === void 0 ? void 0 : process.searchKeys, input);
74
- if (process.startingType == 'post') {
75
- /*
76
- startingType이 'post'이면,
77
- processInstance 이슈와 동시에 issuer에게 할당된 processThread가 생성되고 submit까지 모두 완료되게 된다.
78
- 만일, 결재선이 있다면, 상신되게 된다.
79
- */
80
- const posted = await tx.getRepository(process_instance_1.ProcessInstance).save(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ creator: user }, origin), processInstance), { transaction: 'post', process }), processSearchKeys), { state: process_instance_1.ProcessInstanceStatus.Started, domain, issuer: user, updater: user, issuedAt, startedAt: issuedAt }));
81
- const thread = await (0, common_1.createProcessThreadForUser)('post', posted, user, context);
82
- const data = Object.assign(Object.assign({}, processInstance.input), processInstance.output);
83
- const output = (process.model || [])
84
- .filter(item => item.inout === 'inout' || item.inout === 'out')
85
- .reduce((inout, item) => {
86
- inout[item.name] = data[item.name];
87
- return inout;
88
- }, {});
89
- await (0, submit_1.submit)({ id: thread.id, output }, context);
90
- return await tx.getRepository(process_instance_1.ProcessInstance).findOneBy({ id: posted.id });
91
- }
92
- else {
93
- const issued = await tx.getRepository(process_instance_1.ProcessInstance).save(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ creator: user }, origin), processInstance), { transaction: 'issue', process }), processSearchKeys), { state: process_instance_1.ProcessInstanceStatus.Issued, domain, issuer: user, updater: user, issuedAt }));
94
- const assignedUsers = await Promise.all((assignees || []).map(assignee => (0, common_1.getSystemUserFromOrgMemberItem)(assignee, context)));
95
- if (assignedUsers.length == 0 && issued.threadsMin === 0 && issued.assigneeRoleId) {
96
- await (0, common_1.createProcessThreadsForAllRoleUsers)('issue', issued, context);
97
- }
98
- if (assignedUsers.length > 0) {
99
- await (0, common_1.createProcessThreadsForUsers)('issue', issued, assignedUsers, context);
100
- }
101
- return await tx.getRepository(process_instance_1.ProcessInstance).findOneBy({ id: issued.id });
102
- }
103
- }
104
- exports.issue = issue;
105
- //# sourceMappingURL=issue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"issue.js","sourceRoot":"","sources":["../../../server/controllers/process-instance/issue.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AACvD,sFAA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a,EAAE,OAAO,CAAC,CAAA;SAC5E;QAED,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,kCAAe,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;KAC5E;AACH,CAAC;AA/JD,sBA+JC","sourcesContent":["import { Process } from '../../service/process/process'\nimport { ProcessInstance, ProcessInstanceStatus } from '../../service/process-instance/process-instance'\nimport { ProcessInstanceIssue } from '../../service/process-instance/process-instance-type'\nimport {\n createProcessThreadsForAllRoleUsers,\n createProcessThreadsForUsers,\n getSystemUserFromOrgMemberItem,\n createProcessThreadForUser,\n fillProcessSearchKeys\n} from '../common'\nimport { submit } from '../process-thread/submit'\n\nexport async function issue(processInstance: ProcessInstanceIssue, context: ResolverContext): Promise<ProcessInstance> {\n const { domain, user, tx } = context.state\n const issuedAt = new Date()\n var {\n id,\n name,\n description,\n assignees,\n uiType,\n uiSource,\n viewType,\n viewSource,\n dueAt,\n priority,\n approvalLine,\n processId,\n processType,\n assigneeRole,\n supervisoryRole,\n input\n } = processInstance\n\n var origin = id\n ? await tx.getRepository(ProcessInstance).findOne({\n where: { domain: { id: domain.id }, id },\n relations: [\n 'domain',\n 'process',\n 'assigneeRole',\n 'supervisoryRole',\n 'updater',\n 'creator',\n 'starter',\n 'terminator'\n ]\n })\n : null\n\n /* \n Prerequisites for a Task to Be Issued.\n - The previous state of the task should be Draft.\n */\n if (origin && origin.state !== ProcessInstanceStatus.Draft) {\n throw new Error(\n context.t(`error.process-instance is already issued`, {\n id: id,\n state: origin.state\n })\n )\n }\n\n var repository = tx.getRepository(Process)\n var process =\n origin?.process ||\n (await repository.findOne({\n where: { domain: { id: domain.id }, id: processId },\n relations: ['assigneeRole', 'supervisoryRole']\n }))\n\n if (!process) {\n throw new Error(\n context.t('error.process not found', {\n process: processId\n })\n )\n }\n\n if (!origin) {\n processInstance.name = name || process.name\n processInstance.description = description || process.description\n processInstance.processType = processType || process.processType\n processInstance.uiType = uiType || process.uiType\n processInstance.uiSource = uiSource || process.uiSource\n processInstance.viewType = viewType || process.viewType\n processInstance.viewSource = viewSource || process.viewSource\n processInstance.assigneeRole = assigneeRole || process.assigneeRole\n processInstance.supervisoryRole = supervisoryRole || process.supervisoryRole\n processInstance.priority = priority ?? process.priority\n\n if (!assignees || !approvalLine) {\n processInstance.adhocType = 'standard'\n processInstance.refBy = processId\n if (!assignees) {\n assignees = processInstance.assignees = process.assignees\n }\n if (!approvalLine) {\n approvalLine = processInstance.approvalLine = process.approvalLine\n }\n\n if (!dueAt && process.standardTime) {\n processInstance.dueAt = new Date(issuedAt.getTime() + process.standardTime * 1000)\n }\n }\n }\n\n const processSearchKeys = fillProcessSearchKeys(process?.searchKeys, input)\n\n if (process.startingType == 'post') {\n /* \n startingType이 'post'이면, \n processInstance 이슈와 동시에 issuer에게 할당된 processThread가 생성되고 submit까지 모두 완료되게 된다.\n 만일, 결재선이 있다면, 상신되게 된다.\n */\n const posted = await tx.getRepository(ProcessInstance).save({\n creator: user,\n ...origin,\n ...processInstance,\n transaction: 'post',\n process,\n ...processSearchKeys,\n state: ProcessInstanceStatus.Started,\n domain,\n issuer: user,\n updater: user,\n issuedAt,\n startedAt: issuedAt\n })\n\n const thread = await createProcessThreadForUser('post', posted, user, context)\n const data = { ...processInstance.input, ...processInstance.output }\n const output = (process.model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .reduce((inout, item) => {\n inout[item.name] = data[item.name]\n return inout\n }, {})\n\n await submit({ id: thread.id, output }, context)\n\n return await tx.getRepository(ProcessInstance).findOneBy({ id: posted.id })\n } else {\n const issued = await tx.getRepository(ProcessInstance).save({\n creator: user,\n ...origin,\n ...processInstance,\n transaction: 'issue',\n process,\n ...processSearchKeys,\n state: ProcessInstanceStatus.Issued,\n domain,\n issuer: user,\n updater: user,\n issuedAt\n })\n\n const assignedUsers = await Promise.all(\n (assignees || []).map(assignee => getSystemUserFromOrgMemberItem(assignee, context))\n )\n\n if (assignedUsers.length == 0 && issued.threadsMin === 0 && issued.assigneeRoleId) {\n await createProcessThreadsForAllRoleUsers('issue', issued, context)\n }\n\n if (assignedUsers.length > 0) {\n await createProcessThreadsForUsers('issue', issued, assignedUsers, context)\n }\n\n return await tx.getRepository(ProcessInstance).findOneBy({ id: issued.id })\n }\n}\n"]}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pick = void 0;
4
- const process_instance_1 = require("../../service/process-instance/process-instance");
5
- const common_1 = require("../common");
6
- async function pick(id, context) {
7
- const { domain, user, tx } = context.state;
8
- const repository = tx.getRepository(process_instance_1.ProcessInstance);
9
- var processInstance = await repository.findOne({
10
- where: { domain: { id: domain.id }, id },
11
- relations: ['domain', 'process', 'assigneeRole', 'supervisoryRole', 'updater', 'creator', 'starter', 'terminator']
12
- });
13
- if (!processInstance) {
14
- throw new Error(context.t('error.process-instance not found', {
15
- processInstance: id
16
- }));
17
- }
18
- /*
19
- Prerequisites for a Task to Be Picked.
20
- - The previous state of the task must not be Assigned.
21
- */
22
- if (processInstance.state !== process_instance_1.ProcessInstanceStatus.Issued &&
23
- processInstance.state !== process_instance_1.ProcessInstanceStatus.PendingAssignment) {
24
- throw new Error(context.t(`error.process-instance should not be assigned`, {
25
- id,
26
- actual: processInstance.state
27
- }));
28
- }
29
- const picked = await repository.save(Object.assign(Object.assign({}, processInstance), { transaction: 'pick', updater: user }));
30
- return (await (0, common_1.createProcessThreadsForUsers)('pick', picked, [user], context))[0];
31
- }
32
- exports.pick = pick;
33
- //# sourceMappingURL=pick.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pick.js","sourceRoot":"","sources":["../../../server/controllers/process-instance/pick.ts"],"names":[],"mappings":";;;AAAA,sFAAwG;AAExG,sCAAwD;AAEjD,KAAK,UAAU,IAAI,CAAC,EAAU,EAAE,OAAwB;IAC7D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,kCAAe,CAAC,CAAA;IAEpD,IAAI,eAAe,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;QAC7C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;QACxC,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC;KACnH,CAAC,CAAA;IAEF,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,CAAC,CAAC,kCAAkC,EAAE;YAC5C,eAAe,EAAE,EAAE;SACpB,CAAC,CACH,CAAA;KACF;IAED;;;MAGE;IACF,IACE,eAAe,CAAC,KAAK,KAAK,wCAAqB,CAAC,MAAM;QACtD,eAAe,CAAC,KAAK,KAAK,wCAAqB,CAAC,iBAAiB,EACjE;QACA,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,CAAC,CAAC,+CAA+C,EAAE;YACzD,EAAE;YACF,MAAM,EAAE,eAAe,CAAC,KAAK;SAC9B,CAAC,CACH,CAAA;KACF;IAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,iCAC/B,eAAe,KAClB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,IAAI,IACb,CAAA;IAEF,OAAO,CAAC,MAAM,IAAA,qCAA4B,EAAC,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACjF,CAAC;AAxCD,oBAwCC","sourcesContent":["import { ProcessInstance, ProcessInstanceStatus } from '../../service/process-instance/process-instance'\nimport { ProcessThread } from '../../service/process-thread/process-thread'\nimport { createProcessThreadsForUsers } from '../common'\n\nexport async function pick(id: string, context: ResolverContext): Promise<ProcessThread> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(ProcessInstance)\n\n var processInstance = await repository.findOne({\n where: { domain: { id: domain.id }, id },\n relations: ['domain', 'process', 'assigneeRole', 'supervisoryRole', 'updater', 'creator', 'starter', 'terminator']\n })\n\n if (!processInstance) {\n throw new Error(\n context.t('error.process-instance not found', {\n processInstance: id\n })\n )\n }\n\n /* \n Prerequisites for a Task to Be Picked.\n - The previous state of the task must not be Assigned.\n */\n if (\n processInstance.state !== ProcessInstanceStatus.Issued &&\n processInstance.state !== ProcessInstanceStatus.PendingAssignment\n ) {\n throw new Error(\n context.t(`error.process-instance should not be assigned`, {\n id,\n actual: processInstance.state\n })\n )\n }\n\n const picked = await repository.save({\n ...processInstance,\n transaction: 'pick',\n updater: user\n })\n\n return (await createProcessThreadsForUsers('pick', picked, [user], context))[0]\n}\n"]}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.delegate = void 0;
4
- const process_thread_1 = require("../../service/process-thread/process-thread");
5
- const common_1 = require("../common");
6
- async function delegate({ id, assigneeRole, dueAt, reason }, context) {
7
- const { domain, user, tx } = context.state;
8
- const repository = tx.getRepository(process_thread_1.ProcessThread);
9
- var processThread = await repository.findOne({
10
- where: { domain: { id: domain.id }, id }
11
- });
12
- if (!processThread) {
13
- throw new Error(context.t('error.process-thread not found', {
14
- processThread: id
15
- }));
16
- }
17
- /*
18
- Prerequisites for a process thread to Be Delegated.
19
- - The previous state of the process thread should be assigned or started.
20
- */
21
- if (processThread.state !== process_thread_1.ProcessThreadStatus.Assigned && processThread.state !== process_thread_1.ProcessThreadStatus.Started) {
22
- throw new Error(context.t(`error.process-thread is already terminated`, {
23
- id,
24
- actual: processThread.state
25
- }));
26
- }
27
- if (dueAt) {
28
- processThread.dueAt = dueAt;
29
- }
30
- const result = await repository.save(Object.assign(Object.assign({}, processThread), { reason,
31
- assigneeRole, transaction: 'delegate', state: process_thread_1.ProcessThreadStatus.Delegated, updater: user, assignedAt: new Date() }));
32
- await (0, common_1.updateProcessInstanceState)(processThread.processInstanceId, context);
33
- return result;
34
- }
35
- exports.delegate = delegate;
36
- //# sourceMappingURL=delegate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delegate.js","sourceRoot":"","sources":["../../../server/controllers/process-thread/delegate.ts"],"names":[],"mappings":";;;AAAA,gFAAgG;AAChG,sCAAsD;AAE/C,KAAK,UAAU,QAAQ,CAC5B,EACE,EAAE,EACF,YAAY,EACZ,KAAK,EACL,MAAM,EAMP,EACD,OAAwB;IAExB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,8BAAa,CAAC,CAAA;IAElD,IAAI,aAAa,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;QAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;KACzC,CAAC,CAAA;IAEF,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,CAAC,CAAC,gCAAgC,EAAE;YAC1C,aAAa,EAAE,EAAE;SAClB,CAAC,CACH,CAAA;KACF;IAED;;;MAGE;IACF,IAAI,aAAa,CAAC,KAAK,KAAK,oCAAmB,CAAC,QAAQ,IAAI,aAAa,CAAC,KAAK,KAAK,oCAAmB,CAAC,OAAO,EAAE;QAC/G,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,CAAC,CAAC,4CAA4C,EAAE;YACtD,EAAE;YACF,MAAM,EAAE,aAAa,CAAC,KAAK;SAC5B,CAAC,CACH,CAAA;KACF;IAED,IAAI,KAAK,EAAE;QACT,aAAa,CAAC,KAAK,GAAG,KAAK,CAAA;KAC5B;IAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,iCAC/B,aAAa,KAChB,MAAM;QACN,YAAY,EACZ,WAAW,EAAE,UAAU,EACvB,KAAK,EAAE,oCAAmB,CAAC,SAAS,EACpC,OAAO,EAAE,IAAI,EACb,UAAU,EAAE,IAAI,IAAI,EAAE,IACtB,CAAA;IAEF,MAAM,IAAA,mCAA0B,EAAC,aAAa,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IAE1E,OAAO,MAAM,CAAA;AACf,CAAC;AA5DD,4BA4DC","sourcesContent":["import { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'\nimport { updateProcessInstanceState } from '../common'\n\nexport async function delegate(\n {\n id,\n assigneeRole,\n dueAt,\n reason\n }: {\n id: string\n assigneeRole?: object\n dueAt?: Date\n reason?: string\n },\n context: ResolverContext\n): Promise<ProcessThread> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(ProcessThread)\n\n var processThread = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n if (!processThread) {\n throw new Error(\n context.t('error.process-thread not found', {\n processThread: id\n })\n )\n }\n\n /* \n Prerequisites for a process thread to Be Delegated.\n - The previous state of the process thread should be assigned or started.\n */\n if (processThread.state !== ProcessThreadStatus.Assigned && processThread.state !== ProcessThreadStatus.Started) {\n throw new Error(\n context.t(`error.process-thread is already terminated`, {\n id,\n actual: processThread.state\n })\n )\n }\n\n if (dueAt) {\n processThread.dueAt = dueAt\n }\n\n const result = await repository.save({\n ...processThread,\n reason,\n assigneeRole,\n transaction: 'delegate',\n state: ProcessThreadStatus.Delegated,\n updater: user,\n assignedAt: new Date()\n })\n\n await updateProcessInstanceState(processThread.processInstanceId, context)\n\n return result\n}\n"]}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.restart = void 0;
4
- const process_thread_1 = require("../../service/process-thread/process-thread");
5
- const common_1 = require("../common");
6
- async function restart(id, output, reason, context) {
7
- const { domain, user, tx } = context.state;
8
- const repository = tx.getRepository(process_thread_1.ProcessThread);
9
- const processThread = await repository.findOne({
10
- where: { domain: { id: domain.id }, id }
11
- });
12
- if (!processThread) {
13
- throw new Error(context.t('error.process-thread not found', {
14
- processThread: id
15
- }));
16
- }
17
- /*
18
- Prerequisites for a process thread to Be Delegated.
19
- - The previous state of the process thread should be Rejected.
20
- */
21
- if (processThread.state !== process_thread_1.ProcessThreadStatus.Rejected) {
22
- throw new Error(context.t(`error.process-thread should be the state`, {
23
- id,
24
- state: process_thread_1.ProcessThreadStatus.Rejected,
25
- actual: processThread.state
26
- }));
27
- }
28
- if (output) {
29
- processThread.output = output;
30
- }
31
- const result = await tx.getRepository(process_thread_1.ProcessThread).save(Object.assign(Object.assign({}, processThread), { reason, state: process_thread_1.ProcessThreadStatus.Started, transaction: 'restart', round: processThread.round + 1, updater: user, startedAt: new Date() }));
32
- await (0, common_1.updateProcessInstanceState)(processThread.processInstanceId, context);
33
- return result;
34
- }
35
- exports.restart = restart;
36
- //# sourceMappingURL=restart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"restart.js","sourceRoot":"","sources":["../../../server/controllers/process-thread/restart.ts"],"names":[],"mappings":";;;AAAA,gFAAgG;AAChG,sCAAsD;AAE/C,KAAK,UAAU,OAAO,CAC3B,EAAU,EACV,MAAc,EACd,MAAc,EACd,OAAwB;IAExB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,8BAAa,CAAC,CAAA;IAClD,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;QAC7C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;KACzC,CAAC,CAAA;IAEF,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,CAAC,CAAC,gCAAgC,EAAE;YAC1C,aAAa,EAAE,EAAE;SAClB,CAAC,CACH,CAAA;KACF;IAED;;;MAGE;IACF,IAAI,aAAa,CAAC,KAAK,KAAK,oCAAmB,CAAC,QAAQ,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,CAAC,CAAC,0CAA0C,EAAE;YACpD,EAAE;YACF,KAAK,EAAE,oCAAmB,CAAC,QAAQ;YACnC,MAAM,EAAE,aAAa,CAAC,KAAK;SAC5B,CAAC,CACH,CAAA;KACF;IAED,IAAI,MAAM,EAAE;QACV,aAAa,CAAC,MAAM,GAAG,MAAM,CAAA;KAC9B;IAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,8BAAa,CAAC,CAAC,IAAI,iCACpD,aAAa,KAChB,MAAM,EACN,KAAK,EAAE,oCAAmB,CAAC,OAAO,EAClC,WAAW,EAAE,SAAS,EACtB,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,CAAC,EAC9B,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,IAAI,IAAI,EAAE,IACrB,CAAA;IAEF,MAAM,IAAA,mCAA0B,EAAC,aAAa,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IAE1E,OAAO,MAAM,CAAA;AACf,CAAC;AApDD,0BAoDC","sourcesContent":["import { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'\nimport { updateProcessInstanceState } from '../common'\n\nexport async function restart(\n id: string,\n output: object,\n reason: string,\n context: ResolverContext\n): Promise<ProcessThread> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(ProcessThread)\n const processThread = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n if (!processThread) {\n throw new Error(\n context.t('error.process-thread not found', {\n processThread: id\n })\n )\n }\n\n /* \n Prerequisites for a process thread to Be Delegated.\n - The previous state of the process thread should be Rejected.\n */\n if (processThread.state !== ProcessThreadStatus.Rejected) {\n throw new Error(\n context.t(`error.process-thread should be the state`, {\n id,\n state: ProcessThreadStatus.Rejected,\n actual: processThread.state\n })\n )\n }\n\n if (output) {\n processThread.output = output\n }\n\n const result = await tx.getRepository(ProcessThread).save({\n ...processThread,\n reason,\n state: ProcessThreadStatus.Started,\n transaction: 'restart',\n round: processThread.round + 1,\n updater: user,\n startedAt: new Date()\n })\n\n await updateProcessInstanceState(processThread.processInstanceId, context)\n\n return result\n}\n"]}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.save = void 0;
4
- const common_1 = require("../common");
5
- const process_thread_1 = require("../../service/process-thread/process-thread");
6
- async function save(id, save, context) {
7
- const { domain, user, tx } = context.state;
8
- const repository = tx.getRepository(process_thread_1.ProcessThread);
9
- var processThread = await repository.findOne({
10
- where: { domain: { id: domain.id }, id }
11
- });
12
- if (!processThread) {
13
- throw new Error(context.t('error.process-thread not found', {
14
- processThread: id
15
- }));
16
- }
17
- /*
18
- Prerequisites for a process thread to Be Saved.
19
- - The previous state of the process thread must not be terminated.
20
- */
21
- if (processThread.state == process_thread_1.ProcessThreadStatus.Aborted ||
22
- processThread.state == process_thread_1.ProcessThreadStatus.Ended ||
23
- processThread.state == process_thread_1.ProcessThreadStatus.Delegated) {
24
- throw new Error(context.t(`error.process-thread is already terminated`, {
25
- id,
26
- actual: processThread.state
27
- }));
28
- }
29
- if (!processThread.startedAt) {
30
- /* The act of saving means automatically starting the work. */
31
- processThread.startedAt = new Date();
32
- }
33
- processThread = await repository.save(Object.assign(Object.assign(Object.assign({}, processThread), save), { state: process_thread_1.ProcessThreadStatus.Started, transaction: 'save', updater: user }));
34
- await (0, common_1.updateProcessInstanceState)(processThread.processInstanceId, context);
35
- return processThread;
36
- }
37
- exports.save = save;
38
- //# sourceMappingURL=save.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"save.js","sourceRoot":"","sources":["../../../server/controllers/process-thread/save.ts"],"names":[],"mappings":";;;AACA,sCAAsD;AACtD,gFAAgG;AAEzF,KAAK,UAAU,IAAI,CAAC,EAA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Content":["import { ProcessThreadSave } from '../../service/process-thread/process-thread-type'\nimport { updateProcessInstanceState } from '../common'\nimport { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'\n\nexport async function save(id: string, save: ProcessThreadSave, context: ResolverContext): Promise<ProcessThread> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(ProcessThread)\n\n var processThread = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n if (!processThread) {\n throw new Error(\n context.t('error.process-thread not found', {\n processThread: id\n })\n )\n }\n\n /* \n Prerequisites for a process thread to Be Saved.\n - The previous state of the process thread must not be terminated.\n */\n if (\n processThread.state == ProcessThreadStatus.Aborted ||\n processThread.state == ProcessThreadStatus.Ended ||\n processThread.state == ProcessThreadStatus.Delegated\n ) {\n throw new Error(\n context.t(`error.process-thread is already terminated`, {\n id,\n actual: processThread.state\n })\n )\n }\n\n if (!processThread.startedAt) {\n /* The act of saving means automatically starting the work. */\n processThread.startedAt = new Date()\n }\n\n processThread = await repository.save({\n ...processThread,\n ...save,\n state: ProcessThreadStatus.Started,\n transaction: 'save',\n updater: user\n })\n\n await updateProcessInstanceState(processThread.processInstanceId, context)\n\n return processThread\n}\n"]}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submit = void 0;
4
- const process_thread_1 = require("../../service/process-thread/process-thread");
5
- const common_1 = require("../common");
6
- async function submit({ id, output, reason }, context) {
7
- const { domain, user, tx } = context.state;
8
- const repository = tx.getRepository(process_thread_1.ProcessThread);
9
- var processThread = await repository.findOne({
10
- where: { domain: { id: domain.id }, id },
11
- relations: ['processInstance']
12
- });
13
- if (!processThread) {
14
- throw new Error(context.t('error.process-thread not found', {
15
- processThread: id
16
- }));
17
- }
18
- /*
19
- Prerequisites for a process thread to Be Started.
20
- - The previous state of the process thread must not be terminated.
21
- */
22
- if (processThread.state !== process_thread_1.ProcessThreadStatus.Assigned && processThread.state !== process_thread_1.ProcessThreadStatus.Started) {
23
- throw new Error(context.t(`error.process-thread should not be submitted`, {
24
- id,
25
- actual: processThread.state
26
- }));
27
- }
28
- if (!processThread.startedAt) {
29
- processThread.startedAt = new Date();
30
- }
31
- processThread = await repository.save(Object.assign(Object.assign({}, processThread), { reason,
32
- output, transaction: 'end', state: process_thread_1.ProcessThreadStatus.Ended, updater: user, terminator: user, terminatedAt: new Date() }));
33
- await (0, common_1.updateProcessInstanceState)(processThread.processInstanceId, context);
34
- return processThread;
35
- }
36
- exports.submit = submit;
37
- //# sourceMappingURL=submit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"submit.js","sourceRoot":"","sources":["../../../server/controllers/process-thread/submit.ts"],"names":[],"mappings":";;;AAAA,gFAAgG;AAChG,sCAAsD;AAG/C,KAAK,UAAU,MAAM,CAC1B,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAoD,EACxE,OAAwB;IAExB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,8BAAa,CAAC,CAAA;IAElD,IAAI,aAAa,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;QAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;QACxC,SAAS,EAAE,CAAC,iBAAiB,CAAC;KAC/B,CAAC,CAAA;IAEF,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,CAAC,CAAC,gCAAgC,EAAE;YAC1C,aAAa,EAAE,EAAE;SAClB,CAAC,CACH,CAAA;KACF;IAED;;;MAGE;IACF,IAAI,aAAa,CAAC,KAAK,KAAK,oCAAmB,CAAC,QAAQ,IAAI,aAAa,CAAC,KAAK,KAAK,oCAAmB,CAAC,OAAO,EAAE;QAC/G,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,CAAC,CAAC,8CAA8C,EAAE;YACxD,EAAE;YACF,MAAM,EAAE,aAAa,CAAC,KAAK;SAC5B,CAAC,CACH,CAAA;KACF;IAED,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;QAC5B,aAAa,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAA;KACrC;IAED,aAAa,GAAG,MAAM,UAAU,CAAC,IAAI,iCAChC,aAAa,KAChB,MAAM;QACN,MAAM,EACN,WAAW,EAAE,KAAK,EAClB,KAAK,EAAE,oCAAmB,CAAC,KAAK,EAChC,OAAO,EAAE,IAAI,EACb,UAAU,EAAE,IAAI,EAChB,YAAY,EAAE,IAAI,IAAI,EAAE,IACxB,CAAA;IAEF,MAAM,IAAA,mCAA0B,EAAC,aAAa,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IAE1E,OAAO,aAAa,CAAA;AACtB,CAAC;AApDD,wBAoDC","sourcesContent":["import { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'\nimport { updateProcessInstanceState } from '../common'\nimport { User } from '@things-factory/auth-base'\n\nexport async function submit(\n { id, output, reason }: { id: string; output?: object; reason?: string },\n context: ResolverContext\n): Promise<ProcessThread> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(ProcessThread)\n\n var processThread = await repository.findOne({\n where: { domain: { id: domain.id }, id },\n relations: ['processInstance']\n })\n\n if (!processThread) {\n throw new Error(\n context.t('error.process-thread not found', {\n processThread: id\n })\n )\n }\n\n /* \n Prerequisites for a process thread to Be Started.\n - The previous state of the process thread must not be terminated.\n */\n if (processThread.state !== ProcessThreadStatus.Assigned && processThread.state !== ProcessThreadStatus.Started) {\n throw new Error(\n context.t(`error.process-thread should not be submitted`, {\n id,\n actual: processThread.state\n })\n )\n }\n\n if (!processThread.startedAt) {\n processThread.startedAt = new Date()\n }\n\n processThread = await repository.save({\n ...processThread,\n reason,\n output,\n transaction: 'end',\n state: ProcessThreadStatus.Ended,\n updater: user,\n terminator: user,\n terminatedAt: new Date()\n })\n\n await updateProcessInstanceState(processThread.processInstanceId, context)\n\n return processThread\n}\n"]}
@@ -1,138 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProcessModelItemPatch = exports.ProcessModelItem = exports.ProcessModelItemType = exports.ProcessModelItemInoutType = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const shell_1 = require("@things-factory/shell");
7
- var ProcessModelItemInoutType;
8
- (function (ProcessModelItemInoutType) {
9
- ProcessModelItemInoutType["in"] = "in";
10
- ProcessModelItemInoutType["out"] = "out";
11
- ProcessModelItemInoutType["inout"] = "inout";
12
- })(ProcessModelItemInoutType = exports.ProcessModelItemInoutType || (exports.ProcessModelItemInoutType = {}));
13
- (0, type_graphql_1.registerEnumType)(ProcessModelItemInoutType, {
14
- name: 'ProcessModelItemInoutType',
15
- description: 'inout enumeration of a process-model-item'
16
- });
17
- var ProcessModelItemType;
18
- (function (ProcessModelItemType) {
19
- ProcessModelItemType["number"] = "number";
20
- ProcessModelItemType["text"] = "text";
21
- ProcessModelItemType["textarea"] = "textarea";
22
- ProcessModelItemType["boolean"] = "boolean";
23
- ProcessModelItemType["select"] = "select";
24
- ProcessModelItemType["file"] = "file";
25
- })(ProcessModelItemType = exports.ProcessModelItemType || (exports.ProcessModelItemType = {}));
26
- (0, type_graphql_1.registerEnumType)(ProcessModelItemType, {
27
- name: 'ProcessModelItemType',
28
- description: 'data type enumeration of a process-model-item'
29
- });
30
- let ProcessModelItem = class ProcessModelItem {
31
- };
32
- tslib_1.__decorate([
33
- (0, type_graphql_1.Field)({ nullable: true }),
34
- tslib_1.__metadata("design:type", String)
35
- ], ProcessModelItem.prototype, "name", void 0);
36
- tslib_1.__decorate([
37
- (0, type_graphql_1.Field)({ nullable: true }),
38
- tslib_1.__metadata("design:type", String)
39
- ], ProcessModelItem.prototype, "description", void 0);
40
- tslib_1.__decorate([
41
- (0, type_graphql_1.Field)({ nullable: true }),
42
- tslib_1.__metadata("design:type", String)
43
- ], ProcessModelItem.prototype, "tag", void 0);
44
- tslib_1.__decorate([
45
- (0, type_graphql_1.Field)({ nullable: true }),
46
- tslib_1.__metadata("design:type", Boolean)
47
- ], ProcessModelItem.prototype, "active", void 0);
48
- tslib_1.__decorate([
49
- (0, type_graphql_1.Field)({ nullable: true }),
50
- tslib_1.__metadata("design:type", Boolean)
51
- ], ProcessModelItem.prototype, "hidden", void 0);
52
- tslib_1.__decorate([
53
- (0, type_graphql_1.Field)({ nullable: true }),
54
- tslib_1.__metadata("design:type", Boolean)
55
- ], ProcessModelItem.prototype, "mandatory", void 0);
56
- tslib_1.__decorate([
57
- (0, type_graphql_1.Field)(type => ProcessModelItemInoutType, { nullable: true }),
58
- tslib_1.__metadata("design:type", String)
59
- ], ProcessModelItem.prototype, "inout", void 0);
60
- tslib_1.__decorate([
61
- (0, type_graphql_1.Field)({ nullable: true }),
62
- tslib_1.__metadata("design:type", String)
63
- ], ProcessModelItem.prototype, "type", void 0);
64
- tslib_1.__decorate([
65
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
66
- tslib_1.__metadata("design:type", Object)
67
- ], ProcessModelItem.prototype, "options", void 0);
68
- tslib_1.__decorate([
69
- (0, type_graphql_1.Field)({ nullable: true }),
70
- tslib_1.__metadata("design:type", String)
71
- ], ProcessModelItem.prototype, "unit", void 0);
72
- tslib_1.__decorate([
73
- (0, type_graphql_1.Field)(type => [type_graphql_1.Int], { nullable: true }),
74
- tslib_1.__metadata("design:type", Array)
75
- ], ProcessModelItem.prototype, "quantifier", void 0);
76
- tslib_1.__decorate([
77
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
78
- tslib_1.__metadata("design:type", Object)
79
- ], ProcessModelItem.prototype, "spec", void 0);
80
- ProcessModelItem = tslib_1.__decorate([
81
- (0, type_graphql_1.ObjectType)({ description: 'Entity for ProcessModelItem' })
82
- ], ProcessModelItem);
83
- exports.ProcessModelItem = ProcessModelItem;
84
- let ProcessModelItemPatch = class ProcessModelItemPatch {
85
- };
86
- tslib_1.__decorate([
87
- (0, type_graphql_1.Field)({ nullable: true }),
88
- tslib_1.__metadata("design:type", String)
89
- ], ProcessModelItemPatch.prototype, "name", void 0);
90
- tslib_1.__decorate([
91
- (0, type_graphql_1.Field)({ nullable: true }),
92
- tslib_1.__metadata("design:type", String)
93
- ], ProcessModelItemPatch.prototype, "description", void 0);
94
- tslib_1.__decorate([
95
- (0, type_graphql_1.Field)({ nullable: true }),
96
- tslib_1.__metadata("design:type", String)
97
- ], ProcessModelItemPatch.prototype, "tag", void 0);
98
- tslib_1.__decorate([
99
- (0, type_graphql_1.Field)(type => ProcessModelItemInoutType, { nullable: true }),
100
- tslib_1.__metadata("design:type", String)
101
- ], ProcessModelItemPatch.prototype, "inout", void 0);
102
- tslib_1.__decorate([
103
- (0, type_graphql_1.Field)(type => ProcessModelItemType, { nullable: true }),
104
- tslib_1.__metadata("design:type", String)
105
- ], ProcessModelItemPatch.prototype, "type", void 0);
106
- tslib_1.__decorate([
107
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
108
- tslib_1.__metadata("design:type", Object)
109
- ], ProcessModelItemPatch.prototype, "options", void 0);
110
- tslib_1.__decorate([
111
- (0, type_graphql_1.Field)({ nullable: true }),
112
- tslib_1.__metadata("design:type", String)
113
- ], ProcessModelItemPatch.prototype, "unit", void 0);
114
- tslib_1.__decorate([
115
- (0, type_graphql_1.Field)(type => [type_graphql_1.Int], { nullable: true }),
116
- tslib_1.__metadata("design:type", Array)
117
- ], ProcessModelItemPatch.prototype, "quantifier", void 0);
118
- tslib_1.__decorate([
119
- (0, type_graphql_1.Field)({ nullable: true }),
120
- tslib_1.__metadata("design:type", Boolean)
121
- ], ProcessModelItemPatch.prototype, "active", void 0);
122
- tslib_1.__decorate([
123
- (0, type_graphql_1.Field)({ nullable: true }),
124
- tslib_1.__metadata("design:type", Boolean)
125
- ], ProcessModelItemPatch.prototype, "mandatory", void 0);
126
- tslib_1.__decorate([
127
- (0, type_graphql_1.Field)({ nullable: true }),
128
- tslib_1.__metadata("design:type", Boolean)
129
- ], ProcessModelItemPatch.prototype, "hidden", void 0);
130
- tslib_1.__decorate([
131
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
132
- tslib_1.__metadata("design:type", Object)
133
- ], ProcessModelItemPatch.prototype, "spec", void 0);
134
- ProcessModelItemPatch = tslib_1.__decorate([
135
- (0, type_graphql_1.InputType)()
136
- ], ProcessModelItemPatch);
137
- exports.ProcessModelItemPatch = ProcessModelItemPatch;
138
- //# sourceMappingURL=process-model-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"process-model-type.js","sourceRoot":"","sources":["../../../server/service/process/process-model-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAkF;AAElF,iDAAoD;AAEpD,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACnC,sCAAS,CAAA;IACT,wCAAW,CAAA;IACX,4CAAe,CAAA;AACjB,CAAC,EAJW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAIpC;AAED,IAAA,+BAAgB,EAAC,yBAAyB,EAAE;IAC1C,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,2CAA2C;CACzD,CAAC,CAAA;AAEF,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,yCAAiB,CAAA;IACjB,qCAAa,CAAA;AACf,CAAC,EAPW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAO/B;AAED,IAAA,+BAAgB,EAAC,oBAAoB,EAAE;IACrC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,+CAA+C;CAC7D,CAAC,CAAA;AAGK,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAoC5B,CAAA;AAnCC;IAAC,IAAA,oBAAK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putType, Int, ObjectType, registerEnumType } from 'type-graphql'\n\nimport { ScalarObject } from '@things-factory/shell'\n\nexport enum ProcessModelItemInoutType {\n in = 'in',\n out = 'out',\n inout = 'inout'\n}\n\nregisterEnumType(ProcessModelItemInoutType, {\n name: 'ProcessModelItemInoutType',\n description: 'inout enumeration of a process-model-item'\n})\n\nexport enum ProcessModelItemType {\n number = 'number',\n text = 'text',\n textarea = 'textarea',\n boolean = 'boolean',\n select = 'select',\n file = 'file'\n}\n\nregisterEnumType(ProcessModelItemType, {\n name: 'ProcessModelItemType',\n description: 'data type enumeration of a process-model-item'\n})\n\n@ObjectType({ description: 'Entity for ProcessModelItem' })\nexport class ProcessModelItem {\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n tag?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n\n @Field({ nullable: true })\n mandatory?: boolean\n\n @Field(type => ProcessModelItemInoutType, { nullable: true })\n inout?: ProcessModelItemInoutType\n\n @Field({ nullable: true })\n type?: ProcessModelItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n unit?: string\n\n @Field(type => [Int], { nullable: true })\n quantifier?: number[]\n\n @Field(type => ScalarObject, { nullable: true })\n spec?: { [key: string]: any }\n}\n\n@InputType()\nexport class ProcessModelItemPatch {\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n tag?: string\n\n @Field(type => ProcessModelItemInoutType, { nullable: true })\n inout?: ProcessModelItemInoutType\n\n @Field(type => ProcessModelItemType, { nullable: true })\n type?: ProcessModelItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n unit?: string\n\n @Field(type => [Int], { nullable: true })\n quantifier: number[]\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n mandatory?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n\n @Field(type => ScalarObject, { nullable: true })\n spec?: { [key: string]: any }\n}\n"]}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolvers = exports.entities = void 0;
4
- const process_summary_1 = require("./process-summary");
5
- const process_summary_query_1 = require("./process-summary-query");
6
- exports.entities = [process_summary_1.ProcessSummary];
7
- exports.resolvers = [process_summary_query_1.ProcessSummaryQuery];
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/process-summary/index.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAClD,mEAA6D;AAEhD,QAAA,QAAQ,GAAG,CAAC,gCAAc,CAAC,CAAA;AAC3B,QAAA,SAAS,GAAG,CAAC,2CAAmB,CAAC,CAAA","sourcesContent":["import { ProcessSummary } from './process-summary'\nimport { ProcessSummaryQuery } from './process-summary-query'\n\nexport const entities = [ProcessSummary]\nexport const resolvers = [ProcessSummaryQuery]\n"]}
@@ -1,109 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProcessSummaryQuery = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const auth_base_1 = require("@things-factory/auth-base");
7
- const shell_1 = require("@things-factory/shell");
8
- const process_summary_1 = require("./process-summary");
9
- const process_thread_1 = require("../process-thread/process-thread");
10
- const process_instance_1 = require("../process-instance/process-instance");
11
- let ProcessSummaryQuery = class ProcessSummaryQuery {
12
- async processSummary(context) {
13
- return {};
14
- }
15
- async numberOfToDos(processSummary, context) {
16
- var { domain, user } = context.state;
17
- const status = [process_thread_1.ProcessThreadStatus.Ended, process_thread_1.ProcessThreadStatus.Aborted];
18
- return await (0, shell_1.getQueryBuilderFromListParams)({
19
- repository: (0, shell_1.getRepository)(process_thread_1.ProcessThread),
20
- params: {},
21
- domain,
22
- alias: 'at'
23
- })
24
- .andWhere('at.state NOT IN (:...status)', { status })
25
- .andWhere('at.assignee = :user', { user: user.id })
26
- .getCount();
27
- }
28
- async numberOfPicks(processSummary, context) {
29
- var { domain, user } = context.state;
30
- /*
31
- process-instance 중에서 아직 created 상태이면서,
32
- process-instance의 assigneeRole 이 지정되지 않았거나,
33
- assigneeRole이 지정되었으면 그 Role에 내가 해당된 경우이면서,
34
- 나는 아직 해당 process-instance의 thread를 할당받지 않은 경우에 해당하는
35
- process-instance 리스트를 모두 가져오는 쿼리이다.
36
- */
37
- user = await (0, shell_1.getRepository)(auth_base_1.User).findOne({
38
- where: { id: user.id },
39
- relations: ['roles']
40
- });
41
- const roles = user.roles.filter(role => role.domainId === domain.id).map(role => role.id);
42
- if (!roles.length) {
43
- return 0;
44
- }
45
- return await (0, shell_1.getQueryBuilderFromListParams)({
46
- repository: (0, shell_1.getRepository)(process_instance_1.ProcessInstance),
47
- params: {},
48
- domain,
49
- alias: 'ai'
50
- })
51
- .leftJoinAndSelect('ai.processThreads', 'threads', 'threads.assignee = :user', { user: user.id })
52
- .andWhere('ai.state IN (:...status)', {
53
- status: [process_instance_1.ProcessInstanceStatus.Issued, process_instance_1.ProcessInstanceStatus.PendingAssignment]
54
- })
55
- .andWhere('ai.assigneeRole IN (:...roles)', { roles })
56
- .andWhere('threads.id IS NULL') /* 이미 내가 할당된 경우는 제외한다. */
57
- .getCount();
58
- }
59
- async numberOfDrafts(processSummary, context) {
60
- var { domain, user } = context.state;
61
- /* 생성자가 자신이면서, 아직 Draft 상태인 process-instance 리스트만 반환 */
62
- const status = [process_instance_1.ProcessInstanceStatus.Draft];
63
- return await (0, shell_1.getQueryBuilderFromListParams)({
64
- repository: (0, shell_1.getRepository)(process_instance_1.ProcessInstance),
65
- params: {},
66
- domain,
67
- alias: 'ai'
68
- })
69
- .andWhere('ai.state IN (:...status)', { status })
70
- .andWhere('ai.creator = :user', { user: user.id })
71
- .getCount();
72
- }
73
- };
74
- tslib_1.__decorate([
75
- (0, type_graphql_1.Query)(returns => process_summary_1.ProcessSummary, { nullable: true, description: 'To fetch a Process Summary' }),
76
- tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
77
- tslib_1.__metadata("design:type", Function),
78
- tslib_1.__metadata("design:paramtypes", [Object]),
79
- tslib_1.__metadata("design:returntype", Promise)
80
- ], ProcessSummaryQuery.prototype, "processSummary", null);
81
- tslib_1.__decorate([
82
- (0, type_graphql_1.FieldResolver)(type => Number),
83
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
84
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
85
- tslib_1.__metadata("design:type", Function),
86
- tslib_1.__metadata("design:paramtypes", [process_summary_1.ProcessSummary, Object]),
87
- tslib_1.__metadata("design:returntype", Promise)
88
- ], ProcessSummaryQuery.prototype, "numberOfToDos", null);
89
- tslib_1.__decorate([
90
- (0, type_graphql_1.FieldResolver)(type => Number),
91
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
92
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
93
- tslib_1.__metadata("design:type", Function),
94
- tslib_1.__metadata("design:paramtypes", [process_summary_1.ProcessSummary, Object]),
95
- tslib_1.__metadata("design:returntype", Promise)
96
- ], ProcessSummaryQuery.prototype, "numberOfPicks", null);
97
- tslib_1.__decorate([
98
- (0, type_graphql_1.FieldResolver)(type => Number),
99
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
100
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
101
- tslib_1.__metadata("design:type", Function),
102
- tslib_1.__metadata("design:paramtypes", [process_summary_1.ProcessSummary, Object]),
103
- tslib_1.__metadata("design:returntype", Promise)
104
- ], ProcessSummaryQuery.prototype, "numberOfDrafts", null);
105
- ProcessSummaryQuery = tslib_1.__decorate([
106
- (0, type_graphql_1.Resolver)(process_summary_1.ProcessSummary)
107
- ], ProcessSummaryQuery);
108
- exports.ProcessSummaryQuery = ProcessSummaryQuery;
109
- //# sourceMappingURL=process-summary-query.js.map