@things-factory/kpi 10.1.246 → 10.1.248

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 (409) hide show
  1. package/package.json +6 -6
  2. package/dist-client/bootstrap.d.ts +0 -2
  3. package/dist-client/bootstrap.js +0 -7
  4. package/dist-client/bootstrap.js.map +0 -1
  5. package/dist-client/charts/kpi-boxplot-chart.d.ts +0 -24
  6. package/dist-client/charts/kpi-boxplot-chart.js +0 -324
  7. package/dist-client/charts/kpi-boxplot-chart.js.map +0 -1
  8. package/dist-client/charts/kpi-mini-trend-chart.d.ts +0 -14
  9. package/dist-client/charts/kpi-mini-trend-chart.js +0 -148
  10. package/dist-client/charts/kpi-mini-trend-chart.js.map +0 -1
  11. package/dist-client/charts/kpi-radar-chart.d.ts +0 -16
  12. package/dist-client/charts/kpi-radar-chart.js +0 -138
  13. package/dist-client/charts/kpi-radar-chart.js.map +0 -1
  14. package/dist-client/charts/kpi-trend-chart.d.ts +0 -25
  15. package/dist-client/charts/kpi-trend-chart.js +0 -186
  16. package/dist-client/charts/kpi-trend-chart.js.map +0 -1
  17. package/dist-client/google-map/common-google-map.d.ts +0 -34
  18. package/dist-client/google-map/common-google-map.js +0 -333
  19. package/dist-client/google-map/common-google-map.js.map +0 -1
  20. package/dist-client/google-map/google-map-loader.d.ts +0 -8
  21. package/dist-client/google-map/google-map-loader.js +0 -22
  22. package/dist-client/google-map/google-map-loader.js.map +0 -1
  23. package/dist-client/index.d.ts +0 -1
  24. package/dist-client/index.js +0 -2
  25. package/dist-client/index.js.map +0 -1
  26. package/dist-client/pages/kpi/kpi-grade-editor.d.ts +0 -35
  27. package/dist-client/pages/kpi/kpi-grade-editor.js +0 -165
  28. package/dist-client/pages/kpi/kpi-grade-editor.js.map +0 -1
  29. package/dist-client/pages/kpi/kpi-importer.d.ts +0 -23
  30. package/dist-client/pages/kpi/kpi-importer.js +0 -92
  31. package/dist-client/pages/kpi/kpi-importer.js.map +0 -1
  32. package/dist-client/pages/kpi/kpi-list-page.d.ts +0 -136
  33. package/dist-client/pages/kpi/kpi-list-page.js +0 -948
  34. package/dist-client/pages/kpi/kpi-list-page.js.map +0 -1
  35. package/dist-client/pages/kpi/kpi-overview-sample.d.ts +0 -36
  36. package/dist-client/pages/kpi/kpi-overview-sample.js +0 -264
  37. package/dist-client/pages/kpi/kpi-overview-sample.js.map +0 -1
  38. package/dist-client/pages/kpi/kpi-overview.d.ts +0 -14
  39. package/dist-client/pages/kpi/kpi-overview.js +0 -361
  40. package/dist-client/pages/kpi/kpi-overview.js.map +0 -1
  41. package/dist-client/pages/kpi/kpi-tree-page.d.ts +0 -51
  42. package/dist-client/pages/kpi/kpi-tree-page.js +0 -355
  43. package/dist-client/pages/kpi/kpi-tree-page.js.map +0 -1
  44. package/dist-client/pages/kpi/kpi-view.d.ts +0 -12
  45. package/dist-client/pages/kpi/kpi-view.js +0 -193
  46. package/dist-client/pages/kpi/kpi-view.js.map +0 -1
  47. package/dist-client/pages/kpi/kpi-viz-editor.d.ts +0 -19
  48. package/dist-client/pages/kpi/kpi-viz-editor.js +0 -562
  49. package/dist-client/pages/kpi/kpi-viz-editor.js.map +0 -1
  50. package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.d.ts +0 -17
  51. package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js +0 -279
  52. package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js.map +0 -1
  53. package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.d.ts +0 -19
  54. package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js +0 -385
  55. package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js.map +0 -1
  56. package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.d.ts +0 -23
  57. package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js +0 -465
  58. package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js.map +0 -1
  59. package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.d.ts +0 -8
  60. package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js +0 -78
  61. package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js.map +0 -1
  62. package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.d.ts +0 -24
  63. package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js +0 -440
  64. package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js.map +0 -1
  65. package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.d.ts +0 -33
  66. package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js +0 -444
  67. package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js.map +0 -1
  68. package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.d.ts +0 -23
  69. package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js +0 -369
  70. package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js.map +0 -1
  71. package/dist-client/pages/kpi-dashboard/kpi-alert-panel.d.ts +0 -18
  72. package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js +0 -128
  73. package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js.map +0 -1
  74. package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.d.ts +0 -31
  75. package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js +0 -493
  76. package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js.map +0 -1
  77. package/dist-client/pages/kpi-dashboard/kpi-dashboard.d.ts +0 -50
  78. package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +0 -884
  79. package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +0 -1
  80. package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.d.ts +0 -12
  81. package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js +0 -82
  82. package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js.map +0 -1
  83. package/dist-client/pages/kpi-dashboard/kpi-history-viewer.d.ts +0 -11
  84. package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js +0 -65
  85. package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js.map +0 -1
  86. package/dist-client/pages/kpi-dashboard/kpi-list-summary.d.ts +0 -13
  87. package/dist-client/pages/kpi-dashboard/kpi-list-summary.js +0 -115
  88. package/dist-client/pages/kpi-dashboard/kpi-list-summary.js.map +0 -1
  89. package/dist-client/pages/kpi-dashboard/kpi-performance-summary.d.ts +0 -15
  90. package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js +0 -146
  91. package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js.map +0 -1
  92. package/dist-client/pages/kpi-dashboard/kpi-value-entry.d.ts +0 -7
  93. package/dist-client/pages/kpi-dashboard/kpi-value-entry.js +0 -86
  94. package/dist-client/pages/kpi-dashboard/kpi-value-entry.js.map +0 -1
  95. package/dist-client/pages/kpi-history/kpi-history-list-page.d.ts +0 -21
  96. package/dist-client/pages/kpi-history/kpi-history-list-page.js +0 -160
  97. package/dist-client/pages/kpi-history/kpi-history-list-page.js.map +0 -1
  98. package/dist-client/pages/kpi-metric/kpi-metric-importer.d.ts +0 -23
  99. package/dist-client/pages/kpi-metric/kpi-metric-importer.js +0 -92
  100. package/dist-client/pages/kpi-metric/kpi-metric-importer.js.map +0 -1
  101. package/dist-client/pages/kpi-metric/kpi-metric-list-page.d.ts +0 -65
  102. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +0 -415
  103. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +0 -1
  104. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +0 -52
  105. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +0 -678
  106. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +0 -1
  107. package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.d.ts +0 -23
  108. package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js +0 -75
  109. package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js.map +0 -1
  110. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +0 -64
  111. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +0 -311
  112. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +0 -1
  113. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.d.ts +0 -12
  114. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js +0 -175
  115. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js.map +0 -1
  116. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.d.ts +0 -35
  117. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js +0 -161
  118. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js.map +0 -1
  119. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.d.ts +0 -47
  120. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js +0 -655
  121. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js.map +0 -1
  122. package/dist-client/pages/kpi-statistic/kpi-statistic-importer.d.ts +0 -23
  123. package/dist-client/pages/kpi-statistic/kpi-statistic-importer.js +0 -92
  124. package/dist-client/pages/kpi-statistic/kpi-statistic-importer.js.map +0 -1
  125. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.d.ts +0 -65
  126. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js +0 -416
  127. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js.map +0 -1
  128. package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +0 -50
  129. package/dist-client/pages/kpi-value/kpi-value-editor-page.js +0 -700
  130. package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +0 -1
  131. package/dist-client/pages/kpi-value/kpi-value-importer.d.ts +0 -23
  132. package/dist-client/pages/kpi-value/kpi-value-importer.js +0 -92
  133. package/dist-client/pages/kpi-value/kpi-value-importer.js.map +0 -1
  134. package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +0 -73
  135. package/dist-client/pages/kpi-value/kpi-value-list-page.js +0 -403
  136. package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +0 -1
  137. package/dist-client/route.d.ts +0 -1
  138. package/dist-client/route.js +0 -47
  139. package/dist-client/route.js.map +0 -1
  140. package/dist-client/tsconfig.tsbuildinfo +0 -1
  141. package/dist-client/viewparts/kpi-metric-input.d.ts +0 -23
  142. package/dist-client/viewparts/kpi-metric-input.js +0 -140
  143. package/dist-client/viewparts/kpi-metric-input.js.map +0 -1
  144. package/dist-client/viewparts/kpi-metric-meta-editor.d.ts +0 -36
  145. package/dist-client/viewparts/kpi-metric-meta-editor.js +0 -321
  146. package/dist-client/viewparts/kpi-metric-meta-editor.js.map +0 -1
  147. package/dist-client/viewparts/metric-input-hint.d.ts +0 -26
  148. package/dist-client/viewparts/metric-input-hint.js +0 -19
  149. package/dist-client/viewparts/metric-input-hint.js.map +0 -1
  150. package/dist-client/viewparts/metric-input.test.d.ts +0 -1
  151. package/dist-client/viewparts/metric-input.test.js +0 -43
  152. package/dist-client/viewparts/metric-input.test.js.map +0 -1
  153. package/dist-client/viewparts/metric-renderer-registry.d.ts +0 -18
  154. package/dist-client/viewparts/metric-renderer-registry.js +0 -29
  155. package/dist-client/viewparts/metric-renderer-registry.js.map +0 -1
  156. package/dist-client/viewparts/ox-grist-editor-metric-input-hint.d.ts +0 -19
  157. package/dist-client/viewparts/ox-grist-editor-metric-input-hint.js +0 -76
  158. package/dist-client/viewparts/ox-grist-editor-metric-input-hint.js.map +0 -1
  159. package/dist-server/calculator/calculator.test.d.ts +0 -1
  160. package/dist-server/calculator/calculator.test.js +0 -126
  161. package/dist-server/calculator/calculator.test.js.map +0 -1
  162. package/dist-server/calculator/evaluator.d.ts +0 -8
  163. package/dist-server/calculator/evaluator.js +0 -42
  164. package/dist-server/calculator/evaluator.js.map +0 -1
  165. package/dist-server/calculator/functions.d.ts +0 -3
  166. package/dist-server/calculator/functions.js +0 -62
  167. package/dist-server/calculator/functions.js.map +0 -1
  168. package/dist-server/calculator/index.d.ts +0 -6
  169. package/dist-server/calculator/index.js +0 -10
  170. package/dist-server/calculator/index.js.map +0 -1
  171. package/dist-server/calculator/parser.d.ts +0 -34
  172. package/dist-server/calculator/parser.js +0 -185
  173. package/dist-server/calculator/parser.js.map +0 -1
  174. package/dist-server/calculator/provider.d.ts +0 -8
  175. package/dist-server/calculator/provider.js +0 -13
  176. package/dist-server/calculator/provider.js.map +0 -1
  177. package/dist-server/calculator/score.d.ts +0 -21
  178. package/dist-server/calculator/score.js +0 -36
  179. package/dist-server/calculator/score.js.map +0 -1
  180. package/dist-server/calculator/score.test.d.ts +0 -1
  181. package/dist-server/calculator/score.test.js +0 -47
  182. package/dist-server/calculator/score.test.js.map +0 -1
  183. package/dist-server/calculator/validate.d.ts +0 -15
  184. package/dist-server/calculator/validate.js +0 -30
  185. package/dist-server/calculator/validate.js.map +0 -1
  186. package/dist-server/calculator/validate.test.d.ts +0 -1
  187. package/dist-server/calculator/validate.test.js +0 -45
  188. package/dist-server/calculator/validate.test.js.map +0 -1
  189. package/dist-server/controllers/index.d.ts +0 -2
  190. package/dist-server/controllers/index.js +0 -6
  191. package/dist-server/controllers/index.js.map +0 -1
  192. package/dist-server/controllers/kpi-metric-value-provider.d.ts +0 -11
  193. package/dist-server/controllers/kpi-metric-value-provider.js +0 -97
  194. package/dist-server/controllers/kpi-metric-value-provider.js.map +0 -1
  195. package/dist-server/controllers/kpi-value-provider.d.ts +0 -11
  196. package/dist-server/controllers/kpi-value-provider.js +0 -50
  197. package/dist-server/controllers/kpi-value-provider.js.map +0 -1
  198. package/dist-server/index.d.ts +0 -5
  199. package/dist-server/index.js +0 -9
  200. package/dist-server/index.js.map +0 -1
  201. package/dist-server/migrations/1752190849680-seed-kpi-metrics.d.ts +0 -6
  202. package/dist-server/migrations/1752190849680-seed-kpi-metrics.js +0 -102
  203. package/dist-server/migrations/1752190849680-seed-kpi-metrics.js.map +0 -1
  204. package/dist-server/migrations/1752190849681-seed-kpi.d.ts +0 -5
  205. package/dist-server/migrations/1752190849681-seed-kpi.js +0 -315
  206. package/dist-server/migrations/1752190849681-seed-kpi.js.map +0 -1
  207. package/dist-server/migrations/1752192090123-add-grades-to-kpi.d.ts +0 -7
  208. package/dist-server/migrations/1752192090123-add-grades-to-kpi.js +0 -51
  209. package/dist-server/migrations/1752192090123-add-grades-to-kpi.js.map +0 -1
  210. package/dist-server/migrations/1752192090124-add-kpi-statistics.d.ts +0 -5
  211. package/dist-server/migrations/1752192090124-add-kpi-statistics.js +0 -710
  212. package/dist-server/migrations/1752192090124-add-kpi-statistics.js.map +0 -1
  213. package/dist-server/migrations/1752192090128-seed-kpi-org-scope.d.ts +0 -6
  214. package/dist-server/migrations/1752192090128-seed-kpi-org-scope.js +0 -111
  215. package/dist-server/migrations/1752192090128-seed-kpi-org-scope.js.map +0 -1
  216. package/dist-server/migrations/1752192090129-seed-kpi-values.d.ts +0 -6
  217. package/dist-server/migrations/1752192090129-seed-kpi-values.js +0 -187
  218. package/dist-server/migrations/1752192090129-seed-kpi-values.js.map +0 -1
  219. package/dist-server/migrations/1752192090200-add-meta-to-kpi-metric.d.ts +0 -10
  220. package/dist-server/migrations/1752192090200-add-meta-to-kpi-metric.js +0 -26
  221. package/dist-server/migrations/1752192090200-add-meta-to-kpi-metric.js.map +0 -1
  222. package/dist-server/migrations/1752192090201-backfill-kpi-metric-meta.d.ts +0 -11
  223. package/dist-server/migrations/1752192090201-backfill-kpi-metric-meta.js +0 -54
  224. package/dist-server/migrations/1752192090201-backfill-kpi-metric-meta.js.map +0 -1
  225. package/dist-server/migrations/grade-data/x11-performance-table.json +0 -962
  226. package/dist-server/migrations/grade-data/x12-performance-table.json +0 -611
  227. package/dist-server/migrations/grade-data/x14-performance-table.json +0 -42
  228. package/dist-server/migrations/grade-data/x21-performance-table.json +0 -889
  229. package/dist-server/migrations/grade-data/x22-performance-table.json +0 -1064
  230. package/dist-server/migrations/grade-data/x23-performance-table.json +0 -42
  231. package/dist-server/migrations/grade-data/x31-performance-table.json +0 -644
  232. package/dist-server/migrations/grade-data/x32-performance-table.json +0 -993
  233. package/dist-server/migrations/grade-data/x33-performance-table.json +0 -195
  234. package/dist-server/migrations/grade-data/x34-performance-table.json +0 -12
  235. package/dist-server/migrations/grade-data/x35-performance-table.json +0 -42
  236. package/dist-server/migrations/grade-data/x41-performance-table.json +0 -825
  237. package/dist-server/migrations/grade-data/x42-performance-table.json +0 -786
  238. package/dist-server/migrations/grade-data/x43-performance-table.json +0 -12
  239. package/dist-server/migrations/grade-data/x44-performance-table.json +0 -42
  240. package/dist-server/migrations/grade-data/x51-performance-table.json +0 -924
  241. package/dist-server/migrations/grade-data/x52-performance-table.json +0 -42
  242. package/dist-server/migrations/grade-data/x61-performance-table.json +0 -261
  243. package/dist-server/migrations/grade-data/x62-performance-table.json +0 -42
  244. package/dist-server/migrations/index.d.ts +0 -1
  245. package/dist-server/migrations/index.js +0 -12
  246. package/dist-server/migrations/index.js.map +0 -1
  247. package/dist-server/migrations/seed-data/kpi-metrics-seed.json +0 -517
  248. package/dist-server/migrations/seed-data/kpi-org-scope-seed.json +0 -1676
  249. package/dist-server/migrations/seed-data/kpi-scopes-seed.json +0 -121
  250. package/dist-server/migrations/seed-data/kpi-values-seed.json +0 -402
  251. package/dist-server/migrations/seed-data/kpis-seed.json +0 -488
  252. package/dist-server/migrations/seed-data/scope-definitions-seed.json +0 -90
  253. package/dist-server/routes.d.ts +0 -1
  254. package/dist-server/routes.js +0 -72
  255. package/dist-server/routes.js.map +0 -1
  256. package/dist-server/service/index.d.ts +0 -15
  257. package/dist-server/service/index.js +0 -49
  258. package/dist-server/service/index.js.map +0 -1
  259. package/dist-server/service/kpi/aggregate-kpi.d.ts +0 -8
  260. package/dist-server/service/kpi/aggregate-kpi.js +0 -123
  261. package/dist-server/service/kpi/aggregate-kpi.js.map +0 -1
  262. package/dist-server/service/kpi/event-subscriber.d.ts +0 -9
  263. package/dist-server/service/kpi/event-subscriber.js +0 -31
  264. package/dist-server/service/kpi/event-subscriber.js.map +0 -1
  265. package/dist-server/service/kpi/index.d.ts +0 -8
  266. package/dist-server/service/kpi/index.js +0 -12
  267. package/dist-server/service/kpi/index.js.map +0 -1
  268. package/dist-server/service/kpi/kpi-formula.service.d.ts +0 -49
  269. package/dist-server/service/kpi/kpi-formula.service.js +0 -165
  270. package/dist-server/service/kpi/kpi-formula.service.js.map +0 -1
  271. package/dist-server/service/kpi/kpi-grade.types.d.ts +0 -22
  272. package/dist-server/service/kpi/kpi-grade.types.js +0 -3
  273. package/dist-server/service/kpi/kpi-grade.types.js.map +0 -1
  274. package/dist-server/service/kpi/kpi-history.d.ts +0 -29
  275. package/dist-server/service/kpi/kpi-history.js +0 -148
  276. package/dist-server/service/kpi/kpi-history.js.map +0 -1
  277. package/dist-server/service/kpi/kpi-mutation.d.ts +0 -14
  278. package/dist-server/service/kpi/kpi-mutation.js +0 -553
  279. package/dist-server/service/kpi/kpi-mutation.js.map +0 -1
  280. package/dist-server/service/kpi/kpi-query.d.ts +0 -24
  281. package/dist-server/service/kpi/kpi-query.js +0 -309
  282. package/dist-server/service/kpi/kpi-query.js.map +0 -1
  283. package/dist-server/service/kpi/kpi-type.d.ts +0 -48
  284. package/dist-server/service/kpi/kpi-type.js +0 -221
  285. package/dist-server/service/kpi/kpi-type.js.map +0 -1
  286. package/dist-server/service/kpi/kpi.d.ts +0 -130
  287. package/dist-server/service/kpi/kpi.js +0 -356
  288. package/dist-server/service/kpi/kpi.js.map +0 -1
  289. package/dist-server/service/kpi-alert/index.d.ts +0 -2
  290. package/dist-server/service/kpi-alert/index.js +0 -6
  291. package/dist-server/service/kpi-alert/index.js.map +0 -1
  292. package/dist-server/service/kpi-alert/kpi-alert-query.d.ts +0 -4
  293. package/dist-server/service/kpi-alert/kpi-alert-query.js +0 -72
  294. package/dist-server/service/kpi-alert/kpi-alert-query.js.map +0 -1
  295. package/dist-server/service/kpi-alert/kpi-alert-type.d.ts +0 -8
  296. package/dist-server/service/kpi-alert/kpi-alert-type.js +0 -33
  297. package/dist-server/service/kpi-alert/kpi-alert-type.js.map +0 -1
  298. package/dist-server/service/kpi-metric/aggregate-kpi-metric.d.ts +0 -8
  299. package/dist-server/service/kpi-metric/aggregate-kpi-metric.js +0 -126
  300. package/dist-server/service/kpi-metric/aggregate-kpi-metric.js.map +0 -1
  301. package/dist-server/service/kpi-metric/index.d.ts +0 -6
  302. package/dist-server/service/kpi-metric/index.js +0 -10
  303. package/dist-server/service/kpi-metric/index.js.map +0 -1
  304. package/dist-server/service/kpi-metric/kpi-metric-meta.d.ts +0 -46
  305. package/dist-server/service/kpi-metric/kpi-metric-meta.js +0 -27
  306. package/dist-server/service/kpi-metric/kpi-metric-meta.js.map +0 -1
  307. package/dist-server/service/kpi-metric/kpi-metric-meta.test.d.ts +0 -1
  308. package/dist-server/service/kpi-metric/kpi-metric-meta.test.js +0 -43
  309. package/dist-server/service/kpi-metric/kpi-metric-meta.test.js.map +0 -1
  310. package/dist-server/service/kpi-metric/kpi-metric-mutation.d.ts +0 -10
  311. package/dist-server/service/kpi-metric/kpi-metric-mutation.js +0 -296
  312. package/dist-server/service/kpi-metric/kpi-metric-mutation.js.map +0 -1
  313. package/dist-server/service/kpi-metric/kpi-metric-query.d.ts +0 -14
  314. package/dist-server/service/kpi-metric/kpi-metric-query.js +0 -126
  315. package/dist-server/service/kpi-metric/kpi-metric-query.js.map +0 -1
  316. package/dist-server/service/kpi-metric/kpi-metric-type.d.ts +0 -45
  317. package/dist-server/service/kpi-metric/kpi-metric-type.js +0 -177
  318. package/dist-server/service/kpi-metric/kpi-metric-type.js.map +0 -1
  319. package/dist-server/service/kpi-metric/kpi-metric.d.ts +0 -39
  320. package/dist-server/service/kpi-metric/kpi-metric.js +0 -174
  321. package/dist-server/service/kpi-metric/kpi-metric.js.map +0 -1
  322. package/dist-server/service/kpi-metric-value/index.d.ts +0 -6
  323. package/dist-server/service/kpi-metric-value/index.js +0 -10
  324. package/dist-server/service/kpi-metric-value/index.js.map +0 -1
  325. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.d.ts +0 -11
  326. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +0 -283
  327. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +0 -1
  328. package/dist-server/service/kpi-metric-value/kpi-metric-value-query.d.ts +0 -13
  329. package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js +0 -106
  330. package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js.map +0 -1
  331. package/dist-server/service/kpi-metric-value/kpi-metric-value-type.d.ts +0 -26
  332. package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js +0 -112
  333. package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js.map +0 -1
  334. package/dist-server/service/kpi-metric-value/kpi-metric-value.d.ts +0 -23
  335. package/dist-server/service/kpi-metric-value/kpi-metric-value.js +0 -107
  336. package/dist-server/service/kpi-metric-value/kpi-metric-value.js.map +0 -1
  337. package/dist-server/service/kpi-org-scope/index.d.ts +0 -5
  338. package/dist-server/service/kpi-org-scope/index.js +0 -9
  339. package/dist-server/service/kpi-org-scope/index.js.map +0 -1
  340. package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.d.ts +0 -8
  341. package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.js +0 -170
  342. package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.js.map +0 -1
  343. package/dist-server/service/kpi-org-scope/kpi-org-scope-query.d.ts +0 -14
  344. package/dist-server/service/kpi-org-scope/kpi-org-scope-query.js +0 -152
  345. package/dist-server/service/kpi-org-scope/kpi-org-scope-query.js.map +0 -1
  346. package/dist-server/service/kpi-org-scope/kpi-org-scope-type.d.ts +0 -26
  347. package/dist-server/service/kpi-org-scope/kpi-org-scope-type.js +0 -101
  348. package/dist-server/service/kpi-org-scope/kpi-org-scope-type.js.map +0 -1
  349. package/dist-server/service/kpi-org-scope/kpi-org-scope.d.ts +0 -26
  350. package/dist-server/service/kpi-org-scope/kpi-org-scope.js +0 -135
  351. package/dist-server/service/kpi-org-scope/kpi-org-scope.js.map +0 -1
  352. package/dist-server/service/kpi-scope/index.d.ts +0 -9
  353. package/dist-server/service/kpi-scope/index.js +0 -14
  354. package/dist-server/service/kpi-scope/index.js.map +0 -1
  355. package/dist-server/service/kpi-scope/kpi-scope-mutation.d.ts +0 -9
  356. package/dist-server/service/kpi-scope/kpi-scope-mutation.js +0 -140
  357. package/dist-server/service/kpi-scope/kpi-scope-mutation.js.map +0 -1
  358. package/dist-server/service/kpi-scope/kpi-scope-query.d.ts +0 -11
  359. package/dist-server/service/kpi-scope/kpi-scope-query.js +0 -89
  360. package/dist-server/service/kpi-scope/kpi-scope-query.js.map +0 -1
  361. package/dist-server/service/kpi-scope/kpi-scope-type.d.ts +0 -35
  362. package/dist-server/service/kpi-scope/kpi-scope-type.js +0 -138
  363. package/dist-server/service/kpi-scope/kpi-scope-type.js.map +0 -1
  364. package/dist-server/service/kpi-scope/kpi-scope.d.ts +0 -38
  365. package/dist-server/service/kpi-scope/kpi-scope.js +0 -144
  366. package/dist-server/service/kpi-scope/kpi-scope.js.map +0 -1
  367. package/dist-server/service/kpi-statistic/index.d.ts +0 -6
  368. package/dist-server/service/kpi-statistic/index.js +0 -10
  369. package/dist-server/service/kpi-statistic/index.js.map +0 -1
  370. package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.d.ts +0 -43
  371. package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.js +0 -181
  372. package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.js.map +0 -1
  373. package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.d.ts +0 -50
  374. package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.js +0 -324
  375. package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.js.map +0 -1
  376. package/dist-server/service/kpi-statistic/kpi-statistic-mutation.d.ts +0 -14
  377. package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js +0 -279
  378. package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js.map +0 -1
  379. package/dist-server/service/kpi-statistic/kpi-statistic-query.d.ts +0 -17
  380. package/dist-server/service/kpi-statistic/kpi-statistic-query.js +0 -183
  381. package/dist-server/service/kpi-statistic/kpi-statistic-query.js.map +0 -1
  382. package/dist-server/service/kpi-statistic/kpi-statistic-type.d.ts +0 -59
  383. package/dist-server/service/kpi-statistic/kpi-statistic-type.js +0 -200
  384. package/dist-server/service/kpi-statistic/kpi-statistic-type.js.map +0 -1
  385. package/dist-server/service/kpi-statistic/kpi-statistic.d.ts +0 -42
  386. package/dist-server/service/kpi-statistic/kpi-statistic.js +0 -210
  387. package/dist-server/service/kpi-statistic/kpi-statistic.js.map +0 -1
  388. package/dist-server/service/kpi-value/index.d.ts +0 -6
  389. package/dist-server/service/kpi-value/index.js +0 -10
  390. package/dist-server/service/kpi-value/index.js.map +0 -1
  391. package/dist-server/service/kpi-value/kpi-value-mutation.d.ts +0 -13
  392. package/dist-server/service/kpi-value/kpi-value-mutation.js +0 -447
  393. package/dist-server/service/kpi-value/kpi-value-mutation.js.map +0 -1
  394. package/dist-server/service/kpi-value/kpi-value-query.d.ts +0 -22
  395. package/dist-server/service/kpi-value/kpi-value-query.js +0 -149
  396. package/dist-server/service/kpi-value/kpi-value-query.js.map +0 -1
  397. package/dist-server/service/kpi-value/kpi-value-score.service.d.ts +0 -24
  398. package/dist-server/service/kpi-value/kpi-value-score.service.js +0 -61
  399. package/dist-server/service/kpi-value/kpi-value-score.service.js.map +0 -1
  400. package/dist-server/service/kpi-value/kpi-value-type.d.ts +0 -33
  401. package/dist-server/service/kpi-value/kpi-value-type.js +0 -156
  402. package/dist-server/service/kpi-value/kpi-value-type.js.map +0 -1
  403. package/dist-server/service/kpi-value/kpi-value.d.ts +0 -32
  404. package/dist-server/service/kpi-value/kpi-value.js +0 -175
  405. package/dist-server/service/kpi-value/kpi-value.js.map +0 -1
  406. package/dist-server/service/utils/value-date-util.d.ts +0 -4
  407. package/dist-server/service/utils/value-date-util.js +0 -117
  408. package/dist-server/service/utils/value-date-util.js.map +0 -1
  409. package/dist-server/tsconfig.tsbuildinfo +0 -1
@@ -1,283 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KpiMetricValueMutation = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const typeorm_1 = require("typeorm");
7
- const shell_1 = require("@things-factory/shell");
8
- const type_graphql_2 = require("type-graphql");
9
- const kpi_1 = require("../kpi/kpi");
10
- const kpi_metric_value_1 = require("./kpi-metric-value");
11
- const kpi_metric_value_type_1 = require("./kpi-metric-value-type");
12
- const kpi_metric_1 = require("../kpi-metric/kpi-metric");
13
- const shell_2 = require("@things-factory/shell");
14
- const value_date_util_1 = require("../utils/value-date-util");
15
- let KpiMetricValueMutation = class KpiMetricValueMutation {
16
- async createKpiMetricValue(metricValue, context) {
17
- const { domain, user, tx } = context.state;
18
- let metric = metricValue.metricId
19
- ? await (0, shell_1.getRepository)(kpi_metric_1.KpiMetric).findOne({ where: { id: metricValue.metricId } })
20
- : undefined;
21
- // valueDate 자동 생성/보정 로직 추가
22
- let periodType = metricValue.periodType;
23
- if (!periodType && metric) {
24
- periodType = metric.periodType;
25
- }
26
- if (!periodType) {
27
- periodType = kpi_1.KpiPeriodType.DAY;
28
- }
29
- // periodType을 string으로 변환 후 KpiPeriodType으로 강제 변환
30
- periodType = kpi_1.KpiPeriodType[String(periodType)];
31
- let valueDate = metricValue.valueDate;
32
- if (!valueDate || !isValueDateValidForPeriodType(valueDate, periodType)) {
33
- valueDate = (0, value_date_util_1.getDefaultValueDate)(periodType);
34
- }
35
- const entity = {
36
- metric,
37
- metricId: metricValue.metricId,
38
- valueDate,
39
- periodType,
40
- value: metricValue.value,
41
- org: metricValue.org,
42
- unit: metricValue.unit,
43
- meta: metricValue.meta,
44
- domain: domain,
45
- creator: user,
46
- updater: user
47
- };
48
- return await (0, shell_1.getRepository)(kpi_metric_value_1.KpiMetricValue, tx).save(entity);
49
- }
50
- async recordKpiMetricValue(metricName, value, meta, org, context) {
51
- const { domain, user, tx } = context.state;
52
- const metric = await (0, shell_1.getRepository)(kpi_metric_1.KpiMetric).findOne({ where: { name: metricName, domain: { id: domain.id } } });
53
- if (!metric)
54
- throw new Error(`Metric not found: ${metricName}`);
55
- const periodType = metric.periodType || kpi_1.KpiPeriodType.DAY;
56
- const valueDate = (0, value_date_util_1.getDefaultValueDate)(periodType);
57
- if (value == null && meta == null) {
58
- throw new Error('Either value or meta must be provided.');
59
- }
60
- const repo = (0, shell_1.getRepository)(kpi_metric_value_1.KpiMetricValue, tx);
61
- let entity = await repo.findOne({
62
- where: {
63
- metric: { id: metric.id },
64
- valueDate,
65
- periodType,
66
- org,
67
- domain: { id: domain.id }
68
- }
69
- });
70
- if (entity) {
71
- entity.value = value;
72
- entity.meta = meta;
73
- entity.updater = user;
74
- }
75
- else {
76
- entity = repo.create({
77
- metric,
78
- metricId: metric.id,
79
- value,
80
- meta,
81
- valueDate,
82
- periodType,
83
- org,
84
- domain,
85
- creator: user,
86
- updater: user
87
- });
88
- }
89
- return await repo.save(entity);
90
- }
91
- async updateKpiMetricValue(id, patch, context) {
92
- const { domain, user, tx } = context.state;
93
- const repository = (0, shell_1.getRepository)(kpi_metric_value_1.KpiMetricValue, tx);
94
- const metricValue = await repository.findOne({
95
- where: { domain: { id: domain.id }, id }
96
- });
97
- let metric = patch.metricId
98
- ? await (0, shell_1.getRepository)(kpi_metric_1.KpiMetric).findOne({ where: { id: patch.metricId } })
99
- : metricValue.metric;
100
- const entity = {
101
- ...metricValue,
102
- ...patch,
103
- metric,
104
- updater: user
105
- };
106
- return await repository.save(entity);
107
- }
108
- async updateMultipleKpiMetricValue(patches, context) {
109
- const { domain, user, tx } = context.state;
110
- let results = [];
111
- const _createRecords = patches.filter((patch) => patch.cuFlag && patch.cuFlag.toUpperCase() === '+');
112
- const _updateRecords = patches.filter((patch) => patch.cuFlag && patch.cuFlag.toUpperCase() === 'M');
113
- const metricValueRepo = (0, shell_1.getRepository)(kpi_metric_value_1.KpiMetricValue, tx);
114
- if (_createRecords.length > 0) {
115
- for (let i = 0; i < _createRecords.length; i++) {
116
- const newRecord = _createRecords[i];
117
- if (!newRecord.metricId) {
118
- throw new Error('metricId is required for creating new metric value');
119
- }
120
- const metric = await (0, shell_1.getRepository)(kpi_metric_1.KpiMetric).findOne({
121
- where: { domain: { id: domain.id }, id: newRecord.metricId }
122
- });
123
- if (!metric) {
124
- throw new Error(`Metric not found: ${newRecord.metricId}`);
125
- }
126
- const result = await metricValueRepo.save({
127
- ...newRecord,
128
- metric,
129
- domain,
130
- creator: user,
131
- updater: user
132
- });
133
- results.push({ ...result, cuFlag: '+' });
134
- }
135
- }
136
- if (_updateRecords.length > 0) {
137
- for (let i = 0; i < _updateRecords.length; i++) {
138
- const updateRecord = _updateRecords[i];
139
- const metricValue = await metricValueRepo.findOne({
140
- where: { domain: { id: domain.id }, id: updateRecord.id }
141
- });
142
- if (!metricValue) {
143
- throw new Error(`failed to find metricValue to update: ${updateRecord.id}`);
144
- }
145
- if (!updateRecord.metricId) {
146
- throw new Error('metricId is required for updating value');
147
- }
148
- const metric = await (0, shell_1.getRepository)(kpi_metric_1.KpiMetric).findOne({
149
- where: { domain: { id: domain.id }, id: updateRecord.metricId }
150
- });
151
- if (!metric) {
152
- throw new Error(`Metric not found: ${updateRecord.metricId}`);
153
- }
154
- const result = await metricValueRepo.save({
155
- ...metricValue,
156
- ...updateRecord,
157
- metric,
158
- updater: user
159
- });
160
- results.push({ ...result, cuFlag: 'M' });
161
- }
162
- }
163
- return results;
164
- }
165
- async deleteKpiMetricValue(id, context) {
166
- const { domain, tx } = context.state;
167
- await (0, shell_1.getRepository)(kpi_metric_value_1.KpiMetricValue, tx).delete({ domain: { id: domain.id }, id });
168
- return true;
169
- }
170
- async deleteKpiMetricValues(ids, context) {
171
- const { domain, tx } = context.state;
172
- await (0, shell_1.getRepository)(kpi_metric_value_1.KpiMetricValue, tx).delete({
173
- domain: { id: domain.id },
174
- id: (0, typeorm_1.In)(ids)
175
- });
176
- return true;
177
- }
178
- async importKpiMetricValues(metricValues, context) {
179
- const { domain, tx } = context.state;
180
- await Promise.all(metricValues.map(async (metricValue) => {
181
- await (0, shell_1.getRepository)(kpi_metric_value_1.KpiMetricValue, tx).save({ domain, ...metricValue });
182
- }));
183
- return true;
184
- }
185
- };
186
- exports.KpiMetricValueMutation = KpiMetricValueMutation;
187
- tslib_1.__decorate([
188
- (0, type_graphql_1.Directive)('@transaction'),
189
- (0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
190
- (0, type_graphql_1.Mutation)(returns => kpi_metric_value_1.KpiMetricValue, { description: 'Create a new metric value with the provided details.' }),
191
- tslib_1.__param(0, (0, type_graphql_1.Arg)('metricValue', { description: 'Input object containing details for the new metric value.' })),
192
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
193
- tslib_1.__metadata("design:type", Function),
194
- tslib_1.__metadata("design:paramtypes", [kpi_metric_value_type_1.NewKpiMetricValue, Object]),
195
- tslib_1.__metadata("design:returntype", Promise)
196
- ], KpiMetricValueMutation.prototype, "createKpiMetricValue", null);
197
- tslib_1.__decorate([
198
- (0, type_graphql_1.Directive)('@transaction'),
199
- (0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
200
- (0, type_graphql_1.Mutation)(returns => kpi_metric_value_1.KpiMetricValue, { description: 'Record a metric value by metric name, value, meta, and org.' }),
201
- tslib_1.__param(0, (0, type_graphql_1.Arg)('metricName', { description: 'Metric code/name.' })),
202
- tslib_1.__param(1, (0, type_graphql_1.Arg)('value', type => type_graphql_2.Float, { nullable: true, description: 'Metric value (number).' })),
203
- tslib_1.__param(2, (0, type_graphql_1.Arg)('meta', type => shell_2.ScalarObject, { nullable: true, description: 'Extended or non-numeric information (JSON).' })),
204
- tslib_1.__param(3, (0, type_graphql_1.Arg)('org', { nullable: true, description: 'Organizational unit for this value (project, department, company, employee, etc.)' })),
205
- tslib_1.__param(4, (0, type_graphql_1.Ctx)()),
206
- tslib_1.__metadata("design:type", Function),
207
- tslib_1.__metadata("design:paramtypes", [String, Number, Object, String, Object]),
208
- tslib_1.__metadata("design:returntype", Promise)
209
- ], KpiMetricValueMutation.prototype, "recordKpiMetricValue", null);
210
- tslib_1.__decorate([
211
- (0, type_graphql_1.Directive)('@transaction'),
212
- (0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
213
- (0, type_graphql_1.Mutation)(returns => kpi_metric_value_1.KpiMetricValue, { description: 'To modify KpiMetricValue information' }),
214
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
215
- tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
216
- tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
217
- tslib_1.__metadata("design:type", Function),
218
- tslib_1.__metadata("design:paramtypes", [String, kpi_metric_value_type_1.KpiMetricValuePatch, Object]),
219
- tslib_1.__metadata("design:returntype", Promise)
220
- ], KpiMetricValueMutation.prototype, "updateKpiMetricValue", null);
221
- tslib_1.__decorate([
222
- (0, type_graphql_1.Directive)('@transaction'),
223
- (0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
224
- (0, type_graphql_1.Mutation)(returns => [kpi_metric_value_1.KpiMetricValue], { description: "To modify multiple KpiMetricValues' information" }),
225
- tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [kpi_metric_value_type_1.KpiMetricValuePatch])),
226
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
227
- tslib_1.__metadata("design:type", Function),
228
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
229
- tslib_1.__metadata("design:returntype", Promise)
230
- ], KpiMetricValueMutation.prototype, "updateMultipleKpiMetricValue", null);
231
- tslib_1.__decorate([
232
- (0, type_graphql_1.Directive)('@transaction'),
233
- (0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
234
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete KpiMetricValue' }),
235
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
236
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
237
- tslib_1.__metadata("design:type", Function),
238
- tslib_1.__metadata("design:paramtypes", [String, Object]),
239
- tslib_1.__metadata("design:returntype", Promise)
240
- ], KpiMetricValueMutation.prototype, "deleteKpiMetricValue", null);
241
- tslib_1.__decorate([
242
- (0, type_graphql_1.Directive)('@transaction'),
243
- (0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
244
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple KpiMetricValues' }),
245
- tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
246
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
247
- tslib_1.__metadata("design:type", Function),
248
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
249
- tslib_1.__metadata("design:returntype", Promise)
250
- ], KpiMetricValueMutation.prototype, "deleteKpiMetricValues", null);
251
- tslib_1.__decorate([
252
- (0, type_graphql_1.Directive)('@transaction'),
253
- (0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
254
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple KpiMetricValues' }),
255
- tslib_1.__param(0, (0, type_graphql_1.Arg)('metricValues', type => [kpi_metric_value_type_1.KpiMetricValuePatch])),
256
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
257
- tslib_1.__metadata("design:type", Function),
258
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
259
- tslib_1.__metadata("design:returntype", Promise)
260
- ], KpiMetricValueMutation.prototype, "importKpiMetricValues", null);
261
- exports.KpiMetricValueMutation = KpiMetricValueMutation = tslib_1.__decorate([
262
- (0, type_graphql_1.Resolver)(kpi_metric_value_1.KpiMetricValue)
263
- ], KpiMetricValueMutation);
264
- // valueDate와 periodType의 일치 여부를 검사하는 유틸리티 함수(임시, 아래에 추가)
265
- function isValueDateValidForPeriodType(valueDate, periodType) {
266
- if (!valueDate)
267
- return false;
268
- switch (periodType) {
269
- case kpi_1.KpiPeriodType.DAY:
270
- return /^\d{4}-\d{2}-\d{2}$/.test(valueDate);
271
- case kpi_1.KpiPeriodType.MONTH:
272
- return /^\d{4}-\d{2}$/.test(valueDate);
273
- case kpi_1.KpiPeriodType.QUARTER:
274
- return /^\d{4}-Q[1-4]$/.test(valueDate);
275
- case kpi_1.KpiPeriodType.WEEK:
276
- return /^\d{4}-W\d{1,2}$/.test(valueDate);
277
- case kpi_1.KpiPeriodType.ALLTIME:
278
- return valueDate === 'ALLTIME';
279
- default:
280
- return true;
281
- }
282
- }
283
- //# sourceMappingURL=kpi-metric-value-mutation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kpi-metric-value-mutation.js","sourceRoot":"","sources":["../../../server/service/kpi-metric-value/kpi-metric-value-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AACrD,+CAAoC;AACpC,oCAA0C;AAE1C,yDAAmD;AACnD,mEAAgF;AAChF,yDAAoD;AACpD,iDAAoD;AACpD,8DAA8D;AAGvD,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAI3B,AAAN,KAAK,CAAC,oBAAoB,CAExB,WAA8B,EACvB,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,IAAI,MAAM,GAAG,WAAW,CAAC,QAAQ;YAC/B,CAAC,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;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;mEAQP;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,sGAAsG,CAAC;IACjH,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;IAEjF,mBAAA,IAAA,kBAAG,EAAC,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,2CAAmB,CAAC,CAAC,CAAA;IAClD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;mEASP;iCAlPU,sBAAsB;IADlC,IAAA,uBAAQ,EAAC,iCAAc,CAAC;GACZ,sBAAsB,CAmPlC;AAED,yDAAyD;AACzD,SAAS,6BAA6B,CAAC,SAAiB,EAAE,UAAyB;IACjF,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAC5B,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,mBAAa,CAAC,GAAG;YACpB,OAAO,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAC9C,KAAK,mBAAa,CAAC,KAAK;YACtB,OAAO,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACxC,KAAK,mBAAa,CAAC,OAAO;YACxB,OAAO,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACzC,KAAK,mBAAa,CAAC,IAAI;YACrB,OAAO,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAC3C,KAAK,mBAAa,CAAC,OAAO;YACxB,OAAO,SAAS,KAAK,SAAS,CAAA;QAChC;YACE,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\nimport { Float } from 'type-graphql'\nimport { KpiPeriodType } from '../kpi/kpi'\n\nimport { KpiMetricValue } from './kpi-metric-value'\nimport { NewKpiMetricValue, KpiMetricValuePatch } from './kpi-metric-value-type'\nimport { KpiMetric } from '../kpi-metric/kpi-metric'\nimport { ScalarObject } from '@things-factory/shell'\nimport { getDefaultValueDate } from '../utils/value-date-util'\n\n@Resolver(KpiMetricValue)\nexport class KpiMetricValueMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => KpiMetricValue, { description: 'Create a new metric value with the provided details.' })\n async createKpiMetricValue(\n @Arg('metricValue', { description: 'Input object containing details for the new metric value.' })\n metricValue: NewKpiMetricValue,\n @Ctx() context: ResolverContext\n ): Promise<KpiMetricValue> {\n const { domain, user, tx } = context.state\n\n let metric = metricValue.metricId\n ? await getRepository(KpiMetric).findOne({ where: { id: metricValue.metricId } })\n : undefined\n\n // valueDate 자동 생성/보정 로직 추가\n let periodType = metricValue.periodType\n if (!periodType && metric) {\n periodType = metric.periodType\n }\n if (!periodType) {\n periodType = KpiPeriodType.DAY\n }\n // periodType을 string으로 변환 후 KpiPeriodType으로 강제 변환\n periodType = KpiPeriodType[String(periodType) as keyof typeof KpiPeriodType]\n let valueDate = metricValue.valueDate\n if (!valueDate || !isValueDateValidForPeriodType(valueDate, periodType)) {\n valueDate = getDefaultValueDate(periodType)\n }\n\n const entity: Partial<KpiMetricValue> = {\n metric,\n metricId: metricValue.metricId,\n valueDate,\n periodType,\n value: metricValue.value,\n org: metricValue.org,\n unit: metricValue.unit,\n meta: metricValue.meta,\n domain: domain,\n creator: user,\n updater: user\n }\n\n return await getRepository(KpiMetricValue, tx).save(entity)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => KpiMetricValue, { description: 'Record a metric value by metric name, value, meta, and org.' })\n async recordKpiMetricValue(\n @Arg('metricName', { description: 'Metric code/name.' }) metricName: string,\n @Arg('value', type => Float, { nullable: true, description: 'Metric value (number).' }) value: number | null,\n @Arg('meta', type => ScalarObject, { nullable: true, description: 'Extended or non-numeric information (JSON).' })\n meta: any,\n @Arg('org', { nullable: true, description: 'Organizational unit for this value (project, department, company, employee, etc.)' })\n org: string | null,\n @Ctx() context: ResolverContext\n ): Promise<KpiMetricValue> {\n const { domain, user, tx } = context.state\n const metric = await getRepository(KpiMetric).findOne({ where: { name: metricName, domain: { id: domain.id } } })\n if (!metric) throw new Error(`Metric not found: ${metricName}`)\n const periodType = metric.periodType || KpiPeriodType.DAY\n const valueDate = getDefaultValueDate(periodType)\n if (value == null && meta == null) {\n throw new Error('Either value or meta must be provided.')\n }\n const repo = getRepository(KpiMetricValue, tx)\n let entity = await repo.findOne({\n where: {\n metric: { id: metric.id },\n valueDate,\n periodType,\n org,\n domain: { id: domain.id }\n }\n })\n if (entity) {\n entity.value = value\n entity.meta = meta\n entity.updater = user\n } else {\n entity = repo.create({\n metric,\n metricId: metric.id,\n value,\n meta,\n valueDate,\n periodType,\n org,\n domain,\n creator: user,\n updater: user\n })\n }\n return await repo.save(entity)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => KpiMetricValue, { description: 'To modify KpiMetricValue information' })\n async updateKpiMetricValue(\n @Arg('id') id: string,\n @Arg('patch') patch: KpiMetricValuePatch,\n @Ctx() context: ResolverContext\n ): Promise<KpiMetricValue> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(KpiMetricValue, tx)\n const metricValue = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n let metric = patch.metricId\n ? await getRepository(KpiMetric).findOne({ where: { id: patch.metricId } })\n : metricValue.metric\n\n const entity: any = {\n ...metricValue,\n ...patch,\n metric,\n updater: user\n }\n\n return await repository.save(entity)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => [KpiMetricValue], { description: \"To modify multiple KpiMetricValues' information\" })\n async updateMultipleKpiMetricValue(\n @Arg('patches', type => [KpiMetricValuePatch]) patches: KpiMetricValuePatch[],\n @Ctx() context: ResolverContext\n ): Promise<KpiMetricValue[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag && patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag && patch.cuFlag.toUpperCase() === 'M')\n const metricValueRepo = getRepository(KpiMetricValue, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n if (!newRecord.metricId) {\n throw new Error('metricId is required for creating new metric value')\n }\n\n const metric = await getRepository(KpiMetric).findOne({\n where: { domain: { id: domain.id }, id: newRecord.metricId }\n })\n\n if (!metric) {\n throw new Error(`Metric not found: ${newRecord.metricId}`)\n }\n\n const result = await metricValueRepo.save({\n ...newRecord,\n metric,\n domain,\n creator: user,\n updater: user\n } as any)\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const metricValue = await metricValueRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!metricValue) {\n throw new Error(`failed to find metricValue to update: ${updateRecord.id}`)\n }\n\n if (!updateRecord.metricId) {\n throw new Error('metricId is required for updating value')\n }\n\n const metric = await getRepository(KpiMetric).findOne({\n where: { domain: { id: domain.id }, id: updateRecord.metricId }\n })\n\n if (!metric) {\n throw new Error(`Metric not found: ${updateRecord.metricId}`)\n }\n\n const result = await metricValueRepo.save({\n ...metricValue,\n ...updateRecord,\n metric,\n updater: user\n } as any)\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete KpiMetricValue' })\n async deleteKpiMetricValue(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n await getRepository(KpiMetricValue, tx).delete({ domain: { id: domain.id }, id })\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple KpiMetricValues' })\n async deleteKpiMetricValues(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n await getRepository(KpiMetricValue, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple KpiMetricValues' })\n async importKpiMetricValues(\n @Arg('metricValues', type => [KpiMetricValuePatch]) metricValues: KpiMetricValuePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n await Promise.all(\n metricValues.map(async (metricValue: KpiMetricValuePatch) => {\n await getRepository(KpiMetricValue, tx).save({ domain, ...metricValue } as any)\n })\n )\n return true\n }\n}\n\n// valueDate와 periodType의 일치 여부를 검사하는 유틸리티 함수(임시, 아래에 추가)\nfunction isValueDateValidForPeriodType(valueDate: string, periodType: KpiPeriodType): boolean {\n if (!valueDate) return false\n switch (periodType) {\n case KpiPeriodType.DAY:\n return /^\\d{4}-\\d{2}-\\d{2}$/.test(valueDate)\n case KpiPeriodType.MONTH:\n return /^\\d{4}-\\d{2}$/.test(valueDate)\n case KpiPeriodType.QUARTER:\n return /^\\d{4}-Q[1-4]$/.test(valueDate)\n case KpiPeriodType.WEEK:\n return /^\\d{4}-W\\d{1,2}$/.test(valueDate)\n case KpiPeriodType.ALLTIME:\n return valueDate === 'ALLTIME'\n default:\n return true\n }\n}\n"]}
@@ -1,13 +0,0 @@
1
- import { Domain, ListParam } from '@things-factory/shell';
2
- import { User } from '@things-factory/auth-base';
3
- import { KpiMetricValue } from './kpi-metric-value';
4
- import { KpiMetricValueList } from './kpi-metric-value-type';
5
- import { KpiMetric } from '../kpi-metric/kpi-metric';
6
- export declare class KpiMetricValueQuery {
7
- kpiMetricValues(params: ListParam, context: ResolverContext): Promise<KpiMetricValueList>;
8
- kpiMetricValue(id: string, context: ResolverContext): Promise<KpiMetricValue | null>;
9
- domain(metricValue: KpiMetricValue): Promise<Domain>;
10
- updater(metricValue: KpiMetricValue): Promise<User>;
11
- creator(metricValue: KpiMetricValue): Promise<User>;
12
- metric(metricValue: KpiMetricValue): Promise<KpiMetric | null>;
13
- }
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KpiMetricValueQuery = void 0;
4
- const tslib_1 = require("tslib");
5
- const typeorm_1 = require("typeorm");
6
- const type_graphql_1 = require("type-graphql");
7
- const shell_1 = require("@things-factory/shell");
8
- const auth_base_1 = require("@things-factory/auth-base");
9
- const kpi_metric_value_1 = require("./kpi-metric-value");
10
- const kpi_metric_value_type_1 = require("./kpi-metric-value-type");
11
- const kpi_metric_1 = require("../kpi-metric/kpi-metric");
12
- let KpiMetricValueQuery = class KpiMetricValueQuery {
13
- async kpiMetricValues(params, context) {
14
- const { domain } = context.state;
15
- const domainIds = await (0, shell_1.getDomainIdsWithAncestors)(domain);
16
- const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
17
- domain: undefined,
18
- params,
19
- repository: (0, shell_1.getRepository)(kpi_metric_value_1.KpiMetricValue),
20
- /* The metric by its name, not metricId: that is the uuid join column, and LOWER(uuid) is an
21
- error on postgres. And no group: this entity has none, and an unknown name throws. Either way
22
- the list's search would answer with an error instead of rows. */
23
- searchables: ['metric', 'valueDate']
24
- });
25
- queryBuilder.andWhere(`${queryBuilder.alias}.domain IN (:...ancestorDomainIds)`, {
26
- ancestorDomainIds: domainIds
27
- });
28
- const [items, total] = await queryBuilder.getManyAndCount();
29
- return { items, total };
30
- }
31
- async kpiMetricValue(id, context) {
32
- const { domain } = context.state;
33
- const domainIds = await (0, shell_1.getDomainIdsWithAncestors)(domain);
34
- return await (0, shell_1.getRepository)(kpi_metric_value_1.KpiMetricValue).findOne({
35
- where: { domain: { id: (0, typeorm_1.In)(domainIds) }, id }
36
- });
37
- }
38
- async domain(metricValue) {
39
- return metricValue.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: metricValue.domainId }));
40
- }
41
- async updater(metricValue) {
42
- return metricValue.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: metricValue.updaterId }));
43
- }
44
- async creator(metricValue) {
45
- return metricValue.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: metricValue.creatorId }));
46
- }
47
- async metric(metricValue) {
48
- if (!metricValue.metricId)
49
- return null;
50
- return await (0, shell_1.getRepository)(kpi_metric_1.KpiMetric).findOneBy({ id: metricValue.metricId });
51
- }
52
- };
53
- exports.KpiMetricValueQuery = KpiMetricValueQuery;
54
- tslib_1.__decorate([
55
- (0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
56
- (0, type_graphql_1.Query)(returns => kpi_metric_value_type_1.KpiMetricValueList, { description: 'To fetch multiple KpiMetricValues' }),
57
- tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
58
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
59
- tslib_1.__metadata("design:type", Function),
60
- tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
61
- tslib_1.__metadata("design:returntype", Promise)
62
- ], KpiMetricValueQuery.prototype, "kpiMetricValues", null);
63
- tslib_1.__decorate([
64
- (0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
65
- (0, type_graphql_1.Query)(returns => kpi_metric_value_1.KpiMetricValue, {
66
- nullable: true,
67
- description: 'Fetch a single metric value by its unique identifier.'
68
- }),
69
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id', { description: 'Unique identifier of the metric value to fetch.' })),
70
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
71
- tslib_1.__metadata("design:type", Function),
72
- tslib_1.__metadata("design:paramtypes", [String, Object]),
73
- tslib_1.__metadata("design:returntype", Promise)
74
- ], KpiMetricValueQuery.prototype, "kpiMetricValue", null);
75
- tslib_1.__decorate([
76
- (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
77
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
78
- tslib_1.__metadata("design:type", Function),
79
- tslib_1.__metadata("design:paramtypes", [kpi_metric_value_1.KpiMetricValue]),
80
- tslib_1.__metadata("design:returntype", Promise)
81
- ], KpiMetricValueQuery.prototype, "domain", null);
82
- tslib_1.__decorate([
83
- (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
84
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
85
- tslib_1.__metadata("design:type", Function),
86
- tslib_1.__metadata("design:paramtypes", [kpi_metric_value_1.KpiMetricValue]),
87
- tslib_1.__metadata("design:returntype", Promise)
88
- ], KpiMetricValueQuery.prototype, "updater", null);
89
- tslib_1.__decorate([
90
- (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
91
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
92
- tslib_1.__metadata("design:type", Function),
93
- tslib_1.__metadata("design:paramtypes", [kpi_metric_value_1.KpiMetricValue]),
94
- tslib_1.__metadata("design:returntype", Promise)
95
- ], KpiMetricValueQuery.prototype, "creator", null);
96
- tslib_1.__decorate([
97
- (0, type_graphql_1.FieldResolver)(type => kpi_metric_1.KpiMetric),
98
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
99
- tslib_1.__metadata("design:type", Function),
100
- tslib_1.__metadata("design:paramtypes", [kpi_metric_value_1.KpiMetricValue]),
101
- tslib_1.__metadata("design:returntype", Promise)
102
- ], KpiMetricValueQuery.prototype, "metric", null);
103
- exports.KpiMetricValueQuery = KpiMetricValueQuery = tslib_1.__decorate([
104
- (0, type_graphql_1.Resolver)(kpi_metric_value_1.KpiMetricValue)
105
- ], KpiMetricValueQuery);
106
- //# sourceMappingURL=kpi-metric-value-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kpi-metric-value-query.js","sourceRoot":"","sources":["../../../server/service/kpi-metric-value/kpi-metric-value-query.ts"],"names":[],"mappings":";;;;AAAA,qCAA4B;AAC5B,+CAA8F;AAC9F,iDAM8B;AAC9B,yDAAgD;AAChD,yDAAmD;AACnD,mEAA4D;AAC5D,yDAAoD;AAG7C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,eAAe,CACM,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,MAAM,SAAS,GAAG,MAAM,IAAA,iCAAyB,EAAC,MAAM,CAAC,CAAA;QAEzD,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM,EAAE,SAAS;YACjB,MAAM;YACN,UAAU,EAAE,IAAA,qBAAa,EAAC,iCAAc,CAAC;YACzC;;+EAEmE;YACnE,WAAW,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;SACrC,CAAC,CAAA;QAEF,YAAY,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,KAAK,oCAAoC,EAAE;YAC/E,iBAAiB,EAAE,SAAS;SAC7B,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAA;QAC3D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAOK,AAAN,KAAK,CAAC,cAAc,CAC6D,EAAU,EAClF,OAAwB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esContent":["import { In } from 'typeorm'\nimport { Directive, Resolver, Query, Args, Arg, Ctx, FieldResolver, Root } from 'type-graphql'\nimport {\n Domain,\n getQueryBuilderFromListParams,\n getRepository,\n ListParam,\n getDomainIdsWithAncestors\n} from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { KpiMetricValue } from './kpi-metric-value'\nimport { KpiMetricValueList } from './kpi-metric-value-type'\nimport { KpiMetric } from '../kpi-metric/kpi-metric'\n\n@Resolver(KpiMetricValue)\nexport class KpiMetricValueQuery {\n @Directive('@privilege(category: \"kpi\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => KpiMetricValueList, { description: 'To fetch multiple KpiMetricValues' })\n async kpiMetricValues(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<KpiMetricValueList> {\n const { domain } = context.state\n const domainIds = await getDomainIdsWithAncestors(domain)\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain: undefined,\n params,\n repository: getRepository(KpiMetricValue),\n /* The metric by its name, not metricId: that is the uuid join column, and LOWER(uuid) is an\n error on postgres. And no group: this entity has none, and an unknown name throws. Either way\n the list's search would answer with an error instead of rows. */\n searchables: ['metric', 'valueDate']\n })\n\n queryBuilder.andWhere(`${queryBuilder.alias}.domain IN (:...ancestorDomainIds)`, {\n ancestorDomainIds: domainIds\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n return { items, total }\n }\n\n @Directive('@privilege(category: \"kpi\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => KpiMetricValue, {\n nullable: true,\n description: 'Fetch a single metric value by its unique identifier.'\n })\n async kpiMetricValue(\n @Arg('id', { description: 'Unique identifier of the metric value to fetch.' }) id: string,\n @Ctx() context: ResolverContext\n ): Promise<KpiMetricValue | null> {\n const { domain } = context.state\n const domainIds = await getDomainIdsWithAncestors(domain)\n return await getRepository(KpiMetricValue).findOne({\n where: { domain: { id: In(domainIds) }, id }\n })\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() metricValue: KpiMetricValue): Promise<Domain> {\n return metricValue.domainId && (await getRepository(Domain).findOneBy({ id: metricValue.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() metricValue: KpiMetricValue): Promise<User> {\n return metricValue.updaterId && (await getRepository(User).findOneBy({ id: metricValue.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() metricValue: KpiMetricValue): Promise<User> {\n return metricValue.creatorId && (await getRepository(User).findOneBy({ id: metricValue.creatorId }))\n }\n\n @FieldResolver(type => KpiMetric)\n async metric(@Root() metricValue: KpiMetricValue): Promise<KpiMetric | null> {\n if (!metricValue.metricId) return null\n return await getRepository(KpiMetric).findOneBy({ id: metricValue.metricId })\n }\n}\n"]}
@@ -1,26 +0,0 @@
1
- import { KpiMetricValue } from './kpi-metric-value';
2
- import { KpiPeriodType } from '../kpi/kpi';
3
- export declare class NewKpiMetricValue {
4
- metricId: string;
5
- valueDate: string;
6
- periodType: KpiPeriodType;
7
- value: number;
8
- unit?: string;
9
- meta?: any;
10
- org?: string;
11
- }
12
- export declare class KpiMetricValuePatch {
13
- id?: string;
14
- metricId?: string;
15
- valueDate?: string;
16
- periodType?: KpiPeriodType;
17
- value?: number;
18
- unit?: string;
19
- meta?: any;
20
- org?: string;
21
- cuFlag?: string;
22
- }
23
- export declare class KpiMetricValueList {
24
- items: KpiMetricValue[];
25
- total: number;
26
- }
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KpiMetricValueList = exports.KpiMetricValuePatch = exports.NewKpiMetricValue = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const shell_1 = require("@things-factory/shell");
7
- const kpi_metric_value_1 = require("./kpi-metric-value");
8
- const kpi_1 = require("../kpi/kpi");
9
- let NewKpiMetricValue = class NewKpiMetricValue {
10
- };
11
- exports.NewKpiMetricValue = NewKpiMetricValue;
12
- tslib_1.__decorate([
13
- (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'ID of the metric to which this value belongs.' }),
14
- tslib_1.__metadata("design:type", String)
15
- ], NewKpiMetricValue.prototype, "metricId", void 0);
16
- tslib_1.__decorate([
17
- (0, type_graphql_1.Field)({ description: 'Date or period for which this metric value is recorded (e.g., day, month, quarter, range).' }),
18
- tslib_1.__metadata("design:type", String)
19
- ], NewKpiMetricValue.prototype, "valueDate", void 0);
20
- tslib_1.__decorate([
21
- (0, type_graphql_1.Field)(type => kpi_1.KpiPeriodType, { description: 'Aggregation period type for this metric value.' }),
22
- tslib_1.__metadata("design:type", String)
23
- ], NewKpiMetricValue.prototype, "periodType", void 0);
24
- tslib_1.__decorate([
25
- (0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: 'The value for this metric and period.' }),
26
- tslib_1.__metadata("design:type", Number)
27
- ], NewKpiMetricValue.prototype, "value", void 0);
28
- tslib_1.__decorate([
29
- (0, type_graphql_1.Field)({ nullable: true, description: 'Unit of measurement for this metric value.' }),
30
- tslib_1.__metadata("design:type", String)
31
- ], NewKpiMetricValue.prototype, "unit", void 0);
32
- tslib_1.__decorate([
33
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, {
34
- nullable: true,
35
- description: 'Extended or non-numeric information related to this metric value, stored as JSON. Can include status, comments, or other metadata.'
36
- }),
37
- tslib_1.__metadata("design:type", Object)
38
- ], NewKpiMetricValue.prototype, "meta", void 0);
39
- tslib_1.__decorate([
40
- (0, type_graphql_1.Field)({ nullable: true, description: 'Organizational unit for this value (project, department, company, employee, etc.)' }),
41
- tslib_1.__metadata("design:type", String)
42
- ], NewKpiMetricValue.prototype, "org", void 0);
43
- exports.NewKpiMetricValue = NewKpiMetricValue = tslib_1.__decorate([
44
- (0, type_graphql_1.InputType)({
45
- description: 'Input type for creating a new metric value. Used in mutations to provide metric value details.'
46
- })
47
- ], NewKpiMetricValue);
48
- let KpiMetricValuePatch = class KpiMetricValuePatch {
49
- };
50
- exports.KpiMetricValuePatch = KpiMetricValuePatch;
51
- tslib_1.__decorate([
52
- (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the metric value to update.' }),
53
- tslib_1.__metadata("design:type", String)
54
- ], KpiMetricValuePatch.prototype, "id", void 0);
55
- tslib_1.__decorate([
56
- (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the metric to which this value belongs.' }),
57
- tslib_1.__metadata("design:type", String)
58
- ], KpiMetricValuePatch.prototype, "metricId", void 0);
59
- tslib_1.__decorate([
60
- (0, type_graphql_1.Field)({
61
- nullable: true,
62
- description: 'Date or period for which this metric value is recorded (e.g., day, month, quarter, range).'
63
- }),
64
- tslib_1.__metadata("design:type", String)
65
- ], KpiMetricValuePatch.prototype, "valueDate", void 0);
66
- tslib_1.__decorate([
67
- (0, type_graphql_1.Field)(type => kpi_1.KpiPeriodType, { nullable: true, description: 'Aggregation period type for this metric value.' }),
68
- tslib_1.__metadata("design:type", String)
69
- ], KpiMetricValuePatch.prototype, "periodType", void 0);
70
- tslib_1.__decorate([
71
- (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'The value for this metric and period.' }),
72
- tslib_1.__metadata("design:type", Number)
73
- ], KpiMetricValuePatch.prototype, "value", void 0);
74
- tslib_1.__decorate([
75
- (0, type_graphql_1.Field)({ nullable: true, description: 'Unit of measurement for this metric value.' }),
76
- tslib_1.__metadata("design:type", String)
77
- ], KpiMetricValuePatch.prototype, "unit", void 0);
78
- tslib_1.__decorate([
79
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, {
80
- nullable: true,
81
- description: 'Extended or non-numeric information related to this metric value, stored as JSON. Can include status, comments, or other metadata.'
82
- }),
83
- tslib_1.__metadata("design:type", Object)
84
- ], KpiMetricValuePatch.prototype, "meta", void 0);
85
- tslib_1.__decorate([
86
- (0, type_graphql_1.Field)({ nullable: true, description: 'Organizational unit for this value (project, department, company, employee, etc.)' }),
87
- tslib_1.__metadata("design:type", String)
88
- ], KpiMetricValuePatch.prototype, "org", void 0);
89
- tslib_1.__decorate([
90
- (0, type_graphql_1.Field)({ nullable: true, description: 'Custom flag for update operations (internal use).' }),
91
- tslib_1.__metadata("design:type", String)
92
- ], KpiMetricValuePatch.prototype, "cuFlag", void 0);
93
- exports.KpiMetricValuePatch = KpiMetricValuePatch = tslib_1.__decorate([
94
- (0, type_graphql_1.InputType)({
95
- description: 'Input type for updating an existing metric value. Used in mutations to patch metric value details.'
96
- })
97
- ], KpiMetricValuePatch);
98
- let KpiMetricValueList = class KpiMetricValueList {
99
- };
100
- exports.KpiMetricValueList = KpiMetricValueList;
101
- tslib_1.__decorate([
102
- (0, type_graphql_1.Field)(type => [kpi_metric_value_1.KpiMetricValue]),
103
- tslib_1.__metadata("design:type", Array)
104
- ], KpiMetricValueList.prototype, "items", void 0);
105
- tslib_1.__decorate([
106
- (0, type_graphql_1.Field)(type => type_graphql_1.Int),
107
- tslib_1.__metadata("design:type", Number)
108
- ], KpiMetricValueList.prototype, "total", void 0);
109
- exports.KpiMetricValueList = KpiMetricValueList = tslib_1.__decorate([
110
- (0, type_graphql_1.ObjectType)()
111
- ], KpiMetricValueList);
112
- //# sourceMappingURL=kpi-metric-value-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kpi-metric-value-type.js","sourceRoot":"","sources":["../../../server/service/kpi-metric-value/kpi-metric-value-type.ts"],"names":[],"mappings":";;;;AAAA,+CAA2E;AAC3E,iDAAoD;AACpD,yDAAmD;AACnD,oCAA0C;AAKnC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAyB7B,CAAA;AAzBY,8CAAiB;AAE5B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;;mDACpE;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,4FAA4F,EAAE,CAAC;;oDACpG;AAGjB;IADC,IAAA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AAgD,EAAE,CAAC;;uDACtF;AAG1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;;kDACjF;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;;iDACxE;AAOb;IALC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE;QAC3B,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,oIAAoI;KACvI,CAAC;;iDACQ;AAGV;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mFAAmF,EAAE,CAAC;;gDAChH;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC;;mDAC7E;8BAjCJ,mBAAmB;IAH/B,IAAA,wBAAS,EAAC;QACT,WAAW,EAAE,oGAAoG;KAClH,CAAC;GACW,mBAAmB,CAkC/B;AAGM,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAM9B,CAAA;AANY,gDAAkB;AAE7B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iCAAc,CAAC,CAAC;;iDACT;AAGvB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;iDACN;6BALF,kBAAkB;IAD9B,IAAA,yBAAU,GAAE;GACA,kBAAkB,CAM9B","sourcesContent":["import { ObjectType, Field, ID, Float, InputType, Int } from 'type-graphql'\nimport { ScalarObject } from '@things-factory/shell'\nimport { KpiMetricValue } from './kpi-metric-value'\nimport { KpiPeriodType } from '../kpi/kpi'\n\n@InputType({\n description: 'Input type for creating a new metric value. Used in mutations to provide metric value details.'\n})\nexport class NewKpiMetricValue {\n @Field(type => ID, { description: 'ID of the metric to which this value belongs.' })\n metricId: string\n\n @Field({ description: 'Date or period for which this metric value is recorded (e.g., day, month, quarter, range).' })\n valueDate: string\n\n @Field(type => KpiPeriodType, { description: 'Aggregation period type for this metric value.' })\n periodType: KpiPeriodType\n\n @Field(type => Float, { description: 'The value for this metric and period.' })\n value: number\n\n @Field({ nullable: true, description: 'Unit of measurement for this metric value.' })\n unit?: string\n\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Extended or non-numeric information related to this metric value, stored as JSON. Can include status, comments, or other metadata.'\n })\n meta?: any\n\n @Field({ nullable: true, description: 'Organizational unit for this value (project, department, company, employee, etc.)' })\n org?: string\n}\n\n@InputType({\n description: 'Input type for updating an existing metric value. Used in mutations to patch metric value details.'\n})\nexport class KpiMetricValuePatch {\n @Field(type => ID, { nullable: true, description: 'ID of the metric value to update.' })\n id?: string\n\n @Field(type => ID, { nullable: true, description: 'ID of the metric to which this value belongs.' })\n metricId?: string\n\n @Field({\n nullable: true,\n description: 'Date or period for which this metric value is recorded (e.g., day, month, quarter, range).'\n })\n valueDate?: string\n\n @Field(type => KpiPeriodType, { nullable: true, description: 'Aggregation period type for this metric value.' })\n periodType?: KpiPeriodType\n\n @Field(type => Float, { nullable: true, description: 'The value for this metric and period.' })\n value?: number\n\n @Field({ nullable: true, description: 'Unit of measurement for this metric value.' })\n unit?: string\n\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Extended or non-numeric information related to this metric value, stored as JSON. Can include status, comments, or other metadata.'\n })\n meta?: any\n\n @Field({ nullable: true, description: 'Organizational unit for this value (project, department, company, employee, etc.)' })\n org?: string\n\n @Field({ nullable: true, description: 'Custom flag for update operations (internal use).' })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class KpiMetricValueList {\n @Field(type => [KpiMetricValue])\n items: KpiMetricValue[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -1,23 +0,0 @@
1
- import { Domain } from '@things-factory/shell';
2
- import { KpiMetric } from '../kpi-metric/kpi-metric';
3
- import { KpiPeriodType } from '../kpi/kpi';
4
- import { User } from '@things-factory/auth-base';
5
- export declare class KpiMetricValue {
6
- id: string;
7
- domain?: Domain;
8
- domainId?: string;
9
- metric: KpiMetric;
10
- metricId: string;
11
- value: number;
12
- unit?: string;
13
- valueDate: string;
14
- periodType: KpiPeriodType;
15
- org?: string;
16
- meta?: any;
17
- createdAt?: Date;
18
- updatedAt?: Date;
19
- creator?: User;
20
- creatorId?: string;
21
- updater?: User;
22
- updaterId?: string;
23
- }