@things-factory/process 8.0.0-beta.9 → 8.0.2

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 (62) hide show
  1. package/client/actions/main.ts +1 -0
  2. package/client/bootstrap.ts +8 -0
  3. package/client/index.ts +1 -0
  4. package/client/pages/event/event-importer.ts +86 -0
  5. package/client/pages/event/event-list-page.ts +324 -0
  6. package/client/pages/gateway/gateway-importer.ts +87 -0
  7. package/client/pages/gateway/gateway-list-page.ts +323 -0
  8. package/client/pages/main.ts +25 -0
  9. package/client/pages/process/process-importer.ts +87 -0
  10. package/client/pages/process/process-list-page.ts +324 -0
  11. package/client/pages/process-instance/process-instance-importer.ts +87 -0
  12. package/client/pages/process-instance/process-instance-list-page.ts +323 -0
  13. package/client/pages/process-thread/process-thread-importer.ts +87 -0
  14. package/client/pages/process-thread/process-thread-list-page.ts +323 -0
  15. package/client/reducers/main.ts +17 -0
  16. package/client/route.ts +27 -0
  17. package/client/tsconfig.json +13 -0
  18. package/dist-client/tsconfig.tsbuildinfo +1 -1
  19. package/dist-server/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +14 -14
  21. package/server/controllers/common.ts +90 -0
  22. package/server/controllers/index.ts +0 -0
  23. package/server/controllers/process-instance/abort.ts +75 -0
  24. package/server/controllers/process-instance/end.ts +74 -0
  25. package/server/controllers/process-instance/index.ts +2 -0
  26. package/server/controllers/process-thread/_abort.ts +20 -0
  27. package/server/controllers/process-thread/abort.ts +48 -0
  28. package/server/controllers/process-thread/end.ts +54 -0
  29. package/server/controllers/process-thread/index.ts +3 -0
  30. package/server/controllers/process-thread/start.ts +49 -0
  31. package/server/index.ts +4 -0
  32. package/server/middlewares/index.ts +3 -0
  33. package/server/migrations/index.ts +9 -0
  34. package/server/routes.ts +80 -0
  35. package/server/service/index.ts +44 -0
  36. package/server/service/process/event-subscriber.ts +17 -0
  37. package/server/service/process/index.ts +9 -0
  38. package/server/service/process/process-history.ts +108 -0
  39. package/server/service/process/process-mutation.ts +210 -0
  40. package/server/service/process/process-query.ts +120 -0
  41. package/server/service/process/process-search-key-item-type.ts +16 -0
  42. package/server/service/process/process-type.ts +65 -0
  43. package/server/service/process/process.ts +97 -0
  44. package/server/service/process-instance/event-subscriber.ts +44 -0
  45. package/server/service/process-instance/index.ts +10 -0
  46. package/server/service/process-instance/process-instance-history.ts +154 -0
  47. package/server/service/process-instance/process-instance-mutation.ts +33 -0
  48. package/server/service/process-instance/process-instance-query.ts +141 -0
  49. package/server/service/process-instance/process-instance-subscription.ts +46 -0
  50. package/server/service/process-instance/process-instance-type.ts +71 -0
  51. package/server/service/process-instance/process-instance.ts +147 -0
  52. package/server/service/process-stats/index.ts +3 -0
  53. package/server/service/process-stats/process-stats-query.ts +57 -0
  54. package/server/service/process-stats/process-stats-type.ts +31 -0
  55. package/server/service/process-thread/event-subscriber.ts +31 -0
  56. package/server/service/process-thread/index.ts +9 -0
  57. package/server/service/process-thread/process-thread-mutation.ts +34 -0
  58. package/server/service/process-thread/process-thread-query.ts +61 -0
  59. package/server/service/process-thread/process-thread-subscription.ts +42 -0
  60. package/server/service/process-thread/process-thread-type.ts +15 -0
  61. package/server/service/process-thread/process-thread.ts +90 -0
  62. package/server/tsconfig.json +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/process",
3
- "version": "8.0.0-beta.9",
3
+ "version": "8.0.2",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -27,18 +27,18 @@
27
27
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration"
28
28
  },
29
29
  "dependencies": {
30
- "@operato/event-view": "^8.0.0-beta",
31
- "@operato/graphql": "^8.0.0-beta",
32
- "@operato/grist-editor": "^8.0.0-beta",
33
- "@operato/shell": "^8.0.0-beta",
34
- "@things-factory/attachment-base": "^8.0.0-beta.9",
35
- "@things-factory/auth-base": "^8.0.0-beta.9",
36
- "@things-factory/board-service": "^8.0.0-beta.9",
37
- "@things-factory/context-ui": "^8.0.0-beta.9",
38
- "@things-factory/organization": "^8.0.0-beta.9",
39
- "@things-factory/scheduler-client": "^8.0.0-beta.9",
40
- "@things-factory/shell": "^8.0.0-beta.9",
41
- "@things-factory/worklist": "^8.0.0-beta.9"
30
+ "@operato/event-view": "^8.0.0",
31
+ "@operato/graphql": "^8.0.0",
32
+ "@operato/grist-editor": "^8.0.0",
33
+ "@operato/shell": "^8.0.0",
34
+ "@things-factory/attachment-base": "^8.0.2",
35
+ "@things-factory/auth-base": "^8.0.2",
36
+ "@things-factory/board-service": "^8.0.2",
37
+ "@things-factory/context-ui": "^8.0.2",
38
+ "@things-factory/organization": "^8.0.2",
39
+ "@things-factory/scheduler-client": "^8.0.2",
40
+ "@things-factory/shell": "^8.0.2",
41
+ "@things-factory/worklist": "^8.0.2"
42
42
  },
43
- "gitHead": "86b1dfa26292926a2d5447fdc23bfa5a9e983245"
43
+ "gitHead": "39d60f56e142561233ddf6d47b539c637971357c"
44
44
  }
@@ -0,0 +1,90 @@
1
+ import { Role, User } from '@things-factory/auth-base'
2
+
3
+ import { ProcessSearchKeyItem } from '../service/process/process-search-key-item-type'
4
+ import { ProcessInstance, ProcessInstanceStatus } from '../service/process-instance/process-instance'
5
+ import { ProcessThread, ProcessThreadStatus } from '../service/process-thread/process-thread'
6
+
7
+ export async function updateProcessInstanceState(id: string, context: ResolverContext) {
8
+ const { tx } = context.state
9
+
10
+ var processInstance = await tx.getRepository(ProcessInstance).findOne({
11
+ where: { id },
12
+ relations: ['domain', 'process', 'assigneeRole', 'supervisoryRole', 'updater', 'creator', 'starter', 'terminator']
13
+ })
14
+
15
+ processInstance = await tx.getRepository(ProcessInstance).save({
16
+ ...processInstance,
17
+ transaction: 'thread' /* change by transaction of process thread */,
18
+ ...(await evalProcessInstanceState(id, context))
19
+ })
20
+ }
21
+
22
+ export async function evalProcessInstanceState(
23
+ id: string,
24
+ context: ResolverContext
25
+ ): Promise<Partial<ProcessInstance>> {
26
+ const { tx, user } = context.state
27
+
28
+ const processInstance = await tx.getRepository(ProcessInstance).findOne({
29
+ where: { id },
30
+ relations: ['processThreads', 'process']
31
+ })
32
+ const { processThreads, state } = processInstance
33
+
34
+ switch (true) {
35
+ case state === ProcessInstanceStatus.Ended:
36
+ case state === ProcessInstanceStatus.Aborted:
37
+ return {}
38
+ default:
39
+ return {
40
+ state: processThreads.find(thread => thread.state == ProcessThreadStatus.Aborted)
41
+ ? ProcessInstanceStatus.Aborted
42
+ : ProcessInstanceStatus.Ended,
43
+ reason: '',
44
+ terminatedAt: new Date()
45
+ }
46
+ }
47
+ }
48
+
49
+ export async function createProcessThreadForUser(
50
+ transaction: string,
51
+ processInstance: ProcessInstance,
52
+ assignee: User,
53
+ context: ResolverContext
54
+ ): Promise<ProcessThread> {
55
+ const { domain, user, tx } = context.state
56
+
57
+ const threadRepo = tx.getRepository(ProcessThread)
58
+ const now = new Date()
59
+
60
+ const result = await threadRepo.save({
61
+ domain,
62
+ assignee,
63
+ state: ProcessThreadStatus.Assigned,
64
+ processInstance,
65
+ transaction,
66
+ dueAt: processInstance.dueAt,
67
+ assignedAt: now,
68
+ creator: user,
69
+ updater: user,
70
+ createdAt: now
71
+ })
72
+
73
+ await updateProcessInstanceState(processInstance.id, context)
74
+
75
+ return result
76
+ }
77
+
78
+ export function fillProcessSearchKeys(searchKeys: ProcessSearchKeyItem[], input: { [key: string]: any }) {
79
+ if (!input || typeof input !== 'object') {
80
+ return
81
+ }
82
+
83
+ return searchKeys?.reduce((sum, key, index) => {
84
+ const value = input[key.inputKey]
85
+ if (value != null) {
86
+ sum[`key0${index + 1}`] = value instanceof Array ? value[0] : value
87
+ }
88
+ return sum
89
+ }, {})
90
+ }
File without changes
@@ -0,0 +1,75 @@
1
+ import { ProcessThreadStatus } from '../../service/process-thread/process-thread'
2
+ import { ProcessInstance, ProcessInstanceStatus } from '../../service/process-instance/process-instance'
3
+ import { evalProcessInstanceState } from '../common'
4
+
5
+ import { _abort as abortProcessThread } from '../process-thread/_abort'
6
+
7
+ export async function abort(
8
+ { id, reason }: { id: string; reason: string },
9
+ context: ResolverContext
10
+ ): Promise<ProcessInstance> {
11
+ const { domain, user, tx } = context.state
12
+
13
+ var repository = tx.getRepository(ProcessInstance)
14
+
15
+ var processInstance = await repository.findOne({
16
+ where: { domain: { id: domain.id }, id },
17
+ relations: [
18
+ 'domain',
19
+ 'process',
20
+ 'processThreads',
21
+ 'assigneeRole',
22
+ 'supervisoryRole',
23
+ 'updater',
24
+ 'creator',
25
+ 'starter',
26
+ 'terminator'
27
+ ]
28
+ })
29
+
30
+ if (!processInstance) {
31
+ throw new Error(
32
+ context.t('error.process-instance not found', {
33
+ processInstance: id
34
+ })
35
+ )
36
+ }
37
+
38
+ /*
39
+ Prerequisites for a Task to Be Aborted.
40
+ - The previous state of the task must not be End or Aborted.
41
+ */
42
+ if (processInstance.state == ProcessInstanceStatus.Aborted || processInstance.state == ProcessInstanceStatus.Ended) {
43
+ throw new Error(
44
+ context.t(`error.process-instance is already terminated`, {
45
+ id,
46
+ state: processInstance.state
47
+ })
48
+ )
49
+ }
50
+
51
+ /*
52
+ Actions to be processed when a task is aborted
53
+ - All related process threads must be aborted.
54
+ */
55
+
56
+ const TERMINATED = [ProcessThreadStatus.Aborted, ProcessThreadStatus.Delegated, ProcessThreadStatus.Ended]
57
+
58
+ for (let processThread of processInstance.processThreads) {
59
+ if (TERMINATED.includes(processThread.state)) {
60
+ continue
61
+ }
62
+
63
+ await abortProcessThread({ processThread, reason }, context)
64
+ }
65
+
66
+ return await repository.save({
67
+ ...processInstance,
68
+ reason,
69
+ ...(await evalProcessInstanceState(id, context)),
70
+ transaction: 'abort',
71
+ updater: user,
72
+ terminatedAt: new Date(),
73
+ terminator: user
74
+ })
75
+ }
@@ -0,0 +1,74 @@
1
+ import { ProcessInstance, ProcessInstanceStatus } from '../../service/process-instance/process-instance'
2
+ import { ProcessThreadStatus } from '../../service/process-thread/process-thread'
3
+ import { evalProcessInstanceState } from '../common'
4
+
5
+ export async function end(
6
+ { id, output, reason }: { id: string; output?: object; reason?: string },
7
+ context: ResolverContext
8
+ ): Promise<ProcessInstance> {
9
+ const { domain, user, tx } = context.state
10
+ const repository = tx.getRepository(ProcessInstance)
11
+
12
+ var processInstance = await repository.findOne({
13
+ where: { domain: { id: domain.id }, id },
14
+ relations: [
15
+ 'domain',
16
+ 'process',
17
+ 'processThreads',
18
+ 'assigneeRole',
19
+ 'supervisoryRole',
20
+ 'updater',
21
+ 'creator',
22
+ 'starter',
23
+ 'terminator'
24
+ ]
25
+ })
26
+
27
+ if (!processInstance) {
28
+ throw new Error(
29
+ context.t('error.process-instance not found', {
30
+ processInstance: id
31
+ })
32
+ )
33
+ }
34
+
35
+ /*
36
+ Prerequisites for a Task to Be End.
37
+ - The previous state of the task must not be End or Aborted.
38
+ - There should be no unfinished process threads.
39
+ */
40
+ if (processInstance.state == ProcessInstanceStatus.Aborted || processInstance.state == ProcessInstanceStatus.Ended) {
41
+ throw new Error(
42
+ context.t(`error.process-instance is already terminated`, {
43
+ id,
44
+ state: processInstance.state
45
+ })
46
+ )
47
+ }
48
+
49
+ const TERMINATED = [ProcessThreadStatus.Aborted, ProcessThreadStatus.Delegated, ProcessThreadStatus.Ended]
50
+
51
+ for (let processThread of processInstance.processThreads) {
52
+ if (TERMINATED.includes(processThread.state)) {
53
+ continue
54
+ }
55
+
56
+ throw new Error(
57
+ context.t(`error.all process threads should be terminated`, {
58
+ processThread: processThread.id,
59
+ state: processInstance.state
60
+ })
61
+ )
62
+ }
63
+
64
+ return await repository.save({
65
+ ...processInstance,
66
+ reason,
67
+ output,
68
+ transaction: 'end',
69
+ state: await evalProcessInstanceState(id, context),
70
+ updater: user,
71
+ terminatedAt: new Date(),
72
+ terminator: user
73
+ } as any)
74
+ }
@@ -0,0 +1,2 @@
1
+ export * from './abort'
2
+ export * from './end'
@@ -0,0 +1,20 @@
1
+ import { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'
2
+
3
+ export async function _abort(
4
+ { processThread, reason }: { processThread: ProcessThread; reason: string },
5
+ context: ResolverContext
6
+ ): Promise<ProcessThread> {
7
+ const { domain, user, tx } = context.state
8
+
9
+ var repository = tx.getRepository(ProcessThread)
10
+
11
+ return await repository.save({
12
+ ...processThread,
13
+ reason,
14
+ state: ProcessThreadStatus.Aborted,
15
+ transaction: 'abort',
16
+ updater: user,
17
+ terminatedAt: new Date(),
18
+ terminator: user
19
+ })
20
+ }
@@ -0,0 +1,48 @@
1
+ import { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'
2
+ import { updateProcessInstanceState } from '../common'
3
+ import { _abort } from './_abort'
4
+
5
+ export async function abort(
6
+ { id, reason }: { id: string; reason: string },
7
+ context: ResolverContext
8
+ ): Promise<ProcessThread> {
9
+ const { domain, user, tx } = context.state
10
+
11
+ var repository = tx.getRepository(ProcessThread)
12
+
13
+ var processThread = await repository.findOne({
14
+ where: { domain: { id: domain.id }, id },
15
+ relations: ['domain', 'processInstance', 'assignee', 'creator', 'updater']
16
+ })
17
+
18
+ if (!processThread) {
19
+ throw new Error(
20
+ context.t('error.process-thread not found', {
21
+ processThread: id
22
+ })
23
+ )
24
+ }
25
+
26
+ /*
27
+ Prerequisites for a process thread to Be Aborted.
28
+ - The previous state of the process thread must not be End or Aborted.
29
+ */
30
+ if (
31
+ processThread.state == ProcessThreadStatus.Aborted ||
32
+ processThread.state == ProcessThreadStatus.Ended ||
33
+ processThread.state == ProcessThreadStatus.Delegated
34
+ ) {
35
+ throw new Error(
36
+ context.t(`error.process-thread is already terminated`, {
37
+ id,
38
+ state: processThread.state
39
+ })
40
+ )
41
+ }
42
+
43
+ const result = await _abort({ processThread, reason }, context)
44
+
45
+ await updateProcessInstanceState(processThread.processInstanceId, context)
46
+
47
+ return result
48
+ }
@@ -0,0 +1,54 @@
1
+ import { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'
2
+ import { updateProcessInstanceState } from '../common'
3
+
4
+ export async function end(
5
+ { id, output, reason }: { id: string; output?: object; reason?: string },
6
+ context: ResolverContext
7
+ ): Promise<ProcessThread> {
8
+ const { domain, user, tx } = context.state
9
+
10
+ const repository = tx.getRepository(ProcessThread)
11
+
12
+ var processThread = await repository.findOne({
13
+ where: { domain: { id: domain.id }, id }
14
+ })
15
+
16
+ if (!processThread) {
17
+ throw new Error(
18
+ context.t('error.process-thread not found', {
19
+ processThread: id
20
+ })
21
+ )
22
+ }
23
+
24
+ /*
25
+ Prerequisites for a process thread to Be End.
26
+ - The previous state of the process thread must not be End or End.
27
+ */
28
+ if (
29
+ processThread.state == ProcessThreadStatus.Aborted ||
30
+ processThread.state == ProcessThreadStatus.Ended ||
31
+ processThread.state == ProcessThreadStatus.Delegated
32
+ ) {
33
+ throw new Error(
34
+ context.t(`error.process-thread is already terminated`, {
35
+ id,
36
+ actual: processThread.state
37
+ })
38
+ )
39
+ }
40
+
41
+ processThread = await repository.save({
42
+ ...processThread,
43
+ reason,
44
+ output,
45
+ transaction: 'end',
46
+ state: ProcessThreadStatus.Ended,
47
+ updater: user,
48
+ terminatedAt: new Date()
49
+ })
50
+
51
+ await updateProcessInstanceState(processThread.processInstanceId, context)
52
+
53
+ return processThread
54
+ }
@@ -0,0 +1,3 @@
1
+ export * from './abort'
2
+ export * from './end'
3
+ export * from './start'
@@ -0,0 +1,49 @@
1
+ import { ProcessThread, ProcessThreadStatus } from '../../service/process-thread/process-thread'
2
+ import { updateProcessInstanceState } from '../common'
3
+
4
+ export async function start(
5
+ id: string,
6
+ output: object,
7
+ reason: string,
8
+ context: ResolverContext
9
+ ): Promise<ProcessThread> {
10
+ const { domain, user, tx } = context.state
11
+
12
+ const repository = tx.getRepository(ProcessThread)
13
+ const processThread = await repository.findOne({
14
+ where: { domain: { id: domain.id }, id }
15
+ })
16
+
17
+ if (!processThread) {
18
+ throw new Error(
19
+ context.t('error.process-thread not found', {
20
+ processThread: id
21
+ })
22
+ )
23
+ }
24
+
25
+ /*
26
+ Prerequisites for a process thread to Be Started.
27
+ - The previous state of the process thread must not be terminated.
28
+ */
29
+ if (processThread.state !== ProcessThreadStatus.Assigned) {
30
+ throw new Error(
31
+ context.t(`error.process-thread should not be started`, {
32
+ id,
33
+ actual: processThread.state
34
+ })
35
+ )
36
+ }
37
+
38
+ const result = await tx.getRepository(ProcessThread).save({
39
+ ...processThread,
40
+ reason,
41
+ state: ProcessThreadStatus.Started,
42
+ transaction: 'start',
43
+ updater: user
44
+ })
45
+
46
+ await updateProcessInstanceState(processThread.processInstanceId, context)
47
+
48
+ return result
49
+ }
@@ -0,0 +1,4 @@
1
+ export * from './migrations'
2
+ export * from './middlewares'
3
+
4
+ import './routes'
@@ -0,0 +1,3 @@
1
+ export function initMiddlewares(app) {
2
+ /* can add middlewares into app */
3
+ }
@@ -0,0 +1,9 @@
1
+ const glob = require('glob')
2
+ const path = require('path')
3
+
4
+ export var migrations = []
5
+
6
+ glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {
7
+ if (file.indexOf('index.js') !== -1) return
8
+ migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])
9
+ })
@@ -0,0 +1,80 @@
1
+ const debug = require('debug')('things-factory:process:routes')
2
+
3
+ process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {
4
+ /*
5
+ * can add global public routes to application (auth not required, tenancy not required)
6
+ *
7
+ * ex) routes.get('/path', async(context, next) => {})
8
+ * ex) routes.post('/path', async(context, next) => {})
9
+ */
10
+ })
11
+
12
+ process.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {
13
+ /*
14
+ * can add global private routes to application (auth required, tenancy not required)
15
+ */
16
+ /* When a callback occurs from the scheduler when a scheduled dataset is on schedule, data collection task for the dataset should be issued. */
17
+ // globalPrivateRouter.post('/callback-schedule-for-start-event', async (context, next) => {
18
+ // const { client } = context.request.body as ScheduleRegisterRequest
19
+ // if (!client || typeof client !== 'object') {
20
+ // throw new Error('client property should be a part of callback body.')
21
+ // }
22
+ // const { group: domainId, key: dataSetId } = client
23
+ // if (!domainId || !dataSetId) {
24
+ // throw new Error(`group(${domainId}) and key(${dataSetId}) properties should not be empty`)
25
+ // }
26
+ // await getDataSource().transaction(async tx => {
27
+ // const domain = await tx.getRepository(Domain).findOneBy({ id: domainId })
28
+ // if (!domain) {
29
+ // throw new Error(`domain(${domainId}) not found`)
30
+ // }
31
+ // const dataSet = await tx.getRepository(DataSet).findOne({ where: { domain: { id: domainId }, id: dataSetId } })
32
+ // const activity = (await tx.getRepository(Activity).findOneBy({
33
+ // domain: { id: domainId },
34
+ // name: 'Collect Data'
35
+ // })) as Activity
36
+ // if (activity) {
37
+ // const { assignees } = dataSet
38
+ // /* 해당 dataset에 대한 데이타 수집 태스크를 dataset assignees에게 할당한다. */
39
+ // if (assignees && assignees instanceof Array && assignees.length > 0) {
40
+ // const activityInstance = {
41
+ // name: `[Data 수집] ${dataSet.name}`,
42
+ // description: dataSet.description,
43
+ // activityId: activity.id,
44
+ // dueAt: new Date(Date.now() + 24 * 60 * 60 * 1000),
45
+ // input: {
46
+ // dataSetId: dataSet.id,
47
+ // dataSetName: dataSet.name
48
+ // },
49
+ // assignees
50
+ // }
51
+ // context.state = {
52
+ // ...context.state,
53
+ // domain,
54
+ // tx
55
+ // }
56
+ // await issue(activityInstance, context)
57
+ // } else {
58
+ // throw new Error(
59
+ // `Assignees not set. So Data Collect Activity for ${dataSet.name}($dataSet.id) could not be issued.`
60
+ // )
61
+ // }
62
+ // } else {
63
+ // throw new Error(`Data Collect Activity is not installed.`)
64
+ // }
65
+ // })
66
+ // context.status = 200
67
+ // })
68
+ })
69
+
70
+ process.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {
71
+ /*
72
+ * can add domain public routes to application (auth not required, tenancy required)
73
+ */
74
+ })
75
+
76
+ process.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {
77
+ /*
78
+ * can add domain private routes to application (auth required, tenancy required)
79
+ */
80
+ })
@@ -0,0 +1,44 @@
1
+ /* EXPORT ENTITY TYPES */
2
+ export * from './process-thread/process-thread'
3
+ export * from './process-instance/process-instance'
4
+ export * from './process/process'
5
+
6
+ /* IMPORT ENTITIES AND RESOLVERS */
7
+ import {
8
+ entities as ProcessThreadEntities,
9
+ resolvers as ProcessThreadResolvers,
10
+ subscribers as ProcessThreadSubscribers
11
+ } from './process-thread'
12
+ import {
13
+ entities as ProcessInstanceEntities,
14
+ resolvers as ProcessInstanceResolvers,
15
+ subscribers as ProcessInstanceSubscribers
16
+ } from './process-instance'
17
+ import {
18
+ entities as ProcessEntities,
19
+ resolvers as ProcessResolvers,
20
+ subscribers as ProcessSubscribers
21
+ } from './process'
22
+
23
+ export const entities = [
24
+ /* ENTITIES */
25
+ ...ProcessThreadEntities,
26
+ ...ProcessInstanceEntities,
27
+ ...ProcessEntities
28
+ ]
29
+
30
+ export const subscribers = [
31
+ /* SUBSCRIBERS */
32
+ ...ProcessThreadSubscribers,
33
+ ...ProcessInstanceSubscribers,
34
+ ...ProcessSubscribers
35
+ ]
36
+
37
+ export const schema = {
38
+ resolverClasses: [
39
+ /* RESOLVER CLASSES */
40
+ ...ProcessThreadResolvers,
41
+ ...ProcessInstanceResolvers,
42
+ ...ProcessResolvers
43
+ ]
44
+ }
@@ -0,0 +1,17 @@
1
+ import { EventSubscriber } from 'typeorm'
2
+
3
+ import { HistoryEntitySubscriber } from '@operato/typeorm-history'
4
+
5
+ import { Process } from './process'
6
+ import { ProcessHistory } from './process-history'
7
+
8
+ @EventSubscriber()
9
+ export class ProcessHistoryEntitySubscriber extends HistoryEntitySubscriber<Process, ProcessHistory> {
10
+ public get entity() {
11
+ return Process
12
+ }
13
+
14
+ public get historyEntity() {
15
+ return ProcessHistory
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ import { Process } from './process'
2
+ import { ProcessHistory } from './process-history'
3
+ import { ProcessMutation } from './process-mutation'
4
+ import { ProcessQuery } from './process-query'
5
+ import { ProcessHistoryEntitySubscriber } from './event-subscriber'
6
+
7
+ export const entities = [Process, ProcessHistory]
8
+ export const resolvers = [ProcessQuery, ProcessMutation]
9
+ export const subscribers = [ProcessHistoryEntitySubscriber]