@things-factory/dataset 6.0.32 → 6.0.34

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 (73) hide show
  1. package/client/activities/activity-data-collect-edit.ts +100 -0
  2. package/client/activities/activity-data-collect-view.ts +1 -20
  3. package/client/activities/activity-ooc-resolve-edit.ts +174 -0
  4. package/client/activities/activity-ooc-resolve-view.ts +10 -37
  5. package/client/activities/activity-ooc-review-edit.ts +153 -0
  6. package/client/activities/activity-ooc-review-view.ts +10 -33
  7. package/client/bootstrap.ts +3 -0
  8. package/client/pages/data-set/data-set-list-page.ts +8 -8
  9. package/dist-client/activities/activity-data-collect-edit.d.ts +19 -0
  10. package/dist-client/activities/activity-data-collect-edit.js +101 -0
  11. package/dist-client/activities/activity-data-collect-edit.js.map +1 -0
  12. package/dist-client/activities/activity-data-collect-view.d.ts +0 -3
  13. package/dist-client/activities/activity-data-collect-view.js +2 -19
  14. package/dist-client/activities/activity-data-collect-view.js.map +1 -1
  15. package/dist-client/activities/activity-ooc-resolve-edit.d.ts +1 -0
  16. package/dist-client/activities/activity-ooc-resolve-edit.js +175 -0
  17. package/dist-client/activities/activity-ooc-resolve-edit.js.map +1 -0
  18. package/dist-client/activities/activity-ooc-resolve-view.js +12 -36
  19. package/dist-client/activities/activity-ooc-resolve-view.js.map +1 -1
  20. package/dist-client/activities/activity-ooc-review-edit.d.ts +1 -0
  21. package/dist-client/activities/activity-ooc-review-edit.js +155 -0
  22. package/dist-client/activities/activity-ooc-review-edit.js.map +1 -0
  23. package/dist-client/activities/activity-ooc-review-view.js +10 -29
  24. package/dist-client/activities/activity-ooc-review-view.js.map +1 -1
  25. package/dist-client/bootstrap.d.ts +3 -0
  26. package/dist-client/bootstrap.js +3 -0
  27. package/dist-client/bootstrap.js.map +1 -1
  28. package/dist-client/components/data-collect-activity-view.d.ts +19 -0
  29. package/dist-client/components/data-collect-activity-view.js +101 -0
  30. package/dist-client/components/data-collect-activity-view.js.map +1 -0
  31. package/dist-client/components/data-ooc-activity-view.d.ts +1 -0
  32. package/dist-client/components/data-ooc-activity-view.js +154 -0
  33. package/dist-client/components/data-ooc-activity-view.js.map +1 -0
  34. package/dist-client/components/ooc-resolve-activity-view.d.ts +1 -0
  35. package/dist-client/components/ooc-resolve-activity-view.js +175 -0
  36. package/dist-client/components/ooc-resolve-activity-view.js.map +1 -0
  37. package/dist-client/components/ooc-review-activity-view.d.ts +1 -0
  38. package/dist-client/components/ooc-review-activity-view.js +155 -0
  39. package/dist-client/components/ooc-review-activity-view.js.map +1 -0
  40. package/dist-client/pages/data-set/data-set-list-page.js +8 -8
  41. package/dist-client/pages/data-set/data-set-list-page.js.map +1 -1
  42. package/dist-client/tsconfig.tsbuildinfo +1 -1
  43. package/dist-server/activities/activity-data-collect.js +1 -1
  44. package/dist-server/activities/activity-data-collect.js.map +1 -1
  45. package/dist-server/activities/activity-ooc-resolve.js +2 -2
  46. package/dist-server/activities/activity-ooc-resolve.js.map +1 -1
  47. package/dist-server/activities/activity-ooc-review.js +2 -2
  48. package/dist-server/activities/activity-ooc-review.js.map +1 -1
  49. package/dist-server/controllers/activity-template/activity-data-collect.js +82 -0
  50. package/dist-server/controllers/activity-template/activity-data-collect.js.map +1 -0
  51. package/dist-server/controllers/activity-template/activity-ooc-resolve.js +100 -0
  52. package/dist-server/controllers/activity-template/activity-ooc-resolve.js.map +1 -0
  53. package/dist-server/controllers/activity-template/activity-ooc-review.js +107 -0
  54. package/dist-server/controllers/activity-template/activity-ooc-review.js.map +1 -0
  55. package/dist-server/controllers/activity-template/activity-ooc.js +59 -0
  56. package/dist-server/controllers/activity-template/activity-ooc.js.map +1 -0
  57. package/dist-server/routes.js +14 -4
  58. package/dist-server/routes.js.map +1 -1
  59. package/dist-server/service/data-set/data-set-mutation.js +8 -7
  60. package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
  61. package/dist-server/service/data-set/data-set-query.js +1 -1
  62. package/dist-server/service/data-set/data-set-query.js.map +1 -1
  63. package/dist-server/service/data-set/data-set.js +2 -2
  64. package/dist-server/service/data-set/data-set.js.map +1 -1
  65. package/dist-server/tsconfig.tsbuildinfo +1 -1
  66. package/package.json +11 -11
  67. package/server/activities/activity-data-collect.ts +1 -1
  68. package/server/activities/activity-ooc-resolve.ts +2 -2
  69. package/server/activities/activity-ooc-review.ts +2 -2
  70. package/server/routes.ts +22 -5
  71. package/server/service/data-set/data-set-mutation.ts +6 -6
  72. package/server/service/data-set/data-set-query.ts +1 -1
  73. package/server/service/data-set/data-set.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "6.0.32",
3
+ "version": "6.0.34",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -35,17 +35,17 @@
35
35
  "@operato/shell": "^1.0.1",
36
36
  "@operato/styles": "^1.0.0",
37
37
  "@operato/utils": "^1.0.1",
38
- "@things-factory/auth-base": "^6.0.32",
39
- "@things-factory/aws-base": "^6.0.32",
40
- "@things-factory/board-service": "^6.0.32",
41
- "@things-factory/env": "^6.0.32",
42
- "@things-factory/organization": "^6.0.32",
43
- "@things-factory/scheduler-client": "^6.0.32",
44
- "@things-factory/shell": "^6.0.32",
45
- "@things-factory/work-shift": "^6.0.32",
46
- "@things-factory/worklist": "^6.0.32",
38
+ "@things-factory/auth-base": "^6.0.34",
39
+ "@things-factory/aws-base": "^6.0.34",
40
+ "@things-factory/board-service": "^6.0.34",
41
+ "@things-factory/env": "^6.0.34",
42
+ "@things-factory/organization": "^6.0.34",
43
+ "@things-factory/scheduler-client": "^6.0.34",
44
+ "@things-factory/shell": "^6.0.34",
45
+ "@things-factory/work-shift": "^6.0.34",
46
+ "@things-factory/worklist": "^6.0.34",
47
47
  "cron-parser": "^4.3.0",
48
48
  "moment-timezone": "^0.5.40"
49
49
  },
50
- "gitHead": "1b7b1eb2d2e1c0823ec69ee8160790c5da62072c"
50
+ "gitHead": "a460e5183f6e97e061be886d1efe9a114bd1316b"
51
51
  }
@@ -76,7 +76,7 @@ export const ActivityDataCollect = {
76
76
  }
77
77
  ],
78
78
  uiType: 'custom-element',
79
- uiSource: 'activity-data-collect-view',
79
+ uiSource: 'activity-data-collect-edit',
80
80
  viewType: 'custom-element',
81
81
  viewSource: 'activity-data-collect-view',
82
82
  reportType: 'custom-element',
@@ -106,9 +106,9 @@ export const ActivityOocResolve = {
106
106
  }
107
107
  ],
108
108
  uiType: 'custom-element',
109
- uiSource: 'activity-ooc-resolve-view',
109
+ uiSource: 'activity-ooc-resolve-edit',
110
110
  viewType: 'custom-element',
111
- viewSource: 'activity-data-collect-view',
111
+ viewSource: 'activity-ooc-resolve-view',
112
112
  reportType: 'custom-element',
113
113
  reportSource: 'data-ooc-report-page',
114
114
  thumbnail: '/assets/images/ooc.png',
@@ -110,9 +110,9 @@ export const ActivityOocReview = {
110
110
  }
111
111
  ],
112
112
  uiType: 'custom-element',
113
- uiSource: 'activity-ooc-review-view',
113
+ uiSource: 'activity-ooc-review-edit',
114
114
  viewType: 'custom-element',
115
- viewSource: 'activity-data-collect-view',
115
+ viewSource: 'activity-ooc-review-view',
116
116
  reportType: 'custom-element',
117
117
  reportSource: 'data-ooc-report-page',
118
118
  thumbnail: '/assets/images/ooc.png',
package/server/routes.ts CHANGED
@@ -1,7 +1,9 @@
1
+ import { logger } from '@things-factory/env'
1
2
  import { Domain, getDataSource } from '@things-factory/shell'
2
3
  import { User } from '@things-factory/auth-base'
3
4
  import { Activity } from '@things-factory/worklist'
4
5
  import { post } from '@things-factory/worklist/dist-server/controllers/activity-instance/post'
6
+ import { ScheduleRegisterRequest } from '@things-factory/scheduler-client'
5
7
 
6
8
  import { createDataSample } from './controllers/create-data-sample'
7
9
  import { renderJasperReport } from './controllers/jasper-report'
@@ -80,10 +82,25 @@ process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRout
80
82
 
81
83
  /* When a callback occurs from the scheduler when a scheduled dataset is on schedule, data collection task for the dataset should be issued. */
82
84
  globalPublicRouter.post('/callback-schedule-for-dataset', async (context, next) => {
83
- const { domainId, dataSetId } = context.request.body
85
+ const { client } = context.request.body as ScheduleRegisterRequest
84
86
 
85
- getDataSource().transaction(async tx => {
87
+ if (!client || typeof client !== 'object') {
88
+ throw new Error('client property should be a part of callback body.')
89
+ }
90
+
91
+ const { group: domainId, key: dataSetId } = client
92
+
93
+ if (!domainId || !dataSetId) {
94
+ throw new Error(`group(${domainId}) and key(${dataSetId}) properties should not be empty`)
95
+ }
96
+
97
+ await getDataSource().transaction(async tx => {
86
98
  const domain = await tx.getRepository(Domain).findOneBy({ id: domainId })
99
+
100
+ if (!domain) {
101
+ throw new Error(`domain(${domainId}) not found`)
102
+ }
103
+
87
104
  const dataSet = await tx.getRepository(DataSet).findOne({ where: { domain: { id: domainId }, id: dataSetId } })
88
105
 
89
106
  const activity = (await tx.getRepository(Activity).findOneBy({
@@ -116,12 +133,12 @@ process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRout
116
133
 
117
134
  await post(activityInstance, context)
118
135
  } else {
119
- console.error(
120
- `Assignees not set. So Data Collec Activity for ${dataSet.name}($dataSet.id) could not be posted.`
136
+ throw new Error(
137
+ `Assignees not set. So Data Collect Activity for ${dataSet.name}($dataSet.id) could not be posted.`
121
138
  )
122
139
  }
123
140
  } else {
124
- console.error(`Data Collec Activity is not installed.`)
141
+ throw new Error(`Data Collect Activity is not installed.`)
125
142
  }
126
143
  })
127
144
 
@@ -194,8 +194,8 @@ export class DataSetMutation {
194
194
  }
195
195
  },
196
196
  data: {
197
- application: 'dataset',
198
- id: dataSet.id
197
+ domainId: domain.id,
198
+ dataSetId
199
199
  },
200
200
  history_check: true,
201
201
  failed_policy: 'retry_dlq',
@@ -206,10 +206,10 @@ export class DataSetMutation {
206
206
 
207
207
  return await repository.save({
208
208
  ...dataSet,
209
- schedulerHandle: handle
209
+ scheduleId: handle
210
210
  })
211
211
  } catch (err) {
212
- console.error('stopDataCollectionSchedule', err)
212
+ console.error('startDataCollectionSchedule', err)
213
213
  }
214
214
  }
215
215
 
@@ -238,11 +238,11 @@ export class DataSetMutation {
238
238
  }
239
239
 
240
240
  try {
241
- await unregisterSchedule(dataSet.schedulerHandle)
241
+ await unregisterSchedule(dataSet.scheduleId)
242
242
 
243
243
  return await repository.save({
244
244
  ...dataSet,
245
- schedulerHandle: null
245
+ scheduleId: null
246
246
  })
247
247
  } catch (err) {
248
248
  console.error('stopDataCollectionSchedule', err)
@@ -127,7 +127,7 @@ export class DataSetQuery {
127
127
  // get information from scheduler service
128
128
  return {
129
129
  id: '',
130
- schedulerHandle: '',
130
+ scheduleId: '',
131
131
  state: '',
132
132
  startedAt: new Date(),
133
133
  nextSchedule: new Date()
@@ -66,7 +66,7 @@ export class DataSetState {
66
66
  id: string
67
67
 
68
68
  @Field()
69
- schedulerHandle: string
69
+ scheduleId: string
70
70
 
71
71
  @Field()
72
72
  state: string
@@ -197,7 +197,7 @@ export class DataSet {
197
197
 
198
198
  @Column({ nullable: true })
199
199
  @Field({ nullable: true })
200
- schedulerHandle?: string
200
+ scheduleId?: string
201
201
 
202
202
  @CreateDateColumn()
203
203
  @Field({ nullable: true })