@things-factory/compliance 0.0.0-stage → 10.1.254

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 (356) hide show
  1. package/dist-client/bootstrap.d.ts +2 -0
  2. package/dist-client/bootstrap.js +28 -0
  3. package/dist-client/bootstrap.js.map +1 -0
  4. package/dist-client/components/compliance-case-form.d.ts +42 -0
  5. package/dist-client/components/compliance-case-form.js +313 -0
  6. package/dist-client/components/compliance-case-form.js.map +1 -0
  7. package/dist-client/components/compliance-case-sheet.d.ts +35 -0
  8. package/dist-client/components/compliance-case-sheet.js +335 -0
  9. package/dist-client/components/compliance-case-sheet.js.map +1 -0
  10. package/dist-client/components/compliance-my-inventions.d.ts +17 -0
  11. package/dist-client/components/compliance-my-inventions.js +133 -0
  12. package/dist-client/components/compliance-my-inventions.js.map +1 -0
  13. package/dist-client/components/compliance-my-privacy-requests.d.ts +34 -0
  14. package/dist-client/components/compliance-my-privacy-requests.js +232 -0
  15. package/dist-client/components/compliance-my-privacy-requests.js.map +1 -0
  16. package/dist-client/components/compliance-my-reports.d.ts +19 -0
  17. package/dist-client/components/compliance-my-reports.js +137 -0
  18. package/dist-client/components/compliance-my-reports.js.map +1 -0
  19. package/dist-client/components/guide-link.d.ts +13 -0
  20. package/dist-client/components/guide-link.js +55 -0
  21. package/dist-client/components/guide-link.js.map +1 -0
  22. package/dist-client/components/invention-report-form.d.ts +30 -0
  23. package/dist-client/components/invention-report-form.js +188 -0
  24. package/dist-client/components/invention-report-form.js.map +1 -0
  25. package/dist-client/components/legal-todo.d.ts +10 -0
  26. package/dist-client/components/legal-todo.js +43 -0
  27. package/dist-client/components/legal-todo.js.map +1 -0
  28. package/dist-client/components/my-trainings.d.ts +18 -0
  29. package/dist-client/components/my-trainings.js +149 -0
  30. package/dist-client/components/my-trainings.js.map +1 -0
  31. package/dist-client/components/regulation-form.d.ts +26 -0
  32. package/dist-client/components/regulation-form.js +161 -0
  33. package/dist-client/components/regulation-form.js.map +1 -0
  34. package/dist-client/components/seal-use-form.d.ts +47 -0
  35. package/dist-client/components/seal-use-form.js +300 -0
  36. package/dist-client/components/seal-use-form.js.map +1 -0
  37. package/dist-client/components/training-attendance-form.d.ts +37 -0
  38. package/dist-client/components/training-attendance-form.js +186 -0
  39. package/dist-client/components/training-attendance-form.js.map +1 -0
  40. package/dist-client/components/training-certificate-form.d.ts +41 -0
  41. package/dist-client/components/training-certificate-form.js +198 -0
  42. package/dist-client/components/training-certificate-form.js.map +1 -0
  43. package/dist-client/components/training-session-form.d.ts +39 -0
  44. package/dist-client/components/training-session-form.js +270 -0
  45. package/dist-client/components/training-session-form.js.map +1 -0
  46. package/dist-client/components/training-setting-form.d.ts +45 -0
  47. package/dist-client/components/training-setting-form.js +175 -0
  48. package/dist-client/components/training-setting-form.js.map +1 -0
  49. package/dist-client/index.d.ts +4 -0
  50. package/dist-client/index.js +8 -0
  51. package/dist-client/index.js.map +1 -0
  52. package/dist-client/legal-record/dispute-calendar-source.d.ts +1 -0
  53. package/dist-client/legal-record/dispute-calendar-source.js +51 -0
  54. package/dist-client/legal-record/dispute-calendar-source.js.map +1 -0
  55. package/dist-client/legal-record/legal-child-grid.d.ts +31 -0
  56. package/dist-client/legal-record/legal-child-grid.js +76 -0
  57. package/dist-client/legal-record/legal-child-grid.js.map +1 -0
  58. package/dist-client/legal-record/legal-codes.d.ts +3 -0
  59. package/dist-client/legal-record/legal-codes.js +5 -0
  60. package/dist-client/legal-record/legal-codes.js.map +1 -0
  61. package/dist-client/legal-record/legal-grid.d.ts +59 -0
  62. package/dist-client/legal-record/legal-grid.js +68 -0
  63. package/dist-client/legal-record/legal-grid.js.map +1 -0
  64. package/dist-client/legal-record/legal-record-files.d.ts +26 -0
  65. package/dist-client/legal-record/legal-record-files.js +162 -0
  66. package/dist-client/legal-record/legal-record-files.js.map +1 -0
  67. package/dist-client/pages/compliance-case-list.d.ts +35 -0
  68. package/dist-client/pages/compliance-case-list.js +112 -0
  69. package/dist-client/pages/compliance-case-list.js.map +1 -0
  70. package/dist-client/pages/dispute-list.d.ts +57 -0
  71. package/dist-client/pages/dispute-list.js +156 -0
  72. package/dist-client/pages/dispute-list.js.map +1 -0
  73. package/dist-client/pages/invention-list.d.ts +57 -0
  74. package/dist-client/pages/invention-list.js +166 -0
  75. package/dist-client/pages/invention-list.js.map +1 -0
  76. package/dist-client/pages/legal-registration-list.d.ts +63 -0
  77. package/dist-client/pages/legal-registration-list.js +206 -0
  78. package/dist-client/pages/legal-registration-list.js.map +1 -0
  79. package/dist-client/pages/privacy-record-list.d.ts +52 -0
  80. package/dist-client/pages/privacy-record-list.js +225 -0
  81. package/dist-client/pages/privacy-record-list.js.map +1 -0
  82. package/dist-client/pages/regulation-detail.d.ts +43 -0
  83. package/dist-client/pages/regulation-detail.js +370 -0
  84. package/dist-client/pages/regulation-detail.js.map +1 -0
  85. package/dist-client/pages/regulation-list.d.ts +52 -0
  86. package/dist-client/pages/regulation-list.js +144 -0
  87. package/dist-client/pages/regulation-list.js.map +1 -0
  88. package/dist-client/pages/regulations.d.ts +49 -0
  89. package/dist-client/pages/regulations.js +412 -0
  90. package/dist-client/pages/regulations.js.map +1 -0
  91. package/dist-client/pages/seal-use-list.d.ts +57 -0
  92. package/dist-client/pages/seal-use-list.js +168 -0
  93. package/dist-client/pages/seal-use-list.js.map +1 -0
  94. package/dist-client/pages/training-list.d.ts +51 -0
  95. package/dist-client/pages/training-list.js +333 -0
  96. package/dist-client/pages/training-list.js.map +1 -0
  97. package/dist-client/regulation/regulation-fragments.d.ts +1 -0
  98. package/dist-client/regulation/regulation-fragments.js +37 -0
  99. package/dist-client/regulation/regulation-fragments.js.map +1 -0
  100. package/dist-client/regulation/regulation-guide.d.ts +19 -0
  101. package/dist-client/regulation/regulation-guide.js +48 -0
  102. package/dist-client/regulation/regulation-guide.js.map +1 -0
  103. package/dist-client/route.d.ts +1 -0
  104. package/dist-client/route.js +36 -0
  105. package/dist-client/route.js.map +1 -0
  106. package/dist-client/training-words.d.ts +11 -0
  107. package/dist-client/training-words.js +11 -0
  108. package/dist-client/training-words.js.map +1 -0
  109. package/dist-client/tsconfig.tsbuildinfo +1 -0
  110. package/dist-client/words.d.ts +15 -0
  111. package/dist-client/words.js +20 -0
  112. package/dist-client/words.js.map +1 -0
  113. package/dist-server/activities/index.d.ts +6 -0
  114. package/dist-server/activities/index.js +35 -0
  115. package/dist-server/activities/index.js.map +1 -0
  116. package/dist-server/activities/legal-todo-activity-names.d.ts +1 -0
  117. package/dist-server/activities/legal-todo-activity-names.js +5 -0
  118. package/dist-server/activities/legal-todo-activity-names.js.map +1 -0
  119. package/dist-server/activities/legal-todo-activity.d.ts +37 -0
  120. package/dist-server/activities/legal-todo-activity.js +41 -0
  121. package/dist-server/activities/legal-todo-activity.js.map +1 -0
  122. package/dist-server/activities/regulation-activity-names.d.ts +1 -0
  123. package/dist-server/activities/regulation-activity-names.js +5 -0
  124. package/dist-server/activities/regulation-activity-names.js.map +1 -0
  125. package/dist-server/activities/regulation-activity.d.ts +48 -0
  126. package/dist-server/activities/regulation-activity.js +47 -0
  127. package/dist-server/activities/regulation-activity.js.map +1 -0
  128. package/dist-server/activities/seal-use-activity-names.d.ts +2 -0
  129. package/dist-server/activities/seal-use-activity-names.js +6 -0
  130. package/dist-server/activities/seal-use-activity-names.js.map +1 -0
  131. package/dist-server/activities/seal-use-activity.d.ts +48 -0
  132. package/dist-server/activities/seal-use-activity.js +47 -0
  133. package/dist-server/activities/seal-use-activity.js.map +1 -0
  134. package/dist-server/index.d.ts +2 -0
  135. package/dist-server/index.js +21 -0
  136. package/dist-server/index.js.map +1 -0
  137. package/dist-server/role-tasks.d.ts +2 -0
  138. package/dist-server/role-tasks.js +28 -0
  139. package/dist-server/role-tasks.js.map +1 -0
  140. package/dist-server/service/common/correction.d.ts +32 -0
  141. package/dist-server/service/common/correction.js +98 -0
  142. package/dist-server/service/common/correction.js.map +1 -0
  143. package/dist-server/service/common/employee-reader.d.ts +11 -0
  144. package/dist-server/service/common/employee-reader.js +46 -0
  145. package/dist-server/service/common/employee-reader.js.map +1 -0
  146. package/dist-server/service/common/legal-todo.d.ts +19 -0
  147. package/dist-server/service/common/legal-todo.js +37 -0
  148. package/dist-server/service/common/legal-todo.js.map +1 -0
  149. package/dist-server/service/compliance-case/compliance-case-mutation.d.ts +9 -0
  150. package/dist-server/service/compliance-case/compliance-case-mutation.js +73 -0
  151. package/dist-server/service/compliance-case/compliance-case-mutation.js.map +1 -0
  152. package/dist-server/service/compliance-case/compliance-case-query.d.ts +28 -0
  153. package/dist-server/service/compliance-case/compliance-case-query.js +212 -0
  154. package/dist-server/service/compliance-case/compliance-case-query.js.map +1 -0
  155. package/dist-server/service/compliance-case/compliance-case-rules.d.ts +71 -0
  156. package/dist-server/service/compliance-case/compliance-case-rules.js +111 -0
  157. package/dist-server/service/compliance-case/compliance-case-rules.js.map +1 -0
  158. package/dist-server/service/compliance-case/compliance-case-service.d.ts +76 -0
  159. package/dist-server/service/compliance-case/compliance-case-service.js +425 -0
  160. package/dist-server/service/compliance-case/compliance-case-service.js.map +1 -0
  161. package/dist-server/service/compliance-case/compliance-case-type.d.ts +56 -0
  162. package/dist-server/service/compliance-case/compliance-case-type.js +200 -0
  163. package/dist-server/service/compliance-case/compliance-case-type.js.map +1 -0
  164. package/dist-server/service/compliance-case/compliance-case.d.ts +76 -0
  165. package/dist-server/service/compliance-case/compliance-case.js +260 -0
  166. package/dist-server/service/compliance-case/compliance-case.js.map +1 -0
  167. package/dist-server/service/compliance-case/index.d.ts +7 -0
  168. package/dist-server/service/compliance-case/index.js +17 -0
  169. package/dist-server/service/compliance-case/index.js.map +1 -0
  170. package/dist-server/service/dispute/dispute-mutation.d.ts +9 -0
  171. package/dist-server/service/dispute/dispute-mutation.js +64 -0
  172. package/dist-server/service/dispute/dispute-mutation.js.map +1 -0
  173. package/dist-server/service/dispute/dispute-query.d.ts +16 -0
  174. package/dist-server/service/dispute/dispute-query.js +124 -0
  175. package/dist-server/service/dispute/dispute-query.js.map +1 -0
  176. package/dist-server/service/dispute/dispute-rules.d.ts +20 -0
  177. package/dist-server/service/dispute/dispute-rules.js +42 -0
  178. package/dist-server/service/dispute/dispute-rules.js.map +1 -0
  179. package/dist-server/service/dispute/dispute-service.d.ts +17 -0
  180. package/dist-server/service/dispute/dispute-service.js +96 -0
  181. package/dist-server/service/dispute/dispute-service.js.map +1 -0
  182. package/dist-server/service/dispute/dispute-type.d.ts +39 -0
  183. package/dist-server/service/dispute/dispute-type.js +149 -0
  184. package/dist-server/service/dispute/dispute-type.js.map +1 -0
  185. package/dist-server/service/dispute/dispute.d.ts +48 -0
  186. package/dist-server/service/dispute/dispute.js +198 -0
  187. package/dist-server/service/dispute/dispute.js.map +1 -0
  188. package/dist-server/service/dispute/index.d.ts +5 -0
  189. package/dist-server/service/dispute/index.js +9 -0
  190. package/dist-server/service/dispute/index.js.map +1 -0
  191. package/dist-server/service/index.d.ts +46 -0
  192. package/dist-server/service/index.js +112 -0
  193. package/dist-server/service/index.js.map +1 -0
  194. package/dist-server/service/invention/index.d.ts +5 -0
  195. package/dist-server/service/invention/index.js +9 -0
  196. package/dist-server/service/invention/index.js.map +1 -0
  197. package/dist-server/service/invention/invention-mutation.d.ts +10 -0
  198. package/dist-server/service/invention/invention-mutation.js +79 -0
  199. package/dist-server/service/invention/invention-mutation.js.map +1 -0
  200. package/dist-server/service/invention/invention-query.d.ts +18 -0
  201. package/dist-server/service/invention/invention-query.js +141 -0
  202. package/dist-server/service/invention/invention-query.js.map +1 -0
  203. package/dist-server/service/invention/invention-rules.d.ts +28 -0
  204. package/dist-server/service/invention/invention-rules.js +54 -0
  205. package/dist-server/service/invention/invention-rules.js.map +1 -0
  206. package/dist-server/service/invention/invention-service.d.ts +25 -0
  207. package/dist-server/service/invention/invention-service.js +176 -0
  208. package/dist-server/service/invention/invention-service.js.map +1 -0
  209. package/dist-server/service/invention/invention-type.d.ts +34 -0
  210. package/dist-server/service/invention/invention-type.js +129 -0
  211. package/dist-server/service/invention/invention-type.js.map +1 -0
  212. package/dist-server/service/invention/invention.d.ts +55 -0
  213. package/dist-server/service/invention/invention.js +214 -0
  214. package/dist-server/service/invention/invention.js.map +1 -0
  215. package/dist-server/service/legal-record/attachment-readers.d.ts +1 -0
  216. package/dist-server/service/legal-record/attachment-readers.js +27 -0
  217. package/dist-server/service/legal-record/attachment-readers.js.map +1 -0
  218. package/dist-server/service/legal-record/days.d.ts +7 -0
  219. package/dist-server/service/legal-record/days.js +26 -0
  220. package/dist-server/service/legal-record/days.js.map +1 -0
  221. package/dist-server/service/legal-record/legal-record-support.d.ts +24 -0
  222. package/dist-server/service/legal-record/legal-record-support.js +51 -0
  223. package/dist-server/service/legal-record/legal-record-support.js.map +1 -0
  224. package/dist-server/service/legal-registration/centre-change-subscriber.d.ts +9 -0
  225. package/dist-server/service/legal-registration/centre-change-subscriber.js +50 -0
  226. package/dist-server/service/legal-registration/centre-change-subscriber.js.map +1 -0
  227. package/dist-server/service/legal-registration/index.d.ts +7 -0
  228. package/dist-server/service/legal-registration/index.js +11 -0
  229. package/dist-server/service/legal-registration/index.js.map +1 -0
  230. package/dist-server/service/legal-registration/legal-registration-mutation.d.ts +10 -0
  231. package/dist-server/service/legal-registration/legal-registration-mutation.js +77 -0
  232. package/dist-server/service/legal-registration/legal-registration-mutation.js.map +1 -0
  233. package/dist-server/service/legal-registration/legal-registration-query.d.ts +26 -0
  234. package/dist-server/service/legal-registration/legal-registration-query.js +199 -0
  235. package/dist-server/service/legal-registration/legal-registration-query.js.map +1 -0
  236. package/dist-server/service/legal-registration/legal-registration-rules.d.ts +80 -0
  237. package/dist-server/service/legal-registration/legal-registration-rules.js +106 -0
  238. package/dist-server/service/legal-registration/legal-registration-rules.js.map +1 -0
  239. package/dist-server/service/legal-registration/legal-registration-service.d.ts +37 -0
  240. package/dist-server/service/legal-registration/legal-registration-service.js +248 -0
  241. package/dist-server/service/legal-registration/legal-registration-service.js.map +1 -0
  242. package/dist-server/service/legal-registration/legal-registration-type.d.ts +55 -0
  243. package/dist-server/service/legal-registration/legal-registration-type.js +207 -0
  244. package/dist-server/service/legal-registration/legal-registration-type.js.map +1 -0
  245. package/dist-server/service/legal-registration/legal-registration.d.ts +76 -0
  246. package/dist-server/service/legal-registration/legal-registration.js +311 -0
  247. package/dist-server/service/legal-registration/legal-registration.js.map +1 -0
  248. package/dist-server/service/privacy-record/index.d.ts +5 -0
  249. package/dist-server/service/privacy-record/index.js +9 -0
  250. package/dist-server/service/privacy-record/index.js.map +1 -0
  251. package/dist-server/service/privacy-record/privacy-record-mutation.d.ts +7 -0
  252. package/dist-server/service/privacy-record/privacy-record-mutation.js +56 -0
  253. package/dist-server/service/privacy-record/privacy-record-mutation.js.map +1 -0
  254. package/dist-server/service/privacy-record/privacy-record-query.d.ts +18 -0
  255. package/dist-server/service/privacy-record/privacy-record-query.js +131 -0
  256. package/dist-server/service/privacy-record/privacy-record-query.js.map +1 -0
  257. package/dist-server/service/privacy-record/privacy-record-rules.d.ts +52 -0
  258. package/dist-server/service/privacy-record/privacy-record-rules.js +91 -0
  259. package/dist-server/service/privacy-record/privacy-record-rules.js.map +1 -0
  260. package/dist-server/service/privacy-record/privacy-record-service.d.ts +33 -0
  261. package/dist-server/service/privacy-record/privacy-record-service.js +133 -0
  262. package/dist-server/service/privacy-record/privacy-record-service.js.map +1 -0
  263. package/dist-server/service/privacy-record/privacy-record-type.d.ts +40 -0
  264. package/dist-server/service/privacy-record/privacy-record-type.js +153 -0
  265. package/dist-server/service/privacy-record/privacy-record-type.js.map +1 -0
  266. package/dist-server/service/privacy-record/privacy-record.d.ts +69 -0
  267. package/dist-server/service/privacy-record/privacy-record.js +245 -0
  268. package/dist-server/service/privacy-record/privacy-record.js.map +1 -0
  269. package/dist-server/service/regulation/index.d.ts +5 -0
  270. package/dist-server/service/regulation/index.js +9 -0
  271. package/dist-server/service/regulation/index.js.map +1 -0
  272. package/dist-server/service/regulation/regulation-mutation.d.ts +15 -0
  273. package/dist-server/service/regulation/regulation-mutation.js +152 -0
  274. package/dist-server/service/regulation/regulation-mutation.js.map +1 -0
  275. package/dist-server/service/regulation/regulation-query.d.ts +10 -0
  276. package/dist-server/service/regulation/regulation-query.js +109 -0
  277. package/dist-server/service/regulation/regulation-query.js.map +1 -0
  278. package/dist-server/service/regulation/regulation-read.d.ts +21 -0
  279. package/dist-server/service/regulation/regulation-read.js +111 -0
  280. package/dist-server/service/regulation/regulation-read.js.map +1 -0
  281. package/dist-server/service/regulation/regulation-rules.d.ts +83 -0
  282. package/dist-server/service/regulation/regulation-rules.js +170 -0
  283. package/dist-server/service/regulation/regulation-rules.js.map +1 -0
  284. package/dist-server/service/regulation/regulation-service.d.ts +63 -0
  285. package/dist-server/service/regulation/regulation-service.js +365 -0
  286. package/dist-server/service/regulation/regulation-service.js.map +1 -0
  287. package/dist-server/service/regulation/regulation-type.d.ts +61 -0
  288. package/dist-server/service/regulation/regulation-type.js +226 -0
  289. package/dist-server/service/regulation/regulation-type.js.map +1 -0
  290. package/dist-server/service/regulation/regulation.d.ts +113 -0
  291. package/dist-server/service/regulation/regulation.js +382 -0
  292. package/dist-server/service/regulation/regulation.js.map +1 -0
  293. package/dist-server/service/seal-use/index.d.ts +5 -0
  294. package/dist-server/service/seal-use/index.js +9 -0
  295. package/dist-server/service/seal-use/index.js.map +1 -0
  296. package/dist-server/service/seal-use/seal-use-mutation.d.ts +8 -0
  297. package/dist-server/service/seal-use/seal-use-mutation.js +69 -0
  298. package/dist-server/service/seal-use/seal-use-mutation.js.map +1 -0
  299. package/dist-server/service/seal-use/seal-use-query.d.ts +14 -0
  300. package/dist-server/service/seal-use/seal-use-query.js +100 -0
  301. package/dist-server/service/seal-use/seal-use-query.js.map +1 -0
  302. package/dist-server/service/seal-use/seal-use-rules.d.ts +35 -0
  303. package/dist-server/service/seal-use/seal-use-rules.js +64 -0
  304. package/dist-server/service/seal-use/seal-use-rules.js.map +1 -0
  305. package/dist-server/service/seal-use/seal-use-service.d.ts +20 -0
  306. package/dist-server/service/seal-use/seal-use-service.js +168 -0
  307. package/dist-server/service/seal-use/seal-use-service.js.map +1 -0
  308. package/dist-server/service/seal-use/seal-use-type.d.ts +24 -0
  309. package/dist-server/service/seal-use/seal-use-type.js +93 -0
  310. package/dist-server/service/seal-use/seal-use-type.js.map +1 -0
  311. package/dist-server/service/seal-use/seal-use.d.ts +57 -0
  312. package/dist-server/service/seal-use/seal-use.js +181 -0
  313. package/dist-server/service/seal-use/seal-use.js.map +1 -0
  314. package/dist-server/service/training/index.d.ts +5 -0
  315. package/dist-server/service/training/index.js +9 -0
  316. package/dist-server/service/training/index.js.map +1 -0
  317. package/dist-server/service/training/training-checks.d.ts +20 -0
  318. package/dist-server/service/training/training-checks.js +56 -0
  319. package/dist-server/service/training/training-checks.js.map +1 -0
  320. package/dist-server/service/training/training-kinds.d.ts +24 -0
  321. package/dist-server/service/training/training-kinds.js +42 -0
  322. package/dist-server/service/training/training-kinds.js.map +1 -0
  323. package/dist-server/service/training/training-mutation.d.ts +14 -0
  324. package/dist-server/service/training/training-mutation.js +140 -0
  325. package/dist-server/service/training/training-mutation.js.map +1 -0
  326. package/dist-server/service/training/training-query.d.ts +21 -0
  327. package/dist-server/service/training/training-query.js +196 -0
  328. package/dist-server/service/training/training-query.js.map +1 -0
  329. package/dist-server/service/training/training-read.d.ts +5 -0
  330. package/dist-server/service/training/training-read.js +35 -0
  331. package/dist-server/service/training/training-read.js.map +1 -0
  332. package/dist-server/service/training/training-register.d.ts +1 -0
  333. package/dist-server/service/training/training-register.js +27 -0
  334. package/dist-server/service/training/training-register.js.map +1 -0
  335. package/dist-server/service/training/training-rules.d.ts +72 -0
  336. package/dist-server/service/training/training-rules.js +143 -0
  337. package/dist-server/service/training/training-rules.js.map +1 -0
  338. package/dist-server/service/training/training-service.d.ts +98 -0
  339. package/dist-server/service/training/training-service.js +455 -0
  340. package/dist-server/service/training/training-service.js.map +1 -0
  341. package/dist-server/service/training/training-type.d.ts +94 -0
  342. package/dist-server/service/training/training-type.js +352 -0
  343. package/dist-server/service/training/training-type.js.map +1 -0
  344. package/dist-server/service/training/training.d.ts +127 -0
  345. package/dist-server/service/training/training.js +448 -0
  346. package/dist-server/service/training/training.js.map +1 -0
  347. package/dist-server/tsconfig.tsbuildinfo +1 -0
  348. package/package.json +61 -4
  349. package/things-factory.config.js +19 -0
  350. package/translations/en.json +610 -0
  351. package/translations/es.json +610 -0
  352. package/translations/ja.json +610 -0
  353. package/translations/ko.json +610 -0
  354. package/translations/ms.json +610 -0
  355. package/translations/zh.json +610 -0
  356. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compliance-case-query.js","sourceRoot":"","sources":["../../../server/service/compliance-case/compliance-case-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA6G;AAE7G,qEAA4D;AAC5D,yDAAgD;AAChD,+DAAuD;AACvD,iDAA+E;AAE/E,qDAA0E;AAC1E,uDAAuE;AACvE,uEAAgN;AAChN,iEAAuG;AAEvG;;;;GAIG;AAGI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,eAAe,CAA0B,MAAiB,EAAS,OAAwB;QAC/F,OAAO,MAAM,IAAA,4CAAkB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClD,CAAC;IAGK,AAAN,KAAK,CAAC,cAAc,CAAY,EAAU,EAAS,OAAwB;QACzE,OAAO,MAAM,IAAA,2CAAiB,EAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAGK,AAAN,KAAK,CAAC,0BAA0B,CAAQ,OAAwB;QAC9D,OAAO,MAAM,IAAA,0CAAgB,EAAC,OAAO,CAAC,CAAA;IACxC,CAAC;IAGK,AAAN,KAAK,CAAC,mBAAmB,CAAQ,OAAwB;QACvD,OAAO,MAAM,IAAA,6CAAmB,EAAC,OAAO,CAAC,CAAA;IAC3C,CAAC;IAGK,AAAN,KAAK,CAAC,yBAAyB,CAAsC,UAAoB,EAAS,OAAwB;QACxH,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AAE,EAAS,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAS,EAAE,CAAC,CAAA;IAC7L,CAAC;IAGK,AAAN,KAAK,CAAC,OAAO,CAAS,GAAwB;QAC5C,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACnG,CAAC;CACF,CAAA;AAVY,4DAAwB;AAE7B;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAU,CAAC,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;IAC5D,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAA4B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAA3B,qCAAmB;;2DAEjD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACjC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,qCAAmB;;uDAE7C;mCATU,wBAAwB;IADpC,IAAA,uBAAQ,EAAC,qCAAmB,CAAC;GACjB,wBAAwB,CAUpC","sourcesContent":["import { Arg, Args, Ctx, Directive, FieldResolver, Query, Resolver, Root, UseMiddleware } from 'type-graphql'\n\nimport { Attachment } from '@things-factory/attachment-base'\nimport { User } from '@things-factory/auth-base'\nimport { Employee } from '@things-factory/organization'\nimport { getRepository, ListParam, SpeakRefusals } from '@things-factory/shell'\n\nimport { ComplianceCorrection, correctionsOf } from '../common/correction'\nimport { ComplianceCase, ComplianceCaseEntry } from './compliance-case'\nimport { CASE_ENTRY_REF_TYPE, CASE_REF_TYPE, casePeople, complianceCaseFor, complianceCasesFor, insideHandlerLeft, investigatorChoices, myComplianceReports, myInvestigations } from './compliance-case-service'\nimport { ComplianceCaseList, ComplianceCasePerson, ComplianceReportView } from './compliance-case-type'\n\n/*\n * The doors that hand out cases (ADR-0187 decision 21). The `ComplianceCase` type, investigation and all, is answered\n * only by the doors that ask for the whole sight - the handlers' list, one case, an investigator's list; the reporter\n * and the victim read `ComplianceReportView`, which has no field of the investigation.\n */\n@Resolver(ComplianceCase)\n@UseMiddleware(SpeakRefusals)\nexport class ComplianceCaseQuery {\n @Directive('@privilege(category: \"compliance-case\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => ComplianceCaseList, { description: '신고 사건 - the cases the handler reads; never one they are reported against (ADR-0187 decision 21)' })\n async complianceCases(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<ComplianceCaseList> {\n return await complianceCasesFor(params, context)\n }\n\n @Query(returns => ComplianceCase, { description: 'One case, whole - for its handlers and its investigators, never one reported against' })\n async complianceCase(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ComplianceCase> {\n return await complianceCaseFor(id, context)\n }\n\n @Query(returns => [ComplianceCase], { description: 'The cases the request investigates - an investigator who is no case handler reads them here' })\n async myComplianceInvestigations(@Ctx() context: ResolverContext): Promise<ComplianceCase[]> {\n return await myInvestigations(context)\n }\n\n @Query(returns => [ComplianceReportView], { description: 'The cases the request reported or that happened to them - their progress, protection and result' })\n async myComplianceReports(@Ctx() context: ResolverContext): Promise<ComplianceReportView[]> {\n return await myComplianceReports(context)\n }\n\n @Query(returns => Boolean, { description: 'Whether a case handler is left to take a report against these employees - false sends the reporter to the labour ministry' })\n async complianceCaseHandlerLeft(@Arg('accusedIds', type => [String]) accusedIds: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n return await insideHandlerLeft(accusedIds, context)\n }\n\n @Query(returns => [ComplianceCasePerson], { description: 'Employees still working here a report may name, found by name - for an employee making a report' })\n async complianceCasePeople(@Arg('text') text: string, @Ctx() context: ResolverContext): Promise<ComplianceCasePerson[]> {\n return await casePeople(text, context)\n }\n\n @Directive('@privilege(category: \"compliance-case\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Query(returns => [ComplianceCasePerson], { description: 'Users of the domain a case handler may name as investigators, found by name or mail' })\n async complianceCaseInvestigatorChoices(@Arg('text') text: string, @Ctx() context: ResolverContext): Promise<ComplianceCasePerson[]> {\n return await investigatorChoices(text, context)\n }\n\n @FieldResolver(type => Employee, { nullable: true })\n async reporter(@Root() row: ComplianceCase): Promise<Employee | null> {\n return row.reporterId ? await getRepository(Employee).findOne({ where: { id: row.reporterId } }) : null\n }\n\n @FieldResolver(type => Employee, { nullable: true })\n async victim(@Root() row: ComplianceCase): Promise<Employee | null> {\n return row.victimId ? await getRepository(Employee).findOne({ where: { id: row.victimId } }) : null\n }\n\n @FieldResolver(type => [Employee])\n async accused(@Root() row: ComplianceCase): Promise<Employee[]> {\n return row.accused ?? (await getRepository(ComplianceCase).findOne({ where: { id: row.id }, relations: ['accused'] }))?.accused ?? []\n }\n\n @FieldResolver(type => [User])\n async investigators(@Root() row: ComplianceCase): Promise<User[]> {\n return row.investigators ?? (await getRepository(ComplianceCase).findOne({ where: { id: row.id }, relations: ['investigators'] }))?.investigators ?? []\n }\n\n @FieldResolver(type => [ComplianceCaseEntry], { description: 'The investigation record, oldest first' })\n async entries(@Root() row: ComplianceCase): Promise<ComplianceCaseEntry[]> {\n return await getRepository(ComplianceCaseEntry).find({ where: { complianceCase: { id: row.id } } as any, order: { writtenOn: 'ASC', createdAt: 'ASC' } as any })\n }\n\n @FieldResolver(type => [Attachment], { description: 'The files of the report' })\n async attachments(@Root() row: ComplianceCase, @Ctx() context: ResolverContext): Promise<Attachment[]> {\n return await getRepository(Attachment).find({ where: { domain: { id: context.state.domain.id }, refType: CASE_REF_TYPE, refBy: row.id } as any, order: { createdAt: 'ASC' } as any })\n }\n\n @FieldResolver(type => [ComplianceCorrection], { description: 'The values changed after they were written' })\n async corrections(@Root() row: ComplianceCase, @Ctx() context: ResolverContext): Promise<ComplianceCorrection[]> {\n return await correctionsOf(getRepository(ComplianceCase).manager, context.state.domain, { kind: CASE_REF_TYPE, id: row.id })\n }\n\n @FieldResolver(type => User, { nullable: true })\n async creator(@Root() row: ComplianceCase): Promise<User | null> {\n return row.creatorId ? await getRepository(User).findOne({ where: { id: row.creatorId } }) : null\n }\n}\n\n@Resolver(ComplianceCaseEntry)\nexport class ComplianceCaseEntryQuery {\n @FieldResolver(type => [Attachment], { description: 'The files of the entry' })\n async attachments(@Root() row: ComplianceCaseEntry, @Ctx() context: ResolverContext): Promise<Attachment[]> {\n return await getRepository(Attachment).find({ where: { domain: { id: context.state.domain.id }, refType: CASE_ENTRY_REF_TYPE, refBy: row.id } as any, order: { createdAt: 'ASC' } as any })\n }\n\n @FieldResolver(type => User, { nullable: true })\n async creator(@Root() row: ComplianceCaseEntry): Promise<User | null> {\n return row.creatorId ? await getRepository(User).findOne({ where: { id: row.creatorId } }) : null\n }\n}\n"]}
@@ -0,0 +1,71 @@
1
+ import { Refusal } from '@things-factory/shell';
2
+ export declare const CASE_KINDS: string[];
3
+ export declare const CASE_STATUSES: string[];
4
+ /** Days from receipt the investigation is to start in, when the domain has set none (decision 21 ⚖). */
5
+ export declare const DEFAULT_INVESTIGATION_DAYS = 7;
6
+ /** The domain setting (setting-base `Setting.name`) that changes it. */
7
+ export declare const INVESTIGATION_DAYS_SETTING = "compliance-case-investigation-days";
8
+ /** `investigationStartedOn` as a refusal code names it - `investigation-started-on`. */
9
+ export declare const kebabOf: (field: string) => string;
10
+ /**
11
+ * How much of a case one person reads:
12
+ * - `FULL` - the case handlers and that case's investigators: everything, the investigation with it;
13
+ * - `PARTY` - the reporter and the victim: where it stands, the protection measures and the result told;
14
+ * - null - nothing, and one answer for "none" and "not yours".
15
+ */
16
+ export type CaseSight = 'FULL' | 'PARTY' | null;
17
+ export interface CaseFacts {
18
+ reporterUserId?: string | null;
19
+ victimUserId?: string | null;
20
+ accusedUserIds: readonly string[];
21
+ accusedEmployeeIds: readonly string[];
22
+ investigatorIds: readonly string[];
23
+ /** Every handler was among those reported against when it came in - nobody inside the company investigates it. */
24
+ noInsideHandler?: boolean | null;
25
+ }
26
+ export interface CaseViewer {
27
+ userId: string;
28
+ /** Holds `compliance-case` - a case handler (`compliance.case-handling`). */
29
+ handler: boolean;
30
+ /** The viewer's own employee records in the domain. */
31
+ employeeIds: readonly string[];
32
+ }
33
+ /** Whether the viewer is one of those reported against - by their account or by any of their employee records. */
34
+ export declare function isAccused(facts: CaseFacts, viewer: CaseViewer): boolean;
35
+ /** What the viewer reads of the case. One reported against reads nothing of it, handler or investigator though they be. */
36
+ export declare function caseSightOf(facts: CaseFacts, viewer: CaseViewer): CaseSight;
37
+ /** The handlers left to take a case - those not reported against. None left means nobody inside may investigate it. */
38
+ export declare function handlersLeft(handlerUserIds: readonly string[], accusedUserIds: readonly string[]): string[];
39
+ /** Where a case stands, read from what has been written on it. */
40
+ export declare function caseStatusOf(row: {
41
+ investigationStartedOn?: string | null;
42
+ finding?: string | null;
43
+ resultToldOn?: string | null;
44
+ closedOn?: string | null;
45
+ }): string;
46
+ /** `day` moved by `days` calendar days. */
47
+ export declare function dayPlus(day: string, days: number): string;
48
+ /** The investigation-start days a setting value gives - a whole number of 1 or more, else the default. */
49
+ export declare function investigationDaysOf(value: unknown): number;
50
+ /** A case whose investigation has not started by its due day, while it is still open. */
51
+ export declare function investigationLate(row: {
52
+ investigationStartedOn?: string | null;
53
+ closedOn?: string | null;
54
+ investigationDueOn?: string | null;
55
+ noInsideHandler?: boolean | null;
56
+ }, today: string): boolean;
57
+ export interface CaseReportInput {
58
+ kind?: string | null;
59
+ occurredOn?: string | null;
60
+ description?: string | null;
61
+ accusedIds?: readonly string[] | null;
62
+ }
63
+ /** What a report asks for before it is written, or nothing. */
64
+ export declare function caseReportRefusal(input: CaseReportInput): Refusal | null;
65
+ /** What a handler writes on a case as it goes - the fields and the days among them. */
66
+ export declare const HANDLING_FIELDS: readonly ["investigationStartedOn", "protectionMeasures", "victimOpinion", "finding", "actionOnAccused", "resultNotice", "resultToldOn", "closedOn"];
67
+ /** What a handling patch asks for before it is written on `row`, or nothing. */
68
+ export declare function caseHandlingRefusal(patch: Record<string, any>, row: {
69
+ receivedOn: string;
70
+ closedOn?: string | null;
71
+ } & Record<string, any>): Refusal | null;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HANDLING_FIELDS = exports.kebabOf = exports.INVESTIGATION_DAYS_SETTING = exports.DEFAULT_INVESTIGATION_DAYS = exports.CASE_STATUSES = exports.CASE_KINDS = void 0;
4
+ exports.isAccused = isAccused;
5
+ exports.caseSightOf = caseSightOf;
6
+ exports.handlersLeft = handlersLeft;
7
+ exports.caseStatusOf = caseStatusOf;
8
+ exports.dayPlus = dayPlus;
9
+ exports.investigationDaysOf = investigationDaysOf;
10
+ exports.investigationLate = investigationLate;
11
+ exports.caseReportRefusal = caseReportRefusal;
12
+ exports.caseHandlingRefusal = caseHandlingRefusal;
13
+ const shell_1 = require("@things-factory/shell");
14
+ /*
15
+ * What a report of workplace harassment or sexual harassment holds to (ADR-0187 decision 21): who reads it and how much,
16
+ * where it stands, and its deadline. Pure - the service reads the case and the people, these say yes or no.
17
+ */
18
+ exports.CASE_KINDS = ['HARASSMENT', 'SEXUAL_HARASSMENT'];
19
+ exports.CASE_STATUSES = ['RECEIVED', 'INVESTIGATING', 'DECIDED', 'TOLD', 'CLOSED'];
20
+ /** Days from receipt the investigation is to start in, when the domain has set none (decision 21 ⚖). */
21
+ exports.DEFAULT_INVESTIGATION_DAYS = 7;
22
+ /** The domain setting (setting-base `Setting.name`) that changes it. */
23
+ exports.INVESTIGATION_DAYS_SETTING = 'compliance-case-investigation-days';
24
+ const DAY = /^\d{4}-\d{2}-\d{2}$/;
25
+ /** `investigationStartedOn` as a refusal code names it - `investigation-started-on`. */
26
+ const kebabOf = (field) => field.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
27
+ exports.kebabOf = kebabOf;
28
+ /** Whether the viewer is one of those reported against - by their account or by any of their employee records. */
29
+ function isAccused(facts, viewer) {
30
+ return facts.accusedUserIds.includes(viewer.userId) || viewer.employeeIds.some(id => facts.accusedEmployeeIds.includes(id));
31
+ }
32
+ /** What the viewer reads of the case. One reported against reads nothing of it, handler or investigator though they be. */
33
+ function caseSightOf(facts, viewer) {
34
+ if (isAccused(facts, viewer))
35
+ return null;
36
+ const reporter = !!facts.reporterUserId && facts.reporterUserId === viewer.userId;
37
+ /* With nobody inside to investigate, the record is the reporter's alone - the way out is the labour ministry. */
38
+ if (facts.noInsideHandler)
39
+ return reporter ? 'PARTY' : null;
40
+ if (viewer.handler || facts.investigatorIds.includes(viewer.userId))
41
+ return 'FULL';
42
+ if (reporter || (!!facts.victimUserId && facts.victimUserId === viewer.userId))
43
+ return 'PARTY';
44
+ return null;
45
+ }
46
+ /** The handlers left to take a case - those not reported against. None left means nobody inside may investigate it. */
47
+ function handlersLeft(handlerUserIds, accusedUserIds) {
48
+ return handlerUserIds.filter(id => !accusedUserIds.includes(id));
49
+ }
50
+ /** Where a case stands, read from what has been written on it. */
51
+ function caseStatusOf(row) {
52
+ if (row.closedOn)
53
+ return 'CLOSED';
54
+ if (row.resultToldOn)
55
+ return 'TOLD';
56
+ if (row.finding?.trim())
57
+ return 'DECIDED';
58
+ if (row.investigationStartedOn)
59
+ return 'INVESTIGATING';
60
+ return 'RECEIVED';
61
+ }
62
+ /** `day` moved by `days` calendar days. */
63
+ function dayPlus(day, days) {
64
+ const [year, month, date] = day.split('-').map(Number);
65
+ return new Date(Date.UTC(year, month - 1, date + days)).toISOString().slice(0, 10);
66
+ }
67
+ /** The investigation-start days a setting value gives - a whole number of 1 or more, else the default. */
68
+ function investigationDaysOf(value) {
69
+ const days = Number(value);
70
+ return Number.isInteger(days) && days >= 1 ? days : exports.DEFAULT_INVESTIGATION_DAYS;
71
+ }
72
+ /** A case whose investigation has not started by its due day, while it is still open. */
73
+ function investigationLate(row, today) {
74
+ return !row.investigationStartedOn && !row.closedOn && !row.noInsideHandler && !!row.investigationDueOn && row.investigationDueOn < today;
75
+ }
76
+ /** What a report asks for before it is written, or nothing. */
77
+ function caseReportRefusal(input) {
78
+ if (!exports.CASE_KINDS.includes(input.kind ?? ''))
79
+ return new shell_1.Refusal('compliance-case-kind-required', {}, 'pick what it is - workplace harassment or sexual harassment');
80
+ if (input.occurredOn && !DAY.test(input.occurredOn))
81
+ return new shell_1.Refusal('compliance-case-occurred-on-invalid', {}, 'give the day it happened as YYYY-MM-DD');
82
+ if (!input.description?.trim())
83
+ return new shell_1.Refusal('compliance-case-description-required', {}, 'say what happened');
84
+ if (!input.accusedIds?.length)
85
+ return new shell_1.Refusal('compliance-case-accused-required', {}, 'name at least one person reported against');
86
+ return null;
87
+ }
88
+ /** What a handler writes on a case as it goes - the fields and the days among them. */
89
+ exports.HANDLING_FIELDS = ['investigationStartedOn', 'protectionMeasures', 'victimOpinion', 'finding', 'actionOnAccused', 'resultNotice', 'resultToldOn', 'closedOn'];
90
+ const HANDLING_DAYS = ['investigationStartedOn', 'resultToldOn', 'closedOn'];
91
+ /** What a handling patch asks for before it is written on `row`, or nothing. */
92
+ function caseHandlingRefusal(patch, row) {
93
+ if (row.closedOn)
94
+ return new shell_1.Refusal('compliance-case-closed', {}, 'a closed case is not written on');
95
+ for (const field of HANDLING_DAYS) {
96
+ const day = patch[field];
97
+ if (day === undefined || day === null || day === '')
98
+ continue;
99
+ if (!DAY.test(day))
100
+ return new shell_1.Refusal(`compliance-case-${(0, exports.kebabOf)(field)}-invalid`, {}, `give ${field} as YYYY-MM-DD`);
101
+ if (day < row.receivedOn)
102
+ return new shell_1.Refusal(`compliance-case-${(0, exports.kebabOf)(field)}-before-receipt`, { receivedOn: row.receivedOn }, `${field} cannot be before the day it was received (${row.receivedOn})`);
103
+ }
104
+ const next = { ...row, ...patch };
105
+ if (next.resultToldOn && !next.resultNotice?.trim())
106
+ return new shell_1.Refusal('compliance-case-notice-required', {}, 'write the result told before its day');
107
+ if (next.closedOn && !next.resultToldOn)
108
+ return new shell_1.Refusal('compliance-case-close-before-told', {}, 'tell the reporter and the victim the result before closing it');
109
+ return null;
110
+ }
111
+ //# sourceMappingURL=compliance-case-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compliance-case-rules.js","sourceRoot":"","sources":["../../../server/service/compliance-case/compliance-case-rules.ts"],"names":[],"mappings":";;;AA8CA,8BAEC;AAGD,kCAQC;AAGD,oCAEC;AAGD,oCAMC;AAGD,0BAGC;AAGD,kDAGC;AAGD,8CAEC;AAUD,8CAMC;AAOD,kDAYC;AA7HD,iDAA+C;AAE/C;;;GAGG;AAEU,QAAA,UAAU,GAAG,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAA;AAChD,QAAA,aAAa,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AAEvF,wGAAwG;AAC3F,QAAA,0BAA0B,GAAG,CAAC,CAAA;AAC3C,wEAAwE;AAC3D,QAAA,0BAA0B,GAAG,oCAAoC,CAAA;AAE9E,MAAM,GAAG,GAAG,qBAAqB,CAAA;AACjC,wFAAwF;AACjF,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAA;AAAvF,QAAA,OAAO,WAAgF;AA4BpG,kHAAkH;AAClH,SAAgB,SAAS,CAAC,KAAgB,EAAE,MAAkB;IAC5D,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;AAC7H,CAAC;AAED,2HAA2H;AAC3H,SAAgB,WAAW,CAAC,KAAgB,EAAE,MAAkB;IAC9D,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GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,KAAK,EAAE,CAAA;IACjC,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE;QAAE,OAAO,IAAI,eAAO,CAAC,iCAAiC,EAAE,EAAE,EAAE,sCAAsC,CAAC,CAAA;IACtJ,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,eAAO,CAAC,mCAAmC,EAAE,EAAE,EAAE,+DAA+D,CAAC,CAAA;IACrK,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { Refusal } from '@things-factory/shell'\n\n/*\n * What a report of workplace harassment or sexual harassment holds to (ADR-0187 decision 21): who reads it and how much,\n * where it stands, and its deadline. Pure - the service reads the case and the people, these say yes or no.\n */\n\nexport const CASE_KINDS = ['HARASSMENT', 'SEXUAL_HARASSMENT']\nexport const CASE_STATUSES = ['RECEIVED', 'INVESTIGATING', 'DECIDED', 'TOLD', 'CLOSED']\n\n/** Days from receipt the investigation is to start in, when the domain has set none (decision 21 ⚖). */\nexport const DEFAULT_INVESTIGATION_DAYS = 7\n/** The domain setting (setting-base `Setting.name`) that changes it. */\nexport const INVESTIGATION_DAYS_SETTING = 'compliance-case-investigation-days'\n\nconst DAY = /^\\d{4}-\\d{2}-\\d{2}$/\n/** `investigationStartedOn` as a refusal code names it - `investigation-started-on`. */\nexport const kebabOf = (field: string) => field.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()\n\n/**\n * How much of a case one person reads:\n * - `FULL` - the case handlers and that case's investigators: everything, the investigation with it;\n * - `PARTY` - the reporter and the victim: where it stands, the protection measures and the result told;\n * - null - nothing, and one answer for \"none\" and \"not yours\".\n */\nexport type CaseSight = 'FULL' | 'PARTY' | null\n\nexport interface CaseFacts {\n reporterUserId?: string | null\n victimUserId?: string | null\n accusedUserIds: readonly string[]\n accusedEmployeeIds: readonly string[]\n investigatorIds: readonly string[]\n /** Every handler was among those reported against when it came in - nobody inside the company investigates it. */\n noInsideHandler?: boolean | null\n}\n\nexport interface CaseViewer {\n userId: string\n /** Holds `compliance-case` - a case handler (`compliance.case-handling`). */\n handler: boolean\n /** The viewer's own employee records in the domain. */\n employeeIds: readonly string[]\n}\n\n/** Whether the viewer is one of those reported against - by their account or by any of their employee records. */\nexport function isAccused(facts: CaseFacts, viewer: CaseViewer): boolean {\n return facts.accusedUserIds.includes(viewer.userId) || viewer.employeeIds.some(id => facts.accusedEmployeeIds.includes(id))\n}\n\n/** What the viewer reads of the case. One reported against reads nothing of it, handler or investigator though they be. */\nexport function caseSightOf(facts: CaseFacts, viewer: CaseViewer): CaseSight {\n if (isAccused(facts, viewer)) return null\n const reporter = !!facts.reporterUserId && facts.reporterUserId === viewer.userId\n /* With nobody inside to investigate, the record is the reporter's alone - the way out is the labour ministry. */\n if (facts.noInsideHandler) return reporter ? 'PARTY' : null\n if (viewer.handler || facts.investigatorIds.includes(viewer.userId)) return 'FULL'\n if (reporter || (!!facts.victimUserId && facts.victimUserId === viewer.userId)) return 'PARTY'\n return null\n}\n\n/** The handlers left to take a case - those not reported against. None left means nobody inside may investigate it. */\nexport function handlersLeft(handlerUserIds: readonly string[], accusedUserIds: readonly string[]): string[] {\n return handlerUserIds.filter(id => !accusedUserIds.includes(id))\n}\n\n/** Where a case stands, read from what has been written on it. */\nexport function caseStatusOf(row: { investigationStartedOn?: string | null; finding?: string | null; resultToldOn?: string | null; closedOn?: string | null }): string {\n if (row.closedOn) return 'CLOSED'\n if (row.resultToldOn) return 'TOLD'\n if (row.finding?.trim()) return 'DECIDED'\n if (row.investigationStartedOn) return 'INVESTIGATING'\n return 'RECEIVED'\n}\n\n/** `day` moved by `days` calendar days. */\nexport function dayPlus(day: string, days: number): string {\n const [year, month, date] = day.split('-').map(Number)\n return new Date(Date.UTC(year, month - 1, date + days)).toISOString().slice(0, 10)\n}\n\n/** The investigation-start days a setting value gives - a whole number of 1 or more, else the default. */\nexport function investigationDaysOf(value: unknown): number {\n const days = Number(value)\n return Number.isInteger(days) && days >= 1 ? days : DEFAULT_INVESTIGATION_DAYS\n}\n\n/** A case whose investigation has not started by its due day, while it is still open. */\nexport function investigationLate(row: { investigationStartedOn?: string | null; closedOn?: string | null; investigationDueOn?: string | null; noInsideHandler?: boolean | null }, today: string): boolean {\n return !row.investigationStartedOn && !row.closedOn && !row.noInsideHandler && !!row.investigationDueOn && row.investigationDueOn < today\n}\n\nexport interface CaseReportInput {\n kind?: string | null\n occurredOn?: string | null\n description?: string | null\n accusedIds?: readonly string[] | null\n}\n\n/** What a report asks for before it is written, or nothing. */\nexport function caseReportRefusal(input: CaseReportInput): Refusal | null {\n if (!CASE_KINDS.includes(input.kind ?? '')) return new Refusal('compliance-case-kind-required', {}, 'pick what it is - workplace harassment or sexual harassment')\n if (input.occurredOn && !DAY.test(input.occurredOn)) return new Refusal('compliance-case-occurred-on-invalid', {}, 'give the day it happened as YYYY-MM-DD')\n if (!input.description?.trim()) return new Refusal('compliance-case-description-required', {}, 'say what happened')\n if (!input.accusedIds?.length) return new Refusal('compliance-case-accused-required', {}, 'name at least one person reported against')\n return null\n}\n\n/** What a handler writes on a case as it goes - the fields and the days among them. */\nexport const HANDLING_FIELDS = ['investigationStartedOn', 'protectionMeasures', 'victimOpinion', 'finding', 'actionOnAccused', 'resultNotice', 'resultToldOn', 'closedOn'] as const\nconst HANDLING_DAYS = ['investigationStartedOn', 'resultToldOn', 'closedOn']\n\n/** What a handling patch asks for before it is written on `row`, or nothing. */\nexport function caseHandlingRefusal(patch: Record<string, any>, row: { receivedOn: string; closedOn?: string | null } & Record<string, any>): Refusal | null {\n if (row.closedOn) return new Refusal('compliance-case-closed', {}, 'a closed case is not written on')\n for (const field of HANDLING_DAYS) {\n const day = patch[field]\n if (day === undefined || day === null || day === '') continue\n if (!DAY.test(day)) return new Refusal(`compliance-case-${kebabOf(field)}-invalid`, {}, `give ${field} as YYYY-MM-DD`)\n if (day < row.receivedOn) return new Refusal(`compliance-case-${kebabOf(field)}-before-receipt`, { receivedOn: row.receivedOn }, `${field} cannot be before the day it was received (${row.receivedOn})`)\n }\n const next = { ...row, ...patch }\n if (next.resultToldOn && !next.resultNotice?.trim()) return new Refusal('compliance-case-notice-required', {}, 'write the result told before its day')\n if (next.closedOn && !next.resultToldOn) return new Refusal('compliance-case-close-before-told', {}, 'tell the reporter and the victim the result before closing it')\n return null\n}\n"]}
@@ -0,0 +1,76 @@
1
+ import { EntityManager } from 'typeorm';
2
+ import { Attachment } from '@things-factory/attachment-base';
3
+ import { Domain, ListParam } from '@things-factory/shell';
4
+ import { ComplianceCase, ComplianceCaseEntry } from './compliance-case';
5
+ import { CaseFacts, CaseSight, CaseViewer } from './compliance-case-rules';
6
+ import { ComplianceCaseHandling, ComplianceCasePerson, ComplianceReportView, NewComplianceCase, NewComplianceCaseReport } from './compliance-case-type';
7
+ /** The files of a report hang on the case under this `refType`, those of the investigation on its entries (attachment-base). */
8
+ export declare const CASE_REF_TYPE = "ComplianceCase";
9
+ export declare const CASE_ENTRY_REF_TYPE = "ComplianceCaseEntry";
10
+ /** The privilege category of the case handlers (`compliance.case-handling`). */
11
+ export declare const CASE_CATEGORY = "compliance-case";
12
+ /** The request's person as a case sees them - asked once per request. */
13
+ export declare function caseViewerOf(context: any): Promise<CaseViewer>;
14
+ /** What the reading rule needs of a case loaded with its accused and investigators. */
15
+ export declare function factsOf(row: ComplianceCase, tx?: EntityManager): Promise<CaseFacts>;
16
+ /** The case and what the request reads of it - one answer, `null`, for "none" and "not yours". */
17
+ export declare function caseInSight(id: string, context: any, tx?: EntityManager): Promise<{
18
+ row: ComplianceCase;
19
+ sight: CaseSight;
20
+ } | null>;
21
+ /** Writes that the request read these cases - on its own, so a failed write never holds the answer back (ADR-0141 §4-4). */
22
+ export declare function recordCaseRead(context: any, ids: readonly string[], sight: 'FULL' | 'PARTY'): Promise<void>;
23
+ /** The users who hold `compliance-case` in the domain - those in a role that gives it, and the domain's owners. */
24
+ export declare function caseHandlerUserIds(domain: Domain, tx?: EntityManager): Promise<string[]>;
25
+ /** Whether, with these employees reported against, a case handler is left to take it. */
26
+ export declare function insideHandlerLeft(accusedIds: readonly string[], context: any): Promise<boolean>;
27
+ /** The investigation-start days of the domain - its setting, or seven. */
28
+ export declare function investigationDays(domain: Domain, tx?: EntityManager): Promise<number>;
29
+ /**
30
+ * The words of the notice of a new case - the same for every case: 「새 신고가 있습니다」 and nothing of it, not its
31
+ * kind, not a name. The handler opens the list to read it, and that read is recorded.
32
+ */
33
+ export declare function caseNoticeWords(lng: string): {
34
+ subject: string;
35
+ body: string;
36
+ action: string;
37
+ note: string;
38
+ };
39
+ /** An employee reports a case of their own seeing - a partner, or an account with no employee record, is refused. */
40
+ export declare function reportComplianceCase(input: NewComplianceCaseReport, files: any[] | undefined, context: any): Promise<ComplianceReportView>;
41
+ /** A handler writes down a report received another way - by mouth, by mail. One reported against is not its handler. */
42
+ export declare function recordComplianceCase(input: NewComplianceCase, files: any[] | undefined, context: any): Promise<ComplianceCase>;
43
+ /** What the handler writes on a case as it goes. A value already written changes with a correction kept. */
44
+ export declare function handleComplianceCase(patch: ComplianceCaseHandling, context: any): Promise<ComplianceCase>;
45
+ /** One entry of the investigation record - written once, never changed. */
46
+ export declare function addComplianceCaseEntry(caseId: string, writtenOn: string, body: string, files: any[] | undefined, context: any): Promise<ComplianceCaseEntry>;
47
+ /** The cases the handler reads, a page of them - never one they are reported against, never one left to the reporter. */
48
+ export declare function complianceCasesFor(params: ListParam, context: any): Promise<{
49
+ items: ComplianceCase[];
50
+ total: number;
51
+ }>;
52
+ /** The cases the request investigates - for an investigator who is no handler, an outside labour attorney. */
53
+ export declare function myInvestigations(context: any): Promise<ComplianceCase[]>;
54
+ /** One case, whole - for its handlers and investigators. */
55
+ export declare function complianceCaseFor(id: string, context: any): Promise<ComplianceCase>;
56
+ /** The cases the request reported, or that happened to them - each as a party reads it. */
57
+ export declare function myComplianceReports(context: any): Promise<ComplianceReportView[]>;
58
+ /** The employees still working here a reporter may name, found by name - for a working employee only. */
59
+ export declare function casePeople(words: string, context: any): Promise<ComplianceCasePerson[]>;
60
+ /** The users of the domain a handler may name as investigators, found by name or mail. */
61
+ export declare function investigatorChoices(words: string, context: any): Promise<ComplianceCasePerson[]>;
62
+ /**
63
+ * Who opens a file of a case. The report's files: those who read all of it, and the reporter their own. The
64
+ * investigation's files: those who read all of it. Every opening is a read of the case, recorded.
65
+ */
66
+ export declare function mayReadCaseFile(attachment: Attachment, context: any): Promise<boolean>;
67
+ /**
68
+ * Cases past their investigation-start day with no investigation started (decision 21). Only the day and the count -
69
+ * a check is read by more than the case handlers, so nothing of a case is in it. A case left to the reporter alone,
70
+ * with nobody inside to investigate it, is not on it.
71
+ */
72
+ export declare function complianceCasesNotInvestigated(tx: EntityManager, domain: Domain, today: string): Promise<{
73
+ id: string;
74
+ receivedOn: string;
75
+ investigationDueOn: string;
76
+ }[]>;