@things-factory/kpi 9.0.31 → 9.0.33
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.
- package/README.md +1 -2
- package/client/charts/kpi-boxplot-chart.ts +182 -42
- package/client/charts/kpi-radar-chart.ts +9 -9
- package/client/pages/kpi/kpi-list-page.ts +196 -32
- package/client/pages/kpi/kpi-overview.ts +9 -11
- package/client/pages/kpi/kpi-tree-page.ts +409 -0
- package/client/pages/kpi/kpi-view.ts +187 -0
- package/client/pages/kpi-dashboard/cards/kpi-level1-card.ts +1 -1
- package/client/pages/kpi-dashboard/cards/kpi-level2-comparison.ts +1 -1
- package/client/pages/kpi-dashboard/cards/kpi-level3-comparison.ts +1 -1
- package/client/pages/kpi-dashboard/components/kpi-left-panel.ts +198 -160
- package/client/pages/kpi-dashboard/components/kpi-map-panel.ts +133 -0
- package/client/pages/kpi-dashboard/components/kpi-region-popup.ts +3 -2
- package/client/pages/kpi-dashboard/kpi-dashboard-map.ts +291 -48
- package/client/pages/kpi-dashboard/kpi-dashboard.ts +28 -30
- package/client/pages/kpi-history/kpi-history-list-page.ts +11 -11
- package/client/pages/kpi-metric/kpi-metric-list-page.ts +10 -2
- package/client/pages/kpi-metric-value/kpi-metric-value-editor-page.ts +7 -7
- package/client/pages/kpi-metric-value/kpi-metric-value-importer.ts +2 -2
- package/client/pages/kpi-metric-value/kpi-metric-value-list-page.ts +16 -8
- package/client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.ts +5 -5
- package/client/pages/kpi-statistic/kpi-statistic-editor-page.ts +1 -2
- package/client/pages/kpi-statistic/kpi-statistic-list-page.ts +10 -2
- package/client/pages/kpi-value/kpi-value-editor-page.ts +11 -7
- package/client/pages/kpi-value/kpi-value-list-page.ts +31 -7
- package/client/route.ts +2 -9
- package/design-entities.md +8 -12
- package/dist-client/charts/kpi-boxplot-chart.d.ts +2 -0
- package/dist-client/charts/kpi-boxplot-chart.js +168 -42
- package/dist-client/charts/kpi-boxplot-chart.js.map +1 -1
- package/dist-client/charts/kpi-radar-chart.js +9 -9
- package/dist-client/charts/kpi-radar-chart.js.map +1 -1
- package/dist-client/pages/kpi/kpi-list-page.d.ts +19 -3
- package/dist-client/pages/kpi/kpi-list-page.js +188 -32
- package/dist-client/pages/kpi/kpi-list-page.js.map +1 -1
- package/dist-client/pages/kpi/kpi-overview.js +9 -11
- package/dist-client/pages/kpi/kpi-overview.js.map +1 -1
- package/dist-client/pages/kpi/kpi-tree-page.d.ts +59 -0
- package/dist-client/pages/kpi/kpi-tree-page.js +403 -0
- package/dist-client/pages/kpi/kpi-tree-page.js.map +1 -0
- package/dist-client/pages/kpi/kpi-view.d.ts +12 -0
- package/dist-client/pages/kpi/kpi-view.js +191 -0
- package/dist-client/pages/kpi/kpi-view.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.d.ts +3 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js +197 -161
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.d.ts +5 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js +146 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js +3 -2
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.d.ts +3 -1
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js +268 -46
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +28 -30
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +1 -1
- package/dist-client/pages/kpi-history/kpi-history-list-page.d.ts +6 -1
- package/dist-client/pages/kpi-history/kpi-history-list-page.js +11 -11
- package/dist-client/pages/kpi-history/kpi-history-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.d.ts +5 -0
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +10 -2
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +8 -8
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js +2 -2
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +5 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +16 -8
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.d.ts +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js +6 -6
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js.map +1 -1
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js +1 -2
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js.map +1 -1
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.d.ts +5 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js +10 -2
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +2 -1
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js +16 -8
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +5 -0
- package/dist-client/pages/kpi-value/kpi-value-list-page.js +31 -7
- package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +2 -8
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/kpi-metric-value-provider.d.ts +1 -1
- package/dist-server/controllers/kpi-metric-value-provider.js +4 -4
- package/dist-server/controllers/kpi-metric-value-provider.js.map +1 -1
- package/dist-server/controllers/kpi-value-provider.d.ts +1 -1
- package/dist-server/controllers/kpi-value-provider.js +3 -3
- package/dist-server/controllers/kpi-value-provider.js.map +1 -1
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.d.ts +6 -0
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.js +101 -0
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.js.map +1 -0
- package/dist-server/migrations/1752190849681-seed-kpi.d.ts +5 -0
- package/dist-server/migrations/1752190849681-seed-kpi.js +315 -0
- package/dist-server/migrations/1752190849681-seed-kpi.js.map +1 -0
- package/dist-server/migrations/1752192090123-add-grades-to-kpi.d.ts +7 -0
- package/dist-server/migrations/1752192090123-add-grades-to-kpi.js +51 -0
- package/dist-server/migrations/1752192090123-add-grades-to-kpi.js.map +1 -0
- package/dist-server/migrations/1752192090124-add-kpi-statistics.d.ts +5 -0
- package/dist-server/migrations/1752192090124-add-kpi-statistics.js +710 -0
- package/dist-server/migrations/1752192090124-add-kpi-statistics.js.map +1 -0
- package/dist-server/migrations/1752192090128-seed-kpi-org-scope.d.ts +6 -0
- package/dist-server/migrations/1752192090128-seed-kpi-org-scope.js +111 -0
- package/dist-server/migrations/1752192090128-seed-kpi-org-scope.js.map +1 -0
- package/dist-server/migrations/1752192090129-seed-kpi-values.d.ts +6 -0
- package/dist-server/migrations/1752192090129-seed-kpi-values.js +187 -0
- package/dist-server/migrations/1752192090129-seed-kpi-values.js.map +1 -0
- package/dist-server/migrations/grade-data/x11-performance-table.json +962 -0
- package/dist-server/migrations/grade-data/x12-performance-table.json +611 -0
- package/dist-server/migrations/grade-data/x14-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x21-performance-table.json +889 -0
- package/dist-server/migrations/grade-data/x22-performance-table.json +1064 -0
- package/dist-server/migrations/grade-data/x23-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x31-performance-table.json +644 -0
- package/dist-server/migrations/grade-data/x32-performance-table.json +993 -0
- package/dist-server/migrations/grade-data/x33-performance-table.json +195 -0
- package/dist-server/migrations/grade-data/x34-performance-table.json +12 -0
- package/dist-server/migrations/grade-data/x35-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x41-performance-table.json +825 -0
- package/dist-server/migrations/grade-data/x42-performance-table.json +786 -0
- package/dist-server/migrations/grade-data/x43-performance-table.json +12 -0
- package/dist-server/migrations/grade-data/x44-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x51-performance-table.json +924 -0
- package/dist-server/migrations/grade-data/x52-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x61-performance-table.json +261 -0
- package/dist-server/migrations/grade-data/x62-performance-table.json +42 -0
- package/dist-server/migrations/seed-data/kpi-metrics-seed.json +454 -0
- package/dist-server/migrations/seed-data/kpi-org-scope-seed.json +1676 -0
- package/dist-server/migrations/seed-data/kpi-scopes-seed.json +121 -0
- package/dist-server/migrations/seed-data/kpi-values-seed.json +402 -0
- package/dist-server/migrations/seed-data/kpis-seed.json +488 -0
- package/dist-server/migrations/seed-data/scope-definitions-seed.json +90 -0
- package/dist-server/service/index.d.ts +4 -7
- package/dist-server/service/index.js +10 -13
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/kpi/aggregate-kpi.js +30 -13
- package/dist-server/service/kpi/aggregate-kpi.js.map +1 -1
- package/dist-server/service/kpi/kpi-formula.service.d.ts +15 -0
- package/dist-server/service/kpi/kpi-formula.service.js +90 -0
- package/dist-server/service/kpi/kpi-formula.service.js.map +1 -1
- package/dist-server/service/kpi/kpi-history.d.ts +0 -3
- package/dist-server/service/kpi/kpi-history.js +0 -10
- package/dist-server/service/kpi/kpi-history.js.map +1 -1
- package/dist-server/service/kpi/kpi-mutation.d.ts +1 -1
- package/dist-server/service/kpi/kpi-mutation.js +57 -20
- package/dist-server/service/kpi/kpi-mutation.js.map +1 -1
- package/dist-server/service/kpi/kpi-query.d.ts +7 -3
- package/dist-server/service/kpi/kpi-query.js +126 -10
- package/dist-server/service/kpi/kpi-query.js.map +1 -1
- package/dist-server/service/kpi/kpi-type.d.ts +4 -2
- package/dist-server/service/kpi/kpi-type.js +12 -4
- package/dist-server/service/kpi/kpi-type.js.map +1 -1
- package/dist-server/service/kpi/kpi.d.ts +4 -3
- package/dist-server/service/kpi/kpi.js +20 -8
- package/dist-server/service/kpi/kpi.js.map +1 -1
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js +46 -11
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js.map +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.d.ts +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +6 -6
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.d.ts +2 -2
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js +4 -4
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js.map +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value.d.ts +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js +3 -3
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js.map +1 -1
- package/dist-server/service/kpi-org-scope/index.d.ts +5 -0
- package/dist-server/service/kpi-org-scope/index.js +9 -0
- package/dist-server/service/kpi-org-scope/index.js.map +1 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.d.ts +8 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.js +170 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.js.map +1 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-query.d.ts +14 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-query.js +152 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-query.js.map +1 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-type.d.ts +26 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-type.js +101 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-type.js.map +1 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope.d.ts +26 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope.js +135 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope.js.map +1 -0
- package/dist-server/service/kpi-scope/index.d.ts +9 -0
- package/dist-server/service/kpi-scope/index.js +14 -0
- package/dist-server/service/kpi-scope/index.js.map +1 -0
- package/dist-server/service/kpi-scope/kpi-scope-mutation.d.ts +9 -0
- package/dist-server/service/kpi-scope/kpi-scope-mutation.js +135 -0
- package/dist-server/service/kpi-scope/kpi-scope-mutation.js.map +1 -0
- package/dist-server/service/kpi-scope/kpi-scope-query.d.ts +11 -0
- package/dist-server/service/kpi-scope/kpi-scope-query.js +89 -0
- package/dist-server/service/kpi-scope/kpi-scope-query.js.map +1 -0
- package/dist-server/service/kpi-scope/kpi-scope-type.d.ts +35 -0
- package/dist-server/service/kpi-scope/kpi-scope-type.js +138 -0
- package/dist-server/service/kpi-scope/kpi-scope-type.js.map +1 -0
- package/dist-server/service/kpi-scope/kpi-scope.d.ts +38 -0
- package/dist-server/service/kpi-scope/kpi-scope.js +144 -0
- package/dist-server/service/kpi-scope/kpi-scope.js.map +1 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.d.ts +43 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.js +181 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.js.map +1 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.d.ts +50 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.js +324 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.js.map +1 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.d.ts +4 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js +76 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js.map +1 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-query.d.ts +5 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-query.js +92 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-query.js.map +1 -1
- package/dist-server/service/kpi-statistic/kpi-statistic.d.ts +4 -0
- package/dist-server/service/kpi-statistic/kpi-statistic.js +33 -0
- package/dist-server/service/kpi-statistic/kpi-statistic.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-mutation.js +71 -7
- package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-type.d.ts +4 -2
- package/dist-server/service/kpi-value/kpi-value-type.js +12 -4
- package/dist-server/service/kpi-value/kpi-value-type.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value.d.ts +3 -1
- package/dist-server/service/kpi-value/kpi-value.js +11 -5
- package/dist-server/service/kpi-value/kpi-value.js.map +1 -1
- package/dist-server/service/utils/value-date-util.d.ts +1 -0
- package/dist-server/service/utils/value-date-util.js +41 -0
- package/dist-server/service/utils/value-date-util.js.map +1 -1
- package/dist-server/tsconfig.json +10 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -6
- package/server/@types/index.d.ts +11 -0
- package/server/controllers/kpi-metric-value-provider.ts +5 -5
- package/server/controllers/kpi-value-provider.ts +4 -4
- package/server/migrations/1752190849680-seed-kpi-metrics.ts +124 -0
- package/server/migrations/1752190849681-seed-kpi.ts +356 -0
- package/server/migrations/1752192090123-add-grades-to-kpi.ts +67 -0
- package/server/migrations/1752192090124-add-kpi-statistics.ts +719 -0
- package/server/migrations/1752192090128-seed-kpi-org-scope.ts +132 -0
- package/server/migrations/1752192090129-seed-kpi-values.ts +207 -0
- package/server/migrations/grade-data/x11-performance-table.json +962 -0
- package/server/migrations/grade-data/x12-performance-table.json +611 -0
- package/server/migrations/grade-data/x14-performance-table.json +42 -0
- package/server/migrations/grade-data/x21-performance-table.json +889 -0
- package/server/migrations/grade-data/x22-performance-table.json +1064 -0
- package/server/migrations/grade-data/x23-performance-table.json +42 -0
- package/server/migrations/grade-data/x31-performance-table.json +644 -0
- package/server/migrations/grade-data/x32-performance-table.json +993 -0
- package/server/migrations/grade-data/x33-performance-table.json +195 -0
- package/server/migrations/grade-data/x34-performance-table.json +12 -0
- package/server/migrations/grade-data/x35-performance-table.json +42 -0
- package/server/migrations/grade-data/x41-performance-table.json +825 -0
- package/server/migrations/grade-data/x42-performance-table.json +786 -0
- package/server/migrations/grade-data/x43-performance-table.json +12 -0
- package/server/migrations/grade-data/x44-performance-table.json +42 -0
- package/server/migrations/grade-data/x51-performance-table.json +924 -0
- package/server/migrations/grade-data/x52-performance-table.json +42 -0
- package/server/migrations/grade-data/x61-performance-table.json +261 -0
- package/server/migrations/grade-data/x62-performance-table.json +42 -0
- package/server/migrations/seed-data/kpi-metrics-seed.json +454 -0
- package/server/migrations/seed-data/kpi-org-scope-seed.json +1676 -0
- package/server/migrations/seed-data/kpi-scopes-seed.json +121 -0
- package/server/migrations/seed-data/kpi-values-seed.json +402 -0
- package/server/migrations/seed-data/kpis-seed.json +488 -0
- package/server/migrations/seed-data/scope-definitions-seed.json +90 -0
- package/server/service/index.ts +10 -13
- package/server/service/kpi/aggregate-kpi.ts +31 -13
- package/server/service/kpi/kpi-formula.service.ts +101 -0
- package/server/service/kpi/kpi-history.ts +0 -8
- package/server/service/kpi/kpi-mutation.ts +59 -19
- package/server/service/kpi/kpi-query.ts +119 -8
- package/server/service/kpi/kpi-type.ts +10 -4
- package/server/service/kpi/kpi.ts +17 -7
- package/server/service/kpi-metric/aggregate-kpi-metric.ts +55 -11
- package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +6 -6
- package/server/service/kpi-metric-value/kpi-metric-value-type.ts +4 -4
- package/server/service/kpi-metric-value/kpi-metric-value.ts +3 -3
- package/server/service/kpi-org-scope/index.ts +6 -0
- package/server/service/kpi-org-scope/kpi-org-scope-mutation.ts +173 -0
- package/server/service/kpi-org-scope/kpi-org-scope-query.ts +127 -0
- package/server/service/kpi-org-scope/kpi-org-scope-type.ts +68 -0
- package/server/service/kpi-org-scope/kpi-org-scope.ts +123 -0
- package/server/service/kpi-scope/index.ts +11 -0
- package/server/service/kpi-scope/kpi-scope-mutation.ts +129 -0
- package/server/service/kpi-scope/kpi-scope-query.ts +63 -0
- package/server/service/kpi-scope/kpi-scope-type.ts +96 -0
- package/server/service/kpi-scope/kpi-scope.ts +143 -0
- package/server/service/kpi-statistic/kpi-statistic-batch.service.ts +231 -0
- package/server/service/kpi-statistic/kpi-statistic-calculation.service.ts +410 -0
- package/server/service/kpi-statistic/kpi-statistic-mutation.ts +97 -0
- package/server/service/kpi-statistic/kpi-statistic-query.ts +89 -2
- package/server/service/kpi-statistic/kpi-statistic.ts +32 -0
- package/server/service/kpi-value/kpi-value-mutation.ts +73 -7
- package/server/service/kpi-value/kpi-value-type.ts +10 -4
- package/server/service/kpi-value/kpi-value.ts +10 -5
- package/server/service/utils/value-date-util.ts +47 -0
- package/server/types/global.d.ts +8 -0
- package/things-factory.config.js +1 -0
- package/translations/en.json +15 -3
- package/translations/ja.json +13 -3
- package/translations/ko.json +15 -3
- package/translations/ms.json +13 -3
- package/translations/zh.json +13 -3
- package/client/pages/kpi-category/kpi-category-importer.ts +0 -90
- package/client/pages/kpi-category/kpi-category-list-page.ts +0 -537
- package/client/pages/kpi-category/kpi-category-value-calculator.ts +0 -233
- package/client/pages/kpi-category-value/kpi-category-value-list-page.ts +0 -404
- package/dist-client/pages/kpi-category/kpi-category-importer.d.ts +0 -23
- package/dist-client/pages/kpi-category/kpi-category-importer.js +0 -92
- package/dist-client/pages/kpi-category/kpi-category-importer.js.map +0 -1
- package/dist-client/pages/kpi-category/kpi-category-list-page.d.ts +0 -74
- package/dist-client/pages/kpi-category/kpi-category-list-page.js +0 -517
- package/dist-client/pages/kpi-category/kpi-category-list-page.js.map +0 -1
- package/dist-client/pages/kpi-category/kpi-category-value-calculator.d.ts +0 -13
- package/dist-client/pages/kpi-category/kpi-category-value-calculator.js +0 -256
- package/dist-client/pages/kpi-category/kpi-category-value-calculator.js.map +0 -1
- package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.d.ts +0 -63
- package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.js +0 -393
- package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.js.map +0 -1
- package/dist-server/service/kpi-category/index.d.ts +0 -6
- package/dist-server/service/kpi-category/index.js +0 -10
- package/dist-server/service/kpi-category/index.js.map +0 -1
- package/dist-server/service/kpi-category/kpi-category-mutation.d.ts +0 -9
- package/dist-server/service/kpi-category/kpi-category-mutation.js +0 -221
- package/dist-server/service/kpi-category/kpi-category-mutation.js.map +0 -1
- package/dist-server/service/kpi-category/kpi-category-query.d.ts +0 -18
- package/dist-server/service/kpi-category/kpi-category-query.js +0 -115
- package/dist-server/service/kpi-category/kpi-category-query.js.map +0 -1
- package/dist-server/service/kpi-category/kpi-category-type.d.ts +0 -24
- package/dist-server/service/kpi-category/kpi-category-type.js +0 -100
- package/dist-server/service/kpi-category/kpi-category-type.js.map +0 -1
- package/dist-server/service/kpi-category/kpi-category.d.ts +0 -22
- package/dist-server/service/kpi-category/kpi-category.js +0 -106
- package/dist-server/service/kpi-category/kpi-category.js.map +0 -1
- package/dist-server/service/kpi-category-value/index.d.ts +0 -6
- package/dist-server/service/kpi-category-value/index.js +0 -10
- package/dist-server/service/kpi-category-value/index.js.map +0 -1
- package/dist-server/service/kpi-category-value/kpi-category-value-mutation.d.ts +0 -8
- package/dist-server/service/kpi-category-value/kpi-category-value-mutation.js +0 -102
- package/dist-server/service/kpi-category-value/kpi-category-value-mutation.js.map +0 -1
- package/dist-server/service/kpi-category-value/kpi-category-value-query.d.ts +0 -13
- package/dist-server/service/kpi-category-value/kpi-category-value-query.js +0 -91
- package/dist-server/service/kpi-category-value/kpi-category-value-query.js.map +0 -1
- package/dist-server/service/kpi-category-value/kpi-category-value-type.d.ts +0 -19
- package/dist-server/service/kpi-category-value/kpi-category-value-type.js +0 -73
- package/dist-server/service/kpi-category-value/kpi-category-value-type.js.map +0 -1
- package/dist-server/service/kpi-category-value/kpi-category-value.d.ts +0 -19
- package/dist-server/service/kpi-category-value/kpi-category-value.js +0 -91
- package/dist-server/service/kpi-category-value/kpi-category-value.js.map +0 -1
- package/helps/kpi/kpi-category.md +0 -160
- package/server/service/kpi-category/index.ts +0 -7
- package/server/service/kpi-category/kpi-category-mutation.ts +0 -217
- package/server/service/kpi-category/kpi-category-query.ts +0 -87
- package/server/service/kpi-category/kpi-category-type.ts +0 -73
- package/server/service/kpi-category/kpi-category.ts +0 -95
- package/server/service/kpi-category-value/index.ts +0 -7
- package/server/service/kpi-category-value/kpi-category-value-mutation.ts +0 -88
- package/server/service/kpi-category-value/kpi-category-value-query.ts +0 -62
- package/server/service/kpi-category-value/kpi-category-value-type.ts +0 -48
- package/server/service/kpi-category-value/kpi-category-value.ts +0 -79
|
@@ -39,9 +39,13 @@ tslib_1.__decorate([
|
|
|
39
39
|
tslib_1.__metadata("design:type", Object)
|
|
40
40
|
], NewKpiValue.prototype, "meta", void 0);
|
|
41
41
|
tslib_1.__decorate([
|
|
42
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
42
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the KPI organization scope for this value.' }),
|
|
43
43
|
tslib_1.__metadata("design:type", String)
|
|
44
|
-
], NewKpiValue.prototype, "
|
|
44
|
+
], NewKpiValue.prototype, "kpiOrgScopeId", void 0);
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Legacy organizational unit identifier (for backward compatibility)' }),
|
|
47
|
+
tslib_1.__metadata("design:type", String)
|
|
48
|
+
], NewKpiValue.prototype, "org", void 0);
|
|
45
49
|
tslib_1.__decorate([
|
|
46
50
|
(0, type_graphql_1.Field)(type => kpi_value_1.KpiValueInputType, {
|
|
47
51
|
nullable: true,
|
|
@@ -100,9 +104,13 @@ tslib_1.__decorate([
|
|
|
100
104
|
tslib_1.__metadata("design:type", Object)
|
|
101
105
|
], KpiValuePatch.prototype, "meta", void 0);
|
|
102
106
|
tslib_1.__decorate([
|
|
103
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
107
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the KPI organization scope for this value.' }),
|
|
108
|
+
tslib_1.__metadata("design:type", String)
|
|
109
|
+
], KpiValuePatch.prototype, "kpiOrgScopeId", void 0);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Legacy organizational unit identifier (for backward compatibility)' }),
|
|
104
112
|
tslib_1.__metadata("design:type", String)
|
|
105
|
-
], KpiValuePatch.prototype, "
|
|
113
|
+
], KpiValuePatch.prototype, "org", void 0);
|
|
106
114
|
tslib_1.__decorate([
|
|
107
115
|
(0, type_graphql_1.Field)(type => kpi_value_1.KpiValueInputType, {
|
|
108
116
|
nullable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-value-type.js","sourceRoot":"","sources":["../../../server/service/kpi-value/kpi-value-type.ts"],"names":[],"mappings":";;;;AAEA,+CAA6F;AAE7F,iDAA+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I,CAAC,EAAE,CAAC,oBAAY,EAAE;QAC3B,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,yIAAyI;KAC5I,CAAC;;2CACQ;AAGV;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;;oDACjF;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oEAAoE,EAAE,CAAC;;0CACjG;AAMZ;IAJC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,6BAAiB,EAAE;QAChC,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,+EAA+E;KAC7F,CAAC;;gDAC2B;AAG7B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iEAAiE,EAAE,CAAC;;6CAC3F;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC;;6CAC7E;wBAnDJ,aAAa;IAHzB,IAAA,wBAAS,EAAC;QACT,WAAW,EAAE,8FAA8F;KAC5G,CAAC;GACW,aAAa,CAoDzB;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAY;CAMxB,CAAA;AANY,oCAAY;AAEvB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,oBAAQ,CAAC,CAAC;;2CACT;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;2CACN;uBALF,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CAMxB","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType, Float } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { KpiValue, KpiValueInputType } from './kpi-value'\n\n@InputType({ description: 'Input type for creating a new KPI value. Used in mutations to provide KPI value details.' })\nexport class NewKpiValue {\n @Field(type => ID, { description: 'ID of the KPI to which this value belongs.' })\n kpiId: string\n\n @Field(type => Int, { description: 'Version of the KPI definition at the time this value is calculated.' })\n version: number\n\n @Field({ description: 'Date or period for which this KPI value is recorded (e.g., day, month, quarter).' })\n valueDate: string\n\n @Field(type => Float, { description: 'The calculated numeric value for this KPI and period.' })\n value: number\n\n @Field(type => Float, {\n nullable: true,\n description: 'Performance score calculated from KPI value using scoreFormula or grades lookup table. Range: 0-1.'\n })\n score?: number\n\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Extended or non-numeric information related to this KPI value, stored as JSON5. Can include grade, status, comments, or other metadata.'\n })\n meta?: any\n\n @Field(type => ID, { nullable: true, description: 'ID of the KPI organization scope for this value.' })\n kpiOrgScopeId?: string\n\n @Field({ nullable: true, description: 'Legacy organizational unit identifier (for backward compatibility)' })\n org?: string\n\n @Field(type => KpiValueInputType, {\n nullable: true,\n description: 'Indicates whether this value was entered manually or generated automatically.'\n })\n inputType?: KpiValueInputType\n\n @Field({ nullable: true, description: 'Source of the value (e.g., system, user, external integration).' })\n source?: string\n}\n\n@InputType({\n description: 'Input type for updating an existing KPI value. Used in mutations to patch KPI value details.'\n})\nexport class KpiValuePatch {\n @Field(type => ID, { nullable: true, description: 'ID of the KPI value to update.' })\n id?: string\n\n @Field(type => ID, { nullable: true, description: 'ID of the KPI to which this value belongs.' })\n kpiId?: string\n\n @Field(type => Int, {\n nullable: true,\n description: 'Version of the KPI definition at the time this value is calculated.'\n })\n version?: number\n\n @Field({\n nullable: true,\n description: 'Date or period for which this KPI value is recorded (e.g., day, month, quarter).'\n })\n valueDate?: string\n\n @Field(type => Float, { nullable: true, description: 'The calculated numeric value for this KPI and period.' })\n value?: number\n\n @Field(type => Float, {\n nullable: true,\n description: 'Performance score calculated from KPI value using scoreFormula or grades lookup table. Range: 0-1.'\n })\n score?: number\n\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Extended or non-numeric information related to this KPI value, stored as JSON5. Can include grade, status, comments, or other metadata.'\n })\n meta?: any\n\n @Field(type => ID, { nullable: true, description: 'ID of the KPI organization scope for this value.' })\n kpiOrgScopeId?: string\n\n @Field({ nullable: true, description: 'Legacy organizational unit identifier (for backward compatibility)' })\n org?: string\n\n @Field(type => KpiValueInputType, {\n nullable: true,\n description: 'Indicates whether this value was entered manually or generated automatically.'\n })\n inputType?: KpiValueInputType\n\n @Field({ nullable: true, description: 'Source of the value (e.g., system, user, external integration).' })\n source?: string\n\n @Field({ nullable: true, description: 'Custom flag for update operations (internal use).' })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class KpiValueList {\n @Field(type => [KpiValue])\n items: KpiValue[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { User } from '@things-factory/auth-base';
|
|
2
2
|
import { Domain } from '@things-factory/shell';
|
|
3
3
|
import { Kpi, KpiPeriodType } from '../kpi/kpi';
|
|
4
|
+
import { KpiOrgScope } from '../kpi-org-scope/kpi-org-scope';
|
|
4
5
|
export declare enum KpiValueInputType {
|
|
5
6
|
MANUAL = "MANUAL",
|
|
6
7
|
AUTO = "AUTO"
|
|
@@ -15,7 +16,8 @@ export declare class KpiValue {
|
|
|
15
16
|
valueDate: string;
|
|
16
17
|
value: number;
|
|
17
18
|
score?: number;
|
|
18
|
-
|
|
19
|
+
kpiOrgScope?: KpiOrgScope;
|
|
20
|
+
kpiOrgScopeId?: string;
|
|
19
21
|
inputType?: KpiValueInputType;
|
|
20
22
|
source?: string;
|
|
21
23
|
meta?: any;
|
|
@@ -8,6 +8,7 @@ const auth_base_1 = require("@things-factory/auth-base");
|
|
|
8
8
|
const shell_1 = require("@things-factory/shell");
|
|
9
9
|
const env_1 = require("@things-factory/env");
|
|
10
10
|
const kpi_1 = require("../kpi/kpi");
|
|
11
|
+
const kpi_org_scope_1 = require("../kpi-org-scope/kpi-org-scope");
|
|
11
12
|
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
12
13
|
const DATABASE_TYPE = ORMCONFIG.type;
|
|
13
14
|
var KpiValueInputType;
|
|
@@ -76,10 +77,15 @@ tslib_1.__decorate([
|
|
|
76
77
|
tslib_1.__metadata("design:type", Number)
|
|
77
78
|
], KpiValue.prototype, "score", void 0);
|
|
78
79
|
tslib_1.__decorate([
|
|
79
|
-
(0, typeorm_1.
|
|
80
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
80
|
+
(0, typeorm_1.ManyToOne)(() => kpi_org_scope_1.KpiOrgScope, { nullable: true }),
|
|
81
|
+
(0, type_graphql_1.Field)(type => kpi_org_scope_1.KpiOrgScope, { nullable: true, description: 'Reference to the organization scope mapping for this KPI value.' }),
|
|
82
|
+
tslib_1.__metadata("design:type", kpi_org_scope_1.KpiOrgScope)
|
|
83
|
+
], KpiValue.prototype, "kpiOrgScope", void 0);
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, typeorm_1.RelationId)((kpiValue) => kpiValue.kpiOrgScope),
|
|
86
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the referenced KPI organization scope.' }),
|
|
81
87
|
tslib_1.__metadata("design:type", String)
|
|
82
|
-
], KpiValue.prototype, "
|
|
88
|
+
], KpiValue.prototype, "kpiOrgScopeId", void 0);
|
|
83
89
|
tslib_1.__decorate([
|
|
84
90
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
85
91
|
(0, type_graphql_1.Field)({
|
|
@@ -149,8 +155,8 @@ tslib_1.__decorate([
|
|
|
149
155
|
], KpiValue.prototype, "updaterId", void 0);
|
|
150
156
|
exports.KpiValue = KpiValue = tslib_1.__decorate([
|
|
151
157
|
(0, typeorm_1.Entity)(),
|
|
152
|
-
(0, typeorm_1.Index)('ix_kpi_value_latest', ['domain', 'kpi', 'valueDate', '
|
|
153
|
-
(0, typeorm_1.Index)('ix_kpi_value_latest_for_query', ['domain', 'kpi', 'valueDate', '
|
|
158
|
+
(0, typeorm_1.Index)('ix_kpi_value_latest', ['domain', 'kpi', 'valueDate', 'kpiOrgScope', 'version'], { unique: true }),
|
|
159
|
+
(0, typeorm_1.Index)('ix_kpi_value_latest_for_query', ['domain', 'kpi', 'valueDate', 'kpiOrgScope'], { unique: false }),
|
|
154
160
|
(0, type_graphql_1.ObjectType)({ description: 'Entity for KpiValue' })
|
|
155
161
|
], KpiValue);
|
|
156
162
|
//# sourceMappingURL=kpi-value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-value.js","sourceRoot":"","sources":["../../../server/service/kpi-value/kpi-value.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAAkF;AAElF,yDAAgD;AAChD,iDAA8E;AAC9E,6CAA4C;AAC5C,oCAA+C;
|
|
1
|
+
{"version":3,"file":"kpi-value.js","sourceRoot":"","sources":["../../../server/service/kpi-value/kpi-value.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAAkF;AAElF,yDAAgD;AAChD,iDAA8E;AAC9E,6CAA4C;AAC5C,oCAA+C;AAC/C,kEAA4D;AAE5D,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,kCAAa,CAAA;AACf,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAA,+BAAgB,EAAC,iBAAiB,EAAE;IAClC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,oCAAoC;CAClD,CAAC,CAAA;AAMK,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAgHpB,CAAA;AAhHY,4BAAQ;AAGV;IAF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AAC;;2CAC1E;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;sCAC3F,gBAAI;yCAAA;AAId;IAFC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;IACpD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;;2CAC/E;mBA/GP,QAAQ;IAJpB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,qBAAqB,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACxG,IAAA,eAAK,EAAC,+BAA+B,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACxG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CAgHpB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType, Float } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, ScalarObject, json5Transformer } from '@things-factory/shell'\nimport { config } from '@things-factory/env'\nimport { Kpi, KpiPeriodType } from '../kpi/kpi'\nimport { KpiOrgScope } from '../kpi-org-scope/kpi-org-scope'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\nexport enum KpiValueInputType {\n MANUAL = 'MANUAL',\n AUTO = 'AUTO'\n}\n\nregisterEnumType(KpiValueInputType, {\n name: 'KpiValueInputType',\n description: 'Type of the input (Manual or Auto)'\n})\n\n@Entity()\n@Index('ix_kpi_value_latest', ['domain', 'kpi', 'valueDate', 'kpiOrgScope', 'version'], { unique: true })\n@Index('ix_kpi_value_latest_for_query', ['domain', 'kpi', 'valueDate', 'kpiOrgScope'], { unique: false })\n@ObjectType({ description: 'Entity for KpiValue' })\nexport class KpiValue {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for this KPI value record.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true, description: 'Domain (tenant) to which this KPI value belongs.' })\n domain?: Domain\n\n @RelationId((kpiValue: KpiValue) => kpiValue.domain)\n @Field({ nullable: true, description: 'ID of the domain (tenant) for this KPI value.' })\n domainId?: string\n\n @ManyToOne(() => Kpi)\n @Field(type => Kpi, {\n nullable: true,\n description: 'Reference to the KPI definition for which this value is calculated.'\n })\n kpi: Kpi\n\n @RelationId((kpiValue: KpiValue) => kpiValue.kpi)\n @Field({ description: 'ID of the referenced KPI.' })\n kpiId: string\n\n @Column('int')\n @Field(type => Int, { description: 'Version of the KPI definition at the time this value was calculated.' })\n version: number\n\n @Column()\n @Field({\n description:\n 'Date or period for which this KPI value is recorded (e.g., day: YYYY-MM-DD, month: YYYY-MM, quarter: YYYY-Qn, range: YYYY-MM-DD~YYYY-MM-DD).'\n })\n valueDate: string\n\n @Column('float')\n @Field(type => Float, { description: 'The calculated numeric value for this KPI and period.' })\n value: number\n\n @Column('float', { nullable: true })\n @Field(type => Float, {\n nullable: true,\n description: 'Performance score calculated from KPI value using scoreFormula or grades lookup table. Range: 0-1.'\n })\n score?: number\n\n @ManyToOne(() => KpiOrgScope, { nullable: true })\n @Field(type => KpiOrgScope, { nullable: true, description: 'Reference to the organization scope mapping for this KPI value.' })\n kpiOrgScope?: KpiOrgScope\n\n @RelationId((kpiValue: KpiValue) => kpiValue.kpiOrgScope)\n @Field({ nullable: true, description: 'ID of the referenced KPI organization scope.' })\n kpiOrgScopeId?: string\n\n @Column({ nullable: true })\n @Field({\n nullable: true,\n description: 'Indicates whether this value was entered manually or generated automatically.'\n })\n inputType?: KpiValueInputType\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Source of the value (e.g., system, user, external integration).' })\n source?: string\n\n @Column({\n nullable: true,\n type:\n DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'longtext'\n : DATABASE_TYPE == 'oracle'\n ? 'clob'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined,\n transformer: json5Transformer\n })\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Extended or non-numeric information related to this KPI value, stored as JSON5. Can include grade, status, comments, or other metadata.'\n })\n meta?: any\n\n @Column({ default: 'DAY' })\n @Field(type => KpiPeriodType, { description: 'Aggregation period type for this KPI value.' })\n periodType: KpiPeriodType\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI value record was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI value record was last updated.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who created this KPI value record.' })\n creator?: User\n\n @RelationId((kpiValue: KpiValue) => kpiValue.creator)\n @Field({ nullable: true, description: 'ID of the user who created this KPI value record.' })\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who last updated this KPI value record.' })\n updater?: User\n\n @RelationId((kpiValue: KpiValue) => kpiValue.updater)\n @Field({ nullable: true, description: 'ID of the user who last updated this KPI value record.' })\n updaterId?: string\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { KpiPeriodType } from '../kpi/kpi';
|
|
2
2
|
export declare function getISOWeek(date: Date): number;
|
|
3
|
+
export declare function normalizePeriodDate(valueDate: string, periodType: KpiPeriodType): Date;
|
|
3
4
|
export declare function getDefaultValueDate(periodType: KpiPeriodType, mode?: 'current' | 'last'): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getISOWeek = getISOWeek;
|
|
4
|
+
exports.normalizePeriodDate = normalizePeriodDate;
|
|
4
5
|
exports.getDefaultValueDate = getDefaultValueDate;
|
|
5
6
|
const kpi_1 = require("../kpi/kpi");
|
|
6
7
|
function getISOWeek(date) {
|
|
@@ -11,6 +12,46 @@ function getISOWeek(date) {
|
|
|
11
12
|
const weekNo = Math.ceil(((tmp.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);
|
|
12
13
|
return weekNo;
|
|
13
14
|
}
|
|
15
|
+
function getMonday(year, week) {
|
|
16
|
+
const simple = new Date(year, 0, 1 + (week - 1) * 7);
|
|
17
|
+
const dow = simple.getDay();
|
|
18
|
+
const ISOweekStart = simple;
|
|
19
|
+
if (dow <= 4)
|
|
20
|
+
ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1);
|
|
21
|
+
else
|
|
22
|
+
ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay());
|
|
23
|
+
return ISOweekStart;
|
|
24
|
+
}
|
|
25
|
+
function normalizePeriodDate(valueDate, periodType) {
|
|
26
|
+
switch (periodType) {
|
|
27
|
+
case kpi_1.KpiPeriodType.DAY:
|
|
28
|
+
return new Date(valueDate + 'T00:00:00.000Z');
|
|
29
|
+
case kpi_1.KpiPeriodType.WEEK: {
|
|
30
|
+
// "2024-W03" → 해당 주의 월요일
|
|
31
|
+
const [year, week] = valueDate.split('-W');
|
|
32
|
+
return getMonday(parseInt(year), parseInt(week));
|
|
33
|
+
}
|
|
34
|
+
case kpi_1.KpiPeriodType.MONTH:
|
|
35
|
+
return new Date(valueDate + '-01T00:00:00.000Z');
|
|
36
|
+
case kpi_1.KpiPeriodType.QUARTER: {
|
|
37
|
+
// "2024-Q1" → 해당 분기 시작일
|
|
38
|
+
const [year, quarter] = valueDate.split('-Q');
|
|
39
|
+
const month = (parseInt(quarter) - 1) * 3 + 1;
|
|
40
|
+
return new Date(`${year}-${month.toString().padStart(2, '0')}-01T00:00:00.000Z`);
|
|
41
|
+
}
|
|
42
|
+
case kpi_1.KpiPeriodType.YEAR:
|
|
43
|
+
return new Date(valueDate + '-01-01T00:00:00.000Z');
|
|
44
|
+
case kpi_1.KpiPeriodType.RANGE: {
|
|
45
|
+
// "2024-01-01~2024-01-31" → 시작일 사용
|
|
46
|
+
const startDate = valueDate.split('~')[0];
|
|
47
|
+
return new Date(startDate + 'T00:00:00.000Z');
|
|
48
|
+
}
|
|
49
|
+
case kpi_1.KpiPeriodType.ALLTIME:
|
|
50
|
+
return new Date('1900-01-01T00:00:00.000Z'); // 고정 기준점
|
|
51
|
+
default:
|
|
52
|
+
return new Date(valueDate + 'T00:00:00.000Z');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
14
55
|
function getDefaultValueDate(periodType, mode = 'current') {
|
|
15
56
|
const now = new Date();
|
|
16
57
|
if (mode === 'last') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-date-util.js","sourceRoot":"","sources":["../../../server/service/utils/value-date-util.ts"],"names":[],"mappings":";;AAEA,gCAOC;AAED,kDA4DC;
|
|
1
|
+
{"version":3,"file":"value-date-util.js","sourceRoot":"","sources":["../../../server/service/utils/value-date-util.ts"],"names":[],"mappings":";;AAEA,gCAOC;AAWD,kDAoCC;AAED,kDA4DC;AAtHD,oCAA0C;AAE1C,SAAgB,UAAU,CAAC,IAAU;IACnC,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;IACpC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC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B,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;gBAC9B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;gBAC5B,OAAO,GAAG,IAAI,KAAK,IAAI,EAAE,CAAA;YAC3B,CAAC;YACD,KAAK,mBAAa,CAAC,OAAO;gBACxB,OAAO,SAAS,CAAA;YAClB;gBACE,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { KpiPeriodType } from '../kpi/kpi'\n\nexport function getISOWeek(date: Date): number {\n const tmp = new Date(date.getTime())\n tmp.setHours(0, 0, 0, 0)\n tmp.setDate(tmp.getDate() + 4 - (tmp.getDay() || 7))\n const yearStart = new Date(tmp.getFullYear(), 0, 1)\n const weekNo = Math.ceil(((tmp.getTime() - yearStart.getTime()) / 86400000 + 1) / 7)\n return weekNo\n}\n\nfunction getMonday(year: number, week: number): Date {\n const simple = new Date(year, 0, 1 + (week - 1) * 7)\n const dow = simple.getDay()\n const ISOweekStart = simple\n if (dow <= 4) ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1)\n else ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay())\n return ISOweekStart\n}\n\nexport function normalizePeriodDate(valueDate: string, periodType: KpiPeriodType): Date {\n switch (periodType) {\n case KpiPeriodType.DAY:\n return new Date(valueDate + 'T00:00:00.000Z')\n \n case KpiPeriodType.WEEK: {\n // \"2024-W03\" → 해당 주의 월요일\n const [year, week] = valueDate.split('-W')\n return getMonday(parseInt(year), parseInt(week))\n }\n \n case KpiPeriodType.MONTH:\n return new Date(valueDate + '-01T00:00:00.000Z')\n \n case KpiPeriodType.QUARTER: {\n // \"2024-Q1\" → 해당 분기 시작일\n const [year, quarter] = valueDate.split('-Q')\n const month = (parseInt(quarter) - 1) * 3 + 1\n return new Date(`${year}-${month.toString().padStart(2, '0')}-01T00:00:00.000Z`)\n }\n \n case KpiPeriodType.YEAR:\n return new Date(valueDate + '-01-01T00:00:00.000Z')\n \n case KpiPeriodType.RANGE: {\n // \"2024-01-01~2024-01-31\" → 시작일 사용\n const startDate = valueDate.split('~')[0]\n return new Date(startDate + 'T00:00:00.000Z')\n }\n \n case KpiPeriodType.ALLTIME:\n return new Date('1900-01-01T00:00:00.000Z') // 고정 기준점\n \n default:\n return new Date(valueDate + 'T00:00:00.000Z')\n }\n}\n\nexport function getDefaultValueDate(periodType: KpiPeriodType, mode: 'current' | 'last' = 'current'): string {\n const now = new Date()\n if (mode === 'last') {\n switch (periodType) {\n case KpiPeriodType.DAY: {\n const d = new Date(now)\n d.setDate(d.getDate() - 1)\n return d.toISOString().slice(0, 10)\n }\n case KpiPeriodType.MONTH: {\n const d = new Date(now)\n d.setMonth(d.getMonth() - 1)\n return d.toISOString().slice(0, 7)\n }\n case KpiPeriodType.QUARTER: {\n let year = now.getFullYear()\n let quarter = Math.floor(now.getMonth() / 3)\n if (quarter === 0) {\n year -= 1\n quarter = 4\n }\n return `${year}-Q${quarter}`\n }\n case KpiPeriodType.WEEK: {\n const d = new Date(now)\n d.setDate(d.getDate() - 7)\n const year = d.getFullYear()\n const week = getISOWeek(d)\n return `${year}-W${week}`\n }\n case KpiPeriodType.ALLTIME:\n return 'ALLTIME'\n default: {\n const d = new Date(now)\n d.setDate(d.getDate() - 1)\n return d.toISOString().slice(0, 10)\n }\n }\n } else {\n switch (periodType) {\n case KpiPeriodType.DAY:\n return now.toISOString().slice(0, 10)\n case KpiPeriodType.MONTH:\n return now.toISOString().slice(0, 7)\n case KpiPeriodType.QUARTER: {\n const year = now.getFullYear()\n const quarter = Math.floor(now.getMonth() / 3) + 1\n return `${year}-Q${quarter}`\n }\n case KpiPeriodType.WEEK: {\n const year = now.getFullYear()\n const week = getISOWeek(now)\n return `${year}-W${week}`\n }\n case KpiPeriodType.ALLTIME:\n return 'ALLTIME'\n default:\n return now.toISOString().slice(0, 10)\n }\n }\n}\n"]}
|