@things-factory/worklist 10.1.258 → 10.1.260

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 (57) hide show
  1. package/dist-client/chip-counts.d.ts +13 -0
  2. package/dist-client/chip-counts.js +11 -0
  3. package/dist-client/chip-counts.js.map +1 -1
  4. package/dist-client/chip-filters.d.ts +29 -0
  5. package/dist-client/chip-filters.js +17 -1
  6. package/dist-client/chip-filters.js.map +1 -1
  7. package/dist-client/pages/approval-progress/approval-progress-page.d.ts +0 -4
  8. package/dist-client/pages/approval-progress/approval-progress-page.js +37 -31
  9. package/dist-client/pages/approval-progress/approval-progress-page.js.map +1 -1
  10. package/dist-client/pages/todo/approval-pending-list-page.d.ts +2 -3
  11. package/dist-client/pages/todo/approval-pending-list-page.js +33 -47
  12. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  13. package/dist-client/pages/todo/draft-list-page.js +13 -10
  14. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  15. package/dist-client/pages/todo/todo-list-page.d.ts +0 -3
  16. package/dist-client/pages/todo/todo-list-page.js +30 -42
  17. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  18. package/dist-client/tsconfig.tsbuildinfo +1 -1
  19. package/dist-server/controllers/activity-installation/activity-installation-controller.js +1 -0
  20. package/dist-server/controllers/activity-installation/activity-installation-controller.js.map +1 -1
  21. package/dist-server/controllers/activity-installation/installable-to-activity.d.ts +10 -0
  22. package/dist-server/controllers/activity-installation/installable-to-activity.js +22 -1
  23. package/dist-server/controllers/activity-installation/installable-to-activity.js.map +1 -1
  24. package/dist-server/controllers/activity-instance/assign.js +7 -2
  25. package/dist-server/controllers/activity-instance/assign.js.map +1 -1
  26. package/dist-server/controllers/activity-instance/complete.d.ts +13 -0
  27. package/dist-server/controllers/activity-instance/complete.js +58 -0
  28. package/dist-server/controllers/activity-instance/complete.js.map +1 -0
  29. package/dist-server/controllers/activity-instance/index.d.ts +1 -0
  30. package/dist-server/controllers/activity-instance/index.js +1 -0
  31. package/dist-server/controllers/activity-instance/index.js.map +1 -1
  32. package/dist-server/service/activity-approval/activity-approval.d.ts +3 -0
  33. package/dist-server/service/activity-approval/activity-approval.js +8 -0
  34. package/dist-server/service/activity-approval/activity-approval.js.map +1 -1
  35. package/dist-server/service/activity-instance/event-subscriber.d.ts +1 -0
  36. package/dist-server/service/activity-instance/event-subscriber.js +11 -0
  37. package/dist-server/service/activity-instance/event-subscriber.js.map +1 -1
  38. package/dist-server/service/approval-notice/approval-notice.js +3 -2
  39. package/dist-server/service/approval-notice/approval-notice.js.map +1 -1
  40. package/dist-server/service/approval-progress/approval-progress-query.js +4 -0
  41. package/dist-server/service/approval-progress/approval-progress-query.js.map +1 -1
  42. package/dist-server/service/approval-progress/approval-progress-rule.d.ts +4 -0
  43. package/dist-server/service/approval-progress/approval-progress-rule.js +8 -0
  44. package/dist-server/service/approval-progress/approval-progress-rule.js.map +1 -1
  45. package/dist-server/service/approval-progress/approval-progress-type.d.ts +1 -0
  46. package/dist-server/service/approval-progress/approval-progress-type.js +4 -0
  47. package/dist-server/service/approval-progress/approval-progress-type.js.map +1 -1
  48. package/dist-server/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +12 -12
  50. package/tests/assign-role-pool.test.ts +27 -1
  51. package/tests/complete-db.test.ts +62 -0
  52. package/translations/en.json +3 -2
  53. package/translations/es.json +3 -2
  54. package/translations/ja.json +3 -2
  55. package/translations/ko.json +3 -2
  56. package/translations/ms.json +3 -2
  57. package/translations/zh.json +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/worklist",
3
- "version": "10.1.258",
3
+ "version": "10.1.260",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "exports": {
@@ -57,16 +57,16 @@
57
57
  "@operato/p13n": "^10.29.43",
58
58
  "@operato/popup": "^10.29.43",
59
59
  "@operato/shell": "^10.29.69",
60
- "@things-factory/attachment-base": "^10.1.258",
61
- "@things-factory/auth-base": "^10.1.258",
62
- "@things-factory/board-service": "^10.1.258",
63
- "@things-factory/context-ui": "^10.1.258",
64
- "@things-factory/i18n-base": "^10.1.258",
65
- "@things-factory/notification": "^10.1.258",
66
- "@things-factory/organization": "^10.1.258",
67
- "@things-factory/personalization": "^10.1.258",
68
- "@things-factory/scheduler-client": "^10.1.258",
69
- "@things-factory/shell": "^10.1.258"
60
+ "@things-factory/attachment-base": "^10.1.260",
61
+ "@things-factory/auth-base": "^10.1.260",
62
+ "@things-factory/board-service": "^10.1.260",
63
+ "@things-factory/context-ui": "^10.1.260",
64
+ "@things-factory/i18n-base": "^10.1.260",
65
+ "@things-factory/notification": "^10.1.260",
66
+ "@things-factory/organization": "^10.1.260",
67
+ "@things-factory/personalization": "^10.1.260",
68
+ "@things-factory/scheduler-client": "^10.1.260",
69
+ "@things-factory/shell": "^10.1.260"
70
70
  },
71
- "gitHead": "c7b7e3b4e9aa1b36a246ccee312a4124a50924dd"
71
+ "gitHead": "72de583ba0394dcf8195ef723b0ee4217507e0e5"
72
72
  }
@@ -19,6 +19,8 @@ const { createSqliteTestDataSource } = require(join(__dirname, '..', '..', 'ops-
19
19
  const DIST = join(__dirname, '..', 'dist-server')
20
20
  const { Activity } = require(join(DIST, 'service', 'activity', 'activity.js'))
21
21
  const { ActivityInstance } = require(join(DIST, 'service', 'activity-instance', 'activity-instance.js'))
22
+ const { ActivityInstanceHistory } = require(join(DIST, 'service', 'activity-instance', 'activity-instance-history.js'))
23
+ const { ActivityInstanceHistoryEntitySubscriber } = require(join(DIST, 'service', 'activity-instance', 'event-subscriber.js'))
22
24
  const { ActivityThread } = require(join(DIST, 'service', 'activity-thread', 'activity-thread.js'))
23
25
  const { ActivityApproval } = require(join(DIST, 'service', 'activity-approval', 'activity-approval.js'))
24
26
  const { myOpenThreadsWhere } = require(join(DIST, 'service', 'activity-thread', 'my-open-threads.js'))
@@ -46,7 +48,10 @@ let theirPool: any
46
48
  let activity: any
47
49
 
48
50
  beforeAll(async () => {
49
- db = createSqliteTestDataSource([Activity, ActivityInstance, ActivityThread, ActivityApproval])
51
+ /* The case's history subscriber is on, as on a server - every write here also writes a history row or is refused. */
52
+ db = createSqliteTestDataSource([Activity, ActivityInstance, ActivityInstanceHistory, ActivityThread, ActivityApproval], {
53
+ subscribers: [ActivityInstanceHistoryEntitySubscriber]
54
+ })
50
55
  await db.initialize()
51
56
 
52
57
  here = await db.getRepository(Domain).save({ name: 'here', subdomain: 'here' })
@@ -85,6 +90,10 @@ const reread = (instance: any) =>
85
90
  /** The pool's role ids, in no particular order - sorted to compare. */
86
91
  const poolOf = (row: any) => (row?.assigneeRoles || []).map((role: any) => role.id).sort()
87
92
 
93
+ /** The case's last history row - what its history says it is now. */
94
+ const lastHistoryOf = async (instance: any) =>
95
+ (await db.getRepository(ActivityInstanceHistory).find({ where: { originalId: instance.id }, order: { version: 'DESC' } }))[0]
96
+
88
97
  const threadsOf = (instance: any) => db.getRepository(ActivityThread).find({ where: { activityInstance: { id: instance.id } } })
89
98
 
90
99
  /** The to-do list's own condition (my-open-threads.ts), for one case. */
@@ -154,6 +163,23 @@ describe('assign to a role', () => {
154
163
  expect(await onTheListOf(member, [pool], instance)).toBe(0)
155
164
  })
156
165
 
166
+ it("the case's history keeps the pool it was put in, and the one it moved to", async () => {
167
+ const instance = await aCase({ name: 'pay the invoice' })
168
+
169
+ await assignAs(manager, { id: instance.id, assigneeRoles: [pool.id] })
170
+
171
+ const put = await lastHistoryOf(instance)
172
+ expect(put.name).toBe('pay the invoice')
173
+ expect(put.assigneeRoleIds).toEqual([pool.id])
174
+ expect(put.threadsMin).toBe(1)
175
+
176
+ await assignAs(manager, { id: instance.id, assigneeRoles: [anotherPool.id] })
177
+
178
+ const moved = await lastHistoryOf(instance)
179
+ expect(moved.version).toBeGreaterThan(put.version)
180
+ expect(moved.assigneeRoleIds).toEqual([anotherPool.id])
181
+ })
182
+
157
183
  it.each(['assigned', 'started', 'unassigned', 'ended', 'draft'])('a case %s is refused by name and left as it was', async state => {
158
184
  const instance = await aCase({ state })
159
185
 
@@ -0,0 +1,62 @@
1
+ import { join } from 'path'
2
+
3
+ /**
4
+ * Completing a case whose work is done (`complete`), through the real controllers on sqlite: a to-do handed to two
5
+ * people ends as done for both - every thread ended, the case ended - where `abort` would have said aborted.
6
+ *
7
+ * Reads dist-server - run the package's build:server first.
8
+ */
9
+
10
+ const { createSqliteTestDataSource } = require(join(__dirname, '..', '..', 'ops-master', 'test', 'support', 'database.cjs'))
11
+ const DIST = join(__dirname, '..', 'dist-server')
12
+ const { ActivityInstance } = require(join(DIST, 'service', 'activity-instance', 'activity-instance.js'))
13
+ const { ActivityThread } = require(join(DIST, 'service', 'activity-thread', 'activity-thread.js'))
14
+ const { ActivityApproval } = require(join(DIST, 'service', 'activity-approval', 'activity-approval.js'))
15
+ const { Activity } = require(join(DIST, 'service', 'activity', 'activity.js'))
16
+ const { issue } = require(join(DIST, 'controllers', 'activity-instance', 'issue.js'))
17
+ const { assign } = require(join(DIST, 'controllers', 'activity-instance', 'assign.js'))
18
+ const { complete } = require(join(DIST, 'controllers', 'activity-instance', 'complete.js'))
19
+ const { Domain } = require('@things-factory/shell')
20
+ const { User } = require('@things-factory/auth-base')
21
+ const { Employee } = require('@things-factory/organization')
22
+
23
+ let db: any
24
+ let here: any
25
+ let kim: any
26
+ let lee: any
27
+ let todo: any
28
+
29
+ beforeAll(async () => {
30
+ db = createSqliteTestDataSource([ActivityInstance, ActivityThread, ActivityApproval, Activity, Employee])
31
+ await db.initialize()
32
+ here = await db.getRepository(Domain).save({ name: 'here', subdomain: 'complete-here' })
33
+ const person = (name: string) => db.getRepository(User).save({ name, email: `${name}@example.com`, password: 'x', status: 'activated', userType: 'user', domains: [here] })
34
+ kim = await person('kim')
35
+ lee = await person('lee')
36
+ todo = await db.getRepository(Activity).save({ domain: here, name: 'Steps', activityType: 'user', startingType: 'issue', multiple: 'single', state: 'released' })
37
+ })
38
+
39
+ afterAll(async () => {
40
+ await db?.destroy()
41
+ })
42
+
43
+ const asUser = (user: any, work: (context: any) => Promise<any>) =>
44
+ db.transaction((tx: any) => work({ state: { domain: here, user, tx, afterCommit: [] }, t: (key: string) => key }))
45
+
46
+ test('a to-do held by two people ends as done for both', async () => {
47
+ const instance = await asUser(kim, async context => {
48
+ const one = await issue({ name: 'steps of a joining', description: 'steps', activityId: todo.id, assignees: [], threadsMin: 0 } as any, context)
49
+ await assign({ id: one.id, assignees: [kim.email, lee.email], reason: 'steps' }, context)
50
+ return one
51
+ })
52
+ const before = await db.getRepository(ActivityThread).find({ where: { activityInstance: { id: instance.id } } })
53
+ expect(before.map((one: any) => one.state).sort()).toEqual(['assigned', 'assigned'])
54
+
55
+ const done = await asUser(kim, context => complete({ id: instance.id, reason: 'steps done' }, context))
56
+ expect(done.state).toBe('ended')
57
+ const after = await db.getRepository(ActivityThread).find({ where: { activityInstance: { id: instance.id } } })
58
+ expect(after.map((one: any) => one.state)).toEqual(['ended', 'ended'])
59
+ expect(after.every((one: any) => one.terminatedAt)).toBe(true)
60
+
61
+ await expect(asUser(kim, context => complete({ id: instance.id }, context))).rejects.toThrow(/already terminated/)
62
+ })
@@ -409,7 +409,7 @@
409
409
  "field.approval-requester": "Requester",
410
410
  "field.approval-department": "Department",
411
411
  "field.approval-step": "Step",
412
- "field.approval-waiting-on": "Waiting on",
412
+ "field.approval-approver": "Approver",
413
413
  "field.approval-waited": "Waited",
414
414
  "field.approval-due-at": "Due",
415
415
  "field.approval-raised-at": "Raised",
@@ -421,5 +421,6 @@
421
421
  "label.approval-progress-overdue": "Overdue",
422
422
  "text.waited-days": "{days}d {hours}h",
423
423
  "text.waited-hours": "{hours}h {minutes}m",
424
- "text.waited-minutes": "{minutes}m"
424
+ "text.waited-minutes": "{minutes}m",
425
+ "label.filter": "Filter"
425
426
  }
@@ -409,7 +409,7 @@
409
409
  "field.approval-requester": "Solicitante",
410
410
  "field.approval-department": "Departamento",
411
411
  "field.approval-step": "Paso",
412
- "field.approval-waiting-on": "Espera a",
412
+ "field.approval-approver": "Aprobador",
413
413
  "field.approval-waited": "Tiempo de espera",
414
414
  "field.approval-due-at": "Vencimiento",
415
415
  "field.approval-raised-at": "Enviado",
@@ -421,5 +421,6 @@
421
421
  "label.approval-progress-overdue": "Vencido",
422
422
  "text.waited-days": "{days} d {hours} h",
423
423
  "text.waited-hours": "{hours} h {minutes} min",
424
- "text.waited-minutes": "{minutes} min"
424
+ "text.waited-minutes": "{minutes} min",
425
+ "label.filter": "Filtro"
425
426
  }
@@ -409,7 +409,7 @@
409
409
  "field.approval-requester": "申請者",
410
410
  "field.approval-department": "部署",
411
411
  "field.approval-step": "段階",
412
- "field.approval-waiting-on": "待っている人",
412
+ "field.approval-approver": "決裁者",
413
413
  "field.approval-waited": "待ち時間",
414
414
  "field.approval-due-at": "期限",
415
415
  "field.approval-raised-at": "申請日時",
@@ -421,5 +421,6 @@
421
421
  "label.approval-progress-overdue": "期限超過",
422
422
  "text.waited-days": "{days}日 {hours}時間",
423
423
  "text.waited-hours": "{hours}時間 {minutes}分",
424
- "text.waited-minutes": "{minutes}分"
424
+ "text.waited-minutes": "{minutes}分",
425
+ "label.filter": "フィルター"
425
426
  }
@@ -409,7 +409,7 @@
409
409
  "field.approval-requester": "올린 사람",
410
410
  "field.approval-department": "부서",
411
411
  "field.approval-step": "단계",
412
- "field.approval-waiting-on": "기다리는 사람",
412
+ "field.approval-approver": "결재자",
413
413
  "field.approval-waited": "기다린 시간",
414
414
  "field.approval-due-at": "기한",
415
415
  "field.approval-raised-at": "올린 때",
@@ -421,5 +421,6 @@
421
421
  "label.approval-progress-overdue": "기한 넘김",
422
422
  "text.waited-days": "{days}일 {hours}시간",
423
423
  "text.waited-hours": "{hours}시간 {minutes}분",
424
- "text.waited-minutes": "{minutes}분"
424
+ "text.waited-minutes": "{minutes}분",
425
+ "label.filter": "필터"
425
426
  }
@@ -409,7 +409,7 @@
409
409
  "field.approval-requester": "Pemohon",
410
410
  "field.approval-department": "Jabatan",
411
411
  "field.approval-step": "Langkah",
412
- "field.approval-waiting-on": "Menunggu",
412
+ "field.approval-approver": "Pelulus",
413
413
  "field.approval-waited": "Tempoh menunggu",
414
414
  "field.approval-due-at": "Tarikh akhir",
415
415
  "field.approval-raised-at": "Dihantar",
@@ -421,5 +421,6 @@
421
421
  "label.approval-progress-overdue": "Lewat tempoh",
422
422
  "text.waited-days": "{days}h {hours}j",
423
423
  "text.waited-hours": "{hours}j {minutes}m",
424
- "text.waited-minutes": "{minutes}m"
424
+ "text.waited-minutes": "{minutes}m",
425
+ "label.filter": "Penapis"
425
426
  }
@@ -409,7 +409,7 @@
409
409
  "field.approval-requester": "申请人",
410
410
  "field.approval-department": "部门",
411
411
  "field.approval-step": "步骤",
412
- "field.approval-waiting-on": "等待审批人",
412
+ "field.approval-approver": "审批人",
413
413
  "field.approval-waited": "已等待",
414
414
  "field.approval-due-at": "期限",
415
415
  "field.approval-raised-at": "提交时间",
@@ -421,5 +421,6 @@
421
421
  "label.approval-progress-overdue": "已逾期",
422
422
  "text.waited-days": "{days}天 {hours}小时",
423
423
  "text.waited-hours": "{hours}小时 {minutes}分",
424
- "text.waited-minutes": "{minutes}分"
424
+ "text.waited-minutes": "{minutes}分",
425
+ "label.filter": "筛选"
425
426
  }