@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.
- package/package.json +6 -6
- package/dist-client/bootstrap.d.ts +0 -2
- package/dist-client/bootstrap.js +0 -7
- package/dist-client/bootstrap.js.map +0 -1
- package/dist-client/charts/kpi-boxplot-chart.d.ts +0 -24
- package/dist-client/charts/kpi-boxplot-chart.js +0 -324
- package/dist-client/charts/kpi-boxplot-chart.js.map +0 -1
- package/dist-client/charts/kpi-mini-trend-chart.d.ts +0 -14
- package/dist-client/charts/kpi-mini-trend-chart.js +0 -148
- package/dist-client/charts/kpi-mini-trend-chart.js.map +0 -1
- package/dist-client/charts/kpi-radar-chart.d.ts +0 -16
- package/dist-client/charts/kpi-radar-chart.js +0 -138
- package/dist-client/charts/kpi-radar-chart.js.map +0 -1
- package/dist-client/charts/kpi-trend-chart.d.ts +0 -25
- package/dist-client/charts/kpi-trend-chart.js +0 -186
- package/dist-client/charts/kpi-trend-chart.js.map +0 -1
- package/dist-client/google-map/common-google-map.d.ts +0 -34
- package/dist-client/google-map/common-google-map.js +0 -333
- package/dist-client/google-map/common-google-map.js.map +0 -1
- package/dist-client/google-map/google-map-loader.d.ts +0 -8
- package/dist-client/google-map/google-map-loader.js +0 -22
- package/dist-client/google-map/google-map-loader.js.map +0 -1
- package/dist-client/index.d.ts +0 -1
- package/dist-client/index.js +0 -2
- package/dist-client/index.js.map +0 -1
- package/dist-client/pages/kpi/kpi-grade-editor.d.ts +0 -35
- package/dist-client/pages/kpi/kpi-grade-editor.js +0 -165
- package/dist-client/pages/kpi/kpi-grade-editor.js.map +0 -1
- package/dist-client/pages/kpi/kpi-importer.d.ts +0 -23
- package/dist-client/pages/kpi/kpi-importer.js +0 -92
- package/dist-client/pages/kpi/kpi-importer.js.map +0 -1
- package/dist-client/pages/kpi/kpi-list-page.d.ts +0 -136
- package/dist-client/pages/kpi/kpi-list-page.js +0 -948
- package/dist-client/pages/kpi/kpi-list-page.js.map +0 -1
- package/dist-client/pages/kpi/kpi-overview-sample.d.ts +0 -36
- package/dist-client/pages/kpi/kpi-overview-sample.js +0 -264
- package/dist-client/pages/kpi/kpi-overview-sample.js.map +0 -1
- package/dist-client/pages/kpi/kpi-overview.d.ts +0 -14
- package/dist-client/pages/kpi/kpi-overview.js +0 -361
- package/dist-client/pages/kpi/kpi-overview.js.map +0 -1
- package/dist-client/pages/kpi/kpi-tree-page.d.ts +0 -51
- package/dist-client/pages/kpi/kpi-tree-page.js +0 -355
- package/dist-client/pages/kpi/kpi-tree-page.js.map +0 -1
- package/dist-client/pages/kpi/kpi-view.d.ts +0 -12
- package/dist-client/pages/kpi/kpi-view.js +0 -193
- package/dist-client/pages/kpi/kpi-view.js.map +0 -1
- package/dist-client/pages/kpi/kpi-viz-editor.d.ts +0 -19
- package/dist-client/pages/kpi/kpi-viz-editor.js +0 -562
- package/dist-client/pages/kpi/kpi-viz-editor.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.d.ts +0 -17
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js +0 -279
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.d.ts +0 -19
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js +0 -385
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.d.ts +0 -23
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js +0 -465
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.d.ts +0 -8
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js +0 -78
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.d.ts +0 -24
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js +0 -440
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.d.ts +0 -33
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js +0 -444
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.d.ts +0 -23
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js +0 -369
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.d.ts +0 -18
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js +0 -128
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.d.ts +0 -31
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js +0 -493
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.d.ts +0 -50
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +0 -884
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.d.ts +0 -12
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js +0 -82
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.d.ts +0 -11
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js +0 -65
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.d.ts +0 -13
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.js +0 -115
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.d.ts +0 -15
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js +0 -146
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js.map +0 -1
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.d.ts +0 -7
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.js +0 -86
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.js.map +0 -1
- package/dist-client/pages/kpi-history/kpi-history-list-page.d.ts +0 -21
- package/dist-client/pages/kpi-history/kpi-history-list-page.js +0 -160
- package/dist-client/pages/kpi-history/kpi-history-list-page.js.map +0 -1
- package/dist-client/pages/kpi-metric/kpi-metric-importer.d.ts +0 -23
- package/dist-client/pages/kpi-metric/kpi-metric-importer.js +0 -92
- package/dist-client/pages/kpi-metric/kpi-metric-importer.js.map +0 -1
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.d.ts +0 -65
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +0 -415
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +0 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +0 -52
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +0 -678
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +0 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.d.ts +0 -23
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js +0 -75
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js.map +0 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +0 -64
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +0 -311
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +0 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.d.ts +0 -12
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js +0 -175
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js.map +0 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.d.ts +0 -35
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js +0 -161
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js.map +0 -1
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.d.ts +0 -47
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js +0 -655
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js.map +0 -1
- package/dist-client/pages/kpi-statistic/kpi-statistic-importer.d.ts +0 -23
- package/dist-client/pages/kpi-statistic/kpi-statistic-importer.js +0 -92
- package/dist-client/pages/kpi-statistic/kpi-statistic-importer.js.map +0 -1
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.d.ts +0 -65
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js +0 -416
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js.map +0 -1
- package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +0 -50
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js +0 -700
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +0 -1
- package/dist-client/pages/kpi-value/kpi-value-importer.d.ts +0 -23
- package/dist-client/pages/kpi-value/kpi-value-importer.js +0 -92
- package/dist-client/pages/kpi-value/kpi-value-importer.js.map +0 -1
- package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +0 -73
- package/dist-client/pages/kpi-value/kpi-value-list-page.js +0 -403
- package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +0 -1
- package/dist-client/route.d.ts +0 -1
- package/dist-client/route.js +0 -47
- package/dist-client/route.js.map +0 -1
- package/dist-client/tsconfig.tsbuildinfo +0 -1
- package/dist-client/viewparts/kpi-metric-input.d.ts +0 -23
- package/dist-client/viewparts/kpi-metric-input.js +0 -140
- package/dist-client/viewparts/kpi-metric-input.js.map +0 -1
- package/dist-client/viewparts/kpi-metric-meta-editor.d.ts +0 -36
- package/dist-client/viewparts/kpi-metric-meta-editor.js +0 -321
- package/dist-client/viewparts/kpi-metric-meta-editor.js.map +0 -1
- package/dist-client/viewparts/metric-input-hint.d.ts +0 -26
- package/dist-client/viewparts/metric-input-hint.js +0 -19
- package/dist-client/viewparts/metric-input-hint.js.map +0 -1
- package/dist-client/viewparts/metric-input.test.d.ts +0 -1
- package/dist-client/viewparts/metric-input.test.js +0 -43
- package/dist-client/viewparts/metric-input.test.js.map +0 -1
- package/dist-client/viewparts/metric-renderer-registry.d.ts +0 -18
- package/dist-client/viewparts/metric-renderer-registry.js +0 -29
- package/dist-client/viewparts/metric-renderer-registry.js.map +0 -1
- package/dist-client/viewparts/ox-grist-editor-metric-input-hint.d.ts +0 -19
- package/dist-client/viewparts/ox-grist-editor-metric-input-hint.js +0 -76
- package/dist-client/viewparts/ox-grist-editor-metric-input-hint.js.map +0 -1
- package/dist-server/calculator/calculator.test.d.ts +0 -1
- package/dist-server/calculator/calculator.test.js +0 -126
- package/dist-server/calculator/calculator.test.js.map +0 -1
- package/dist-server/calculator/evaluator.d.ts +0 -8
- package/dist-server/calculator/evaluator.js +0 -42
- package/dist-server/calculator/evaluator.js.map +0 -1
- package/dist-server/calculator/functions.d.ts +0 -3
- package/dist-server/calculator/functions.js +0 -62
- package/dist-server/calculator/functions.js.map +0 -1
- package/dist-server/calculator/index.d.ts +0 -6
- package/dist-server/calculator/index.js +0 -10
- package/dist-server/calculator/index.js.map +0 -1
- package/dist-server/calculator/parser.d.ts +0 -34
- package/dist-server/calculator/parser.js +0 -185
- package/dist-server/calculator/parser.js.map +0 -1
- package/dist-server/calculator/provider.d.ts +0 -8
- package/dist-server/calculator/provider.js +0 -13
- package/dist-server/calculator/provider.js.map +0 -1
- package/dist-server/calculator/score.d.ts +0 -21
- package/dist-server/calculator/score.js +0 -36
- package/dist-server/calculator/score.js.map +0 -1
- package/dist-server/calculator/score.test.d.ts +0 -1
- package/dist-server/calculator/score.test.js +0 -47
- package/dist-server/calculator/score.test.js.map +0 -1
- package/dist-server/calculator/validate.d.ts +0 -15
- package/dist-server/calculator/validate.js +0 -30
- package/dist-server/calculator/validate.js.map +0 -1
- package/dist-server/calculator/validate.test.d.ts +0 -1
- package/dist-server/calculator/validate.test.js +0 -45
- package/dist-server/calculator/validate.test.js.map +0 -1
- package/dist-server/controllers/index.d.ts +0 -2
- package/dist-server/controllers/index.js +0 -6
- package/dist-server/controllers/index.js.map +0 -1
- package/dist-server/controllers/kpi-metric-value-provider.d.ts +0 -11
- package/dist-server/controllers/kpi-metric-value-provider.js +0 -97
- package/dist-server/controllers/kpi-metric-value-provider.js.map +0 -1
- package/dist-server/controllers/kpi-value-provider.d.ts +0 -11
- package/dist-server/controllers/kpi-value-provider.js +0 -50
- package/dist-server/controllers/kpi-value-provider.js.map +0 -1
- package/dist-server/index.d.ts +0 -5
- package/dist-server/index.js +0 -9
- package/dist-server/index.js.map +0 -1
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.d.ts +0 -6
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.js +0 -102
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.js.map +0 -1
- package/dist-server/migrations/1752190849681-seed-kpi.d.ts +0 -5
- package/dist-server/migrations/1752190849681-seed-kpi.js +0 -315
- package/dist-server/migrations/1752190849681-seed-kpi.js.map +0 -1
- package/dist-server/migrations/1752192090123-add-grades-to-kpi.d.ts +0 -7
- package/dist-server/migrations/1752192090123-add-grades-to-kpi.js +0 -51
- package/dist-server/migrations/1752192090123-add-grades-to-kpi.js.map +0 -1
- package/dist-server/migrations/1752192090124-add-kpi-statistics.d.ts +0 -5
- package/dist-server/migrations/1752192090124-add-kpi-statistics.js +0 -710
- package/dist-server/migrations/1752192090124-add-kpi-statistics.js.map +0 -1
- package/dist-server/migrations/1752192090128-seed-kpi-org-scope.d.ts +0 -6
- package/dist-server/migrations/1752192090128-seed-kpi-org-scope.js +0 -111
- package/dist-server/migrations/1752192090128-seed-kpi-org-scope.js.map +0 -1
- package/dist-server/migrations/1752192090129-seed-kpi-values.d.ts +0 -6
- package/dist-server/migrations/1752192090129-seed-kpi-values.js +0 -187
- package/dist-server/migrations/1752192090129-seed-kpi-values.js.map +0 -1
- package/dist-server/migrations/1752192090200-add-meta-to-kpi-metric.d.ts +0 -10
- package/dist-server/migrations/1752192090200-add-meta-to-kpi-metric.js +0 -26
- package/dist-server/migrations/1752192090200-add-meta-to-kpi-metric.js.map +0 -1
- package/dist-server/migrations/1752192090201-backfill-kpi-metric-meta.d.ts +0 -11
- package/dist-server/migrations/1752192090201-backfill-kpi-metric-meta.js +0 -54
- package/dist-server/migrations/1752192090201-backfill-kpi-metric-meta.js.map +0 -1
- package/dist-server/migrations/grade-data/x11-performance-table.json +0 -962
- package/dist-server/migrations/grade-data/x12-performance-table.json +0 -611
- package/dist-server/migrations/grade-data/x14-performance-table.json +0 -42
- package/dist-server/migrations/grade-data/x21-performance-table.json +0 -889
- package/dist-server/migrations/grade-data/x22-performance-table.json +0 -1064
- package/dist-server/migrations/grade-data/x23-performance-table.json +0 -42
- package/dist-server/migrations/grade-data/x31-performance-table.json +0 -644
- package/dist-server/migrations/grade-data/x32-performance-table.json +0 -993
- package/dist-server/migrations/grade-data/x33-performance-table.json +0 -195
- package/dist-server/migrations/grade-data/x34-performance-table.json +0 -12
- package/dist-server/migrations/grade-data/x35-performance-table.json +0 -42
- package/dist-server/migrations/grade-data/x41-performance-table.json +0 -825
- package/dist-server/migrations/grade-data/x42-performance-table.json +0 -786
- package/dist-server/migrations/grade-data/x43-performance-table.json +0 -12
- package/dist-server/migrations/grade-data/x44-performance-table.json +0 -42
- package/dist-server/migrations/grade-data/x51-performance-table.json +0 -924
- package/dist-server/migrations/grade-data/x52-performance-table.json +0 -42
- package/dist-server/migrations/grade-data/x61-performance-table.json +0 -261
- package/dist-server/migrations/grade-data/x62-performance-table.json +0 -42
- package/dist-server/migrations/index.d.ts +0 -1
- package/dist-server/migrations/index.js +0 -12
- package/dist-server/migrations/index.js.map +0 -1
- package/dist-server/migrations/seed-data/kpi-metrics-seed.json +0 -517
- package/dist-server/migrations/seed-data/kpi-org-scope-seed.json +0 -1676
- package/dist-server/migrations/seed-data/kpi-scopes-seed.json +0 -121
- package/dist-server/migrations/seed-data/kpi-values-seed.json +0 -402
- package/dist-server/migrations/seed-data/kpis-seed.json +0 -488
- package/dist-server/migrations/seed-data/scope-definitions-seed.json +0 -90
- package/dist-server/routes.d.ts +0 -1
- package/dist-server/routes.js +0 -72
- package/dist-server/routes.js.map +0 -1
- package/dist-server/service/index.d.ts +0 -15
- package/dist-server/service/index.js +0 -49
- package/dist-server/service/index.js.map +0 -1
- package/dist-server/service/kpi/aggregate-kpi.d.ts +0 -8
- package/dist-server/service/kpi/aggregate-kpi.js +0 -123
- package/dist-server/service/kpi/aggregate-kpi.js.map +0 -1
- package/dist-server/service/kpi/event-subscriber.d.ts +0 -9
- package/dist-server/service/kpi/event-subscriber.js +0 -31
- package/dist-server/service/kpi/event-subscriber.js.map +0 -1
- package/dist-server/service/kpi/index.d.ts +0 -8
- package/dist-server/service/kpi/index.js +0 -12
- package/dist-server/service/kpi/index.js.map +0 -1
- package/dist-server/service/kpi/kpi-formula.service.d.ts +0 -49
- package/dist-server/service/kpi/kpi-formula.service.js +0 -165
- package/dist-server/service/kpi/kpi-formula.service.js.map +0 -1
- package/dist-server/service/kpi/kpi-grade.types.d.ts +0 -22
- package/dist-server/service/kpi/kpi-grade.types.js +0 -3
- package/dist-server/service/kpi/kpi-grade.types.js.map +0 -1
- package/dist-server/service/kpi/kpi-history.d.ts +0 -29
- package/dist-server/service/kpi/kpi-history.js +0 -148
- package/dist-server/service/kpi/kpi-history.js.map +0 -1
- package/dist-server/service/kpi/kpi-mutation.d.ts +0 -14
- package/dist-server/service/kpi/kpi-mutation.js +0 -553
- package/dist-server/service/kpi/kpi-mutation.js.map +0 -1
- package/dist-server/service/kpi/kpi-query.d.ts +0 -24
- package/dist-server/service/kpi/kpi-query.js +0 -309
- package/dist-server/service/kpi/kpi-query.js.map +0 -1
- package/dist-server/service/kpi/kpi-type.d.ts +0 -48
- package/dist-server/service/kpi/kpi-type.js +0 -221
- package/dist-server/service/kpi/kpi-type.js.map +0 -1
- package/dist-server/service/kpi/kpi.d.ts +0 -130
- package/dist-server/service/kpi/kpi.js +0 -356
- package/dist-server/service/kpi/kpi.js.map +0 -1
- package/dist-server/service/kpi-alert/index.d.ts +0 -2
- package/dist-server/service/kpi-alert/index.js +0 -6
- package/dist-server/service/kpi-alert/index.js.map +0 -1
- package/dist-server/service/kpi-alert/kpi-alert-query.d.ts +0 -4
- package/dist-server/service/kpi-alert/kpi-alert-query.js +0 -72
- package/dist-server/service/kpi-alert/kpi-alert-query.js.map +0 -1
- package/dist-server/service/kpi-alert/kpi-alert-type.d.ts +0 -8
- package/dist-server/service/kpi-alert/kpi-alert-type.js +0 -33
- package/dist-server/service/kpi-alert/kpi-alert-type.js.map +0 -1
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.d.ts +0 -8
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js +0 -126
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js.map +0 -1
- package/dist-server/service/kpi-metric/index.d.ts +0 -6
- package/dist-server/service/kpi-metric/index.js +0 -10
- package/dist-server/service/kpi-metric/index.js.map +0 -1
- package/dist-server/service/kpi-metric/kpi-metric-meta.d.ts +0 -46
- package/dist-server/service/kpi-metric/kpi-metric-meta.js +0 -27
- package/dist-server/service/kpi-metric/kpi-metric-meta.js.map +0 -1
- package/dist-server/service/kpi-metric/kpi-metric-meta.test.d.ts +0 -1
- package/dist-server/service/kpi-metric/kpi-metric-meta.test.js +0 -43
- package/dist-server/service/kpi-metric/kpi-metric-meta.test.js.map +0 -1
- package/dist-server/service/kpi-metric/kpi-metric-mutation.d.ts +0 -10
- package/dist-server/service/kpi-metric/kpi-metric-mutation.js +0 -296
- package/dist-server/service/kpi-metric/kpi-metric-mutation.js.map +0 -1
- package/dist-server/service/kpi-metric/kpi-metric-query.d.ts +0 -14
- package/dist-server/service/kpi-metric/kpi-metric-query.js +0 -126
- package/dist-server/service/kpi-metric/kpi-metric-query.js.map +0 -1
- package/dist-server/service/kpi-metric/kpi-metric-type.d.ts +0 -45
- package/dist-server/service/kpi-metric/kpi-metric-type.js +0 -177
- package/dist-server/service/kpi-metric/kpi-metric-type.js.map +0 -1
- package/dist-server/service/kpi-metric/kpi-metric.d.ts +0 -39
- package/dist-server/service/kpi-metric/kpi-metric.js +0 -174
- package/dist-server/service/kpi-metric/kpi-metric.js.map +0 -1
- package/dist-server/service/kpi-metric-value/index.d.ts +0 -6
- package/dist-server/service/kpi-metric-value/index.js +0 -10
- package/dist-server/service/kpi-metric-value/index.js.map +0 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.d.ts +0 -11
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +0 -283
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +0 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-query.d.ts +0 -13
- package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js +0 -106
- package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js.map +0 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.d.ts +0 -26
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js +0 -112
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js.map +0 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value.d.ts +0 -23
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js +0 -107
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js.map +0 -1
- package/dist-server/service/kpi-org-scope/index.d.ts +0 -5
- package/dist-server/service/kpi-org-scope/index.js +0 -9
- package/dist-server/service/kpi-org-scope/index.js.map +0 -1
- package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.d.ts +0 -8
- package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.js +0 -170
- package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.js.map +0 -1
- package/dist-server/service/kpi-org-scope/kpi-org-scope-query.d.ts +0 -14
- package/dist-server/service/kpi-org-scope/kpi-org-scope-query.js +0 -152
- package/dist-server/service/kpi-org-scope/kpi-org-scope-query.js.map +0 -1
- package/dist-server/service/kpi-org-scope/kpi-org-scope-type.d.ts +0 -26
- package/dist-server/service/kpi-org-scope/kpi-org-scope-type.js +0 -101
- package/dist-server/service/kpi-org-scope/kpi-org-scope-type.js.map +0 -1
- package/dist-server/service/kpi-org-scope/kpi-org-scope.d.ts +0 -26
- package/dist-server/service/kpi-org-scope/kpi-org-scope.js +0 -135
- package/dist-server/service/kpi-org-scope/kpi-org-scope.js.map +0 -1
- package/dist-server/service/kpi-scope/index.d.ts +0 -9
- package/dist-server/service/kpi-scope/index.js +0 -14
- package/dist-server/service/kpi-scope/index.js.map +0 -1
- package/dist-server/service/kpi-scope/kpi-scope-mutation.d.ts +0 -9
- package/dist-server/service/kpi-scope/kpi-scope-mutation.js +0 -140
- package/dist-server/service/kpi-scope/kpi-scope-mutation.js.map +0 -1
- package/dist-server/service/kpi-scope/kpi-scope-query.d.ts +0 -11
- package/dist-server/service/kpi-scope/kpi-scope-query.js +0 -89
- package/dist-server/service/kpi-scope/kpi-scope-query.js.map +0 -1
- package/dist-server/service/kpi-scope/kpi-scope-type.d.ts +0 -35
- package/dist-server/service/kpi-scope/kpi-scope-type.js +0 -138
- package/dist-server/service/kpi-scope/kpi-scope-type.js.map +0 -1
- package/dist-server/service/kpi-scope/kpi-scope.d.ts +0 -38
- package/dist-server/service/kpi-scope/kpi-scope.js +0 -144
- package/dist-server/service/kpi-scope/kpi-scope.js.map +0 -1
- package/dist-server/service/kpi-statistic/index.d.ts +0 -6
- package/dist-server/service/kpi-statistic/index.js +0 -10
- package/dist-server/service/kpi-statistic/index.js.map +0 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.d.ts +0 -43
- package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.js +0 -181
- package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.js.map +0 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.d.ts +0 -50
- package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.js +0 -324
- package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.js.map +0 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.d.ts +0 -14
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js +0 -279
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js.map +0 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-query.d.ts +0 -17
- package/dist-server/service/kpi-statistic/kpi-statistic-query.js +0 -183
- package/dist-server/service/kpi-statistic/kpi-statistic-query.js.map +0 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-type.d.ts +0 -59
- package/dist-server/service/kpi-statistic/kpi-statistic-type.js +0 -200
- package/dist-server/service/kpi-statistic/kpi-statistic-type.js.map +0 -1
- package/dist-server/service/kpi-statistic/kpi-statistic.d.ts +0 -42
- package/dist-server/service/kpi-statistic/kpi-statistic.js +0 -210
- package/dist-server/service/kpi-statistic/kpi-statistic.js.map +0 -1
- package/dist-server/service/kpi-value/index.d.ts +0 -6
- package/dist-server/service/kpi-value/index.js +0 -10
- package/dist-server/service/kpi-value/index.js.map +0 -1
- package/dist-server/service/kpi-value/kpi-value-mutation.d.ts +0 -13
- package/dist-server/service/kpi-value/kpi-value-mutation.js +0 -447
- package/dist-server/service/kpi-value/kpi-value-mutation.js.map +0 -1
- package/dist-server/service/kpi-value/kpi-value-query.d.ts +0 -22
- package/dist-server/service/kpi-value/kpi-value-query.js +0 -149
- package/dist-server/service/kpi-value/kpi-value-query.js.map +0 -1
- package/dist-server/service/kpi-value/kpi-value-score.service.d.ts +0 -24
- package/dist-server/service/kpi-value/kpi-value-score.service.js +0 -61
- package/dist-server/service/kpi-value/kpi-value-score.service.js.map +0 -1
- package/dist-server/service/kpi-value/kpi-value-type.d.ts +0 -33
- package/dist-server/service/kpi-value/kpi-value-type.js +0 -156
- package/dist-server/service/kpi-value/kpi-value-type.js.map +0 -1
- package/dist-server/service/kpi-value/kpi-value.d.ts +0 -32
- package/dist-server/service/kpi-value/kpi-value.js +0 -175
- package/dist-server/service/kpi-value/kpi-value.js.map +0 -1
- package/dist-server/service/utils/value-date-util.d.ts +0 -4
- package/dist-server/service/utils/value-date-util.js +0 -117
- package/dist-server/service/utils/value-date-util.js.map +0 -1
- package/dist-server/tsconfig.tsbuildinfo +0 -1
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KpiValue = exports.KpiValueInputType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const type_graphql_1 = require("type-graphql");
|
|
7
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
-
const shell_1 = require("@things-factory/shell");
|
|
9
|
-
const env_1 = require("@things-factory/env");
|
|
10
|
-
const kpi_1 = require("../kpi/kpi");
|
|
11
|
-
const kpi_org_scope_1 = require("../kpi-org-scope/kpi-org-scope");
|
|
12
|
-
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
13
|
-
const DATABASE_TYPE = ORMCONFIG.type;
|
|
14
|
-
var KpiValueInputType;
|
|
15
|
-
(function (KpiValueInputType) {
|
|
16
|
-
KpiValueInputType["MANUAL"] = "MANUAL";
|
|
17
|
-
KpiValueInputType["AUTO"] = "AUTO";
|
|
18
|
-
})(KpiValueInputType || (exports.KpiValueInputType = KpiValueInputType = {}));
|
|
19
|
-
(0, type_graphql_1.registerEnumType)(KpiValueInputType, {
|
|
20
|
-
name: 'KpiValueInputType',
|
|
21
|
-
description: 'Type of the input (Manual or Auto)'
|
|
22
|
-
});
|
|
23
|
-
let KpiValue = class KpiValue {
|
|
24
|
-
};
|
|
25
|
-
exports.KpiValue = KpiValue;
|
|
26
|
-
tslib_1.__decorate([
|
|
27
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
28
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for this KPI value record.' }),
|
|
29
|
-
tslib_1.__metadata("design:type", String)
|
|
30
|
-
], KpiValue.prototype, "id", void 0);
|
|
31
|
-
tslib_1.__decorate([
|
|
32
|
-
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
33
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'Domain (tenant) to which this KPI value belongs.' }),
|
|
34
|
-
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
35
|
-
], KpiValue.prototype, "domain", void 0);
|
|
36
|
-
tslib_1.__decorate([
|
|
37
|
-
(0, typeorm_1.RelationId)((kpiValue) => kpiValue.domain),
|
|
38
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the domain (tenant) for this KPI value.' }),
|
|
39
|
-
tslib_1.__metadata("design:type", String)
|
|
40
|
-
], KpiValue.prototype, "domainId", void 0);
|
|
41
|
-
tslib_1.__decorate([
|
|
42
|
-
(0, typeorm_1.ManyToOne)(() => kpi_1.Kpi),
|
|
43
|
-
(0, type_graphql_1.Field)(type => kpi_1.Kpi, {
|
|
44
|
-
nullable: true,
|
|
45
|
-
description: 'Reference to the KPI definition for which this value is calculated.'
|
|
46
|
-
}),
|
|
47
|
-
tslib_1.__metadata("design:type", kpi_1.Kpi)
|
|
48
|
-
], KpiValue.prototype, "kpi", void 0);
|
|
49
|
-
tslib_1.__decorate([
|
|
50
|
-
(0, typeorm_1.RelationId)((kpiValue) => kpiValue.kpi),
|
|
51
|
-
(0, type_graphql_1.Field)({ description: 'ID of the referenced KPI.' }),
|
|
52
|
-
tslib_1.__metadata("design:type", String)
|
|
53
|
-
], KpiValue.prototype, "kpiId", void 0);
|
|
54
|
-
tslib_1.__decorate([
|
|
55
|
-
(0, typeorm_1.Column)('int'),
|
|
56
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Version of the KPI definition at the time this value was calculated.' }),
|
|
57
|
-
tslib_1.__metadata("design:type", Number)
|
|
58
|
-
], KpiValue.prototype, "version", void 0);
|
|
59
|
-
tslib_1.__decorate([
|
|
60
|
-
(0, typeorm_1.Column)(),
|
|
61
|
-
(0, type_graphql_1.Field)({
|
|
62
|
-
description: '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).'
|
|
63
|
-
}),
|
|
64
|
-
tslib_1.__metadata("design:type", String)
|
|
65
|
-
], KpiValue.prototype, "valueDate", void 0);
|
|
66
|
-
tslib_1.__decorate([
|
|
67
|
-
(0, typeorm_1.Column)('float'),
|
|
68
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: 'The calculated numeric value for this KPI and period.' }),
|
|
69
|
-
tslib_1.__metadata("design:type", Number)
|
|
70
|
-
], KpiValue.prototype, "value", void 0);
|
|
71
|
-
tslib_1.__decorate([
|
|
72
|
-
(0, typeorm_1.Column)('float', { nullable: true }),
|
|
73
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Float, {
|
|
74
|
-
nullable: true,
|
|
75
|
-
description: 'Performance score calculated from KPI value using scoreFormula or grades lookup table.'
|
|
76
|
-
}),
|
|
77
|
-
tslib_1.__metadata("design:type", Number)
|
|
78
|
-
], KpiValue.prototype, "score", void 0);
|
|
79
|
-
tslib_1.__decorate([
|
|
80
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
81
|
-
(0, type_graphql_1.Field)(type => String, {
|
|
82
|
-
nullable: true,
|
|
83
|
-
description: 'Group key for this value (organization, line, user, project, etc.)'
|
|
84
|
-
}),
|
|
85
|
-
tslib_1.__metadata("design:type", String)
|
|
86
|
-
], KpiValue.prototype, "group", void 0);
|
|
87
|
-
tslib_1.__decorate([
|
|
88
|
-
(0, typeorm_1.ManyToOne)(() => kpi_org_scope_1.KpiOrgScope, { nullable: true }),
|
|
89
|
-
(0, type_graphql_1.Field)(type => kpi_org_scope_1.KpiOrgScope, {
|
|
90
|
-
nullable: true,
|
|
91
|
-
description: 'Reference to the organization scope mapping for this KPI value.'
|
|
92
|
-
}),
|
|
93
|
-
tslib_1.__metadata("design:type", kpi_org_scope_1.KpiOrgScope)
|
|
94
|
-
], KpiValue.prototype, "kpiOrgScope", void 0);
|
|
95
|
-
tslib_1.__decorate([
|
|
96
|
-
(0, typeorm_1.RelationId)((kpiValue) => kpiValue.kpiOrgScope),
|
|
97
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the referenced KPI organization scope.' }),
|
|
98
|
-
tslib_1.__metadata("design:type", String)
|
|
99
|
-
], KpiValue.prototype, "kpiOrgScopeId", void 0);
|
|
100
|
-
tslib_1.__decorate([
|
|
101
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
102
|
-
(0, type_graphql_1.Field)({
|
|
103
|
-
nullable: true,
|
|
104
|
-
description: 'Indicates whether this value was entered manually or generated automatically.'
|
|
105
|
-
}),
|
|
106
|
-
tslib_1.__metadata("design:type", String)
|
|
107
|
-
], KpiValue.prototype, "inputType", void 0);
|
|
108
|
-
tslib_1.__decorate([
|
|
109
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
110
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'Source of the value (e.g., system, user, external integration).' }),
|
|
111
|
-
tslib_1.__metadata("design:type", String)
|
|
112
|
-
], KpiValue.prototype, "source", void 0);
|
|
113
|
-
tslib_1.__decorate([
|
|
114
|
-
(0, typeorm_1.Column)({
|
|
115
|
-
nullable: true,
|
|
116
|
-
type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
117
|
-
? 'longtext'
|
|
118
|
-
: DATABASE_TYPE == 'oracle'
|
|
119
|
-
? 'clob'
|
|
120
|
-
: DATABASE_TYPE == 'mssql'
|
|
121
|
-
? 'nvarchar'
|
|
122
|
-
: 'varchar',
|
|
123
|
-
length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined,
|
|
124
|
-
transformer: shell_1.json5Transformer
|
|
125
|
-
}),
|
|
126
|
-
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, {
|
|
127
|
-
nullable: true,
|
|
128
|
-
description: 'Extended or non-numeric information related to this KPI value, stored as JSON5. Can include grade, status, comments, or other metadata.'
|
|
129
|
-
}),
|
|
130
|
-
tslib_1.__metadata("design:type", Object)
|
|
131
|
-
], KpiValue.prototype, "meta", void 0);
|
|
132
|
-
tslib_1.__decorate([
|
|
133
|
-
(0, typeorm_1.Column)({ default: 'DAY' }),
|
|
134
|
-
(0, type_graphql_1.Field)(type => kpi_1.KpiPeriodType, { description: 'Aggregation period type for this KPI value.' }),
|
|
135
|
-
tslib_1.__metadata("design:type", String)
|
|
136
|
-
], KpiValue.prototype, "periodType", void 0);
|
|
137
|
-
tslib_1.__decorate([
|
|
138
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
139
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when this KPI value record was created.' }),
|
|
140
|
-
tslib_1.__metadata("design:type", Date)
|
|
141
|
-
], KpiValue.prototype, "createdAt", void 0);
|
|
142
|
-
tslib_1.__decorate([
|
|
143
|
-
(0, typeorm_1.UpdateDateColumn)(),
|
|
144
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when this KPI value record was last updated.' }),
|
|
145
|
-
tslib_1.__metadata("design:type", Date)
|
|
146
|
-
], KpiValue.prototype, "updatedAt", void 0);
|
|
147
|
-
tslib_1.__decorate([
|
|
148
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
149
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who created this KPI value record.' }),
|
|
150
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
151
|
-
], KpiValue.prototype, "creator", void 0);
|
|
152
|
-
tslib_1.__decorate([
|
|
153
|
-
(0, typeorm_1.RelationId)((kpiValue) => kpiValue.creator),
|
|
154
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the user who created this KPI value record.' }),
|
|
155
|
-
tslib_1.__metadata("design:type", String)
|
|
156
|
-
], KpiValue.prototype, "creatorId", void 0);
|
|
157
|
-
tslib_1.__decorate([
|
|
158
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
159
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who last updated this KPI value record.' }),
|
|
160
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
161
|
-
], KpiValue.prototype, "updater", void 0);
|
|
162
|
-
tslib_1.__decorate([
|
|
163
|
-
(0, typeorm_1.RelationId)((kpiValue) => kpiValue.updater),
|
|
164
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the user who last updated this KPI value record.' }),
|
|
165
|
-
tslib_1.__metadata("design:type", String)
|
|
166
|
-
], KpiValue.prototype, "updaterId", void 0);
|
|
167
|
-
exports.KpiValue = KpiValue = tslib_1.__decorate([
|
|
168
|
-
(0, typeorm_1.Entity)(),
|
|
169
|
-
(0, typeorm_1.Index)('ix_kpi_value_latest', ['domain', 'kpi', 'valueDate', 'kpiOrgScope', 'version'], { unique: true }),
|
|
170
|
-
(0, typeorm_1.Index)('ix_kpi_value_latest_for_query', ['domain', 'kpi', 'valueDate', 'kpiOrgScope'], { unique: false }),
|
|
171
|
-
(0, typeorm_1.Index)('ix_kpi_value_group_kpi', ['domain', 'group', 'kpi', 'valueDate'], { unique: false }),
|
|
172
|
-
(0, typeorm_1.Index)('ix_kpi_value_kpi_group', ['domain', 'kpi', 'group', 'valueDate'], { unique: false }),
|
|
173
|
-
(0, type_graphql_1.ObjectType)({ description: 'Entity for KpiValue' })
|
|
174
|
-
], KpiValue);
|
|
175
|
-
//# sour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AAC,OAAO,CAAC;IACpD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;;2CAC/E;mBAzHP,QAAQ;IANpB,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,eAAK,EAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3F,IAAA,eAAK,EAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3F,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CA0HpB","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@Index('ix_kpi_value_group_kpi', ['domain', 'group', 'kpi', 'valueDate'], { unique: false })\n@Index('ix_kpi_value_kpi_group', ['domain', 'kpi', 'group', 'valueDate'], { 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.'\n })\n score?: number\n\n @Column({ nullable: true })\n @Field(type => String, {\n nullable: true,\n description: 'Group key for this value (organization, line, user, project, etc.)'\n })\n group?: string\n\n @ManyToOne(() => KpiOrgScope, { nullable: true })\n @Field(type => KpiOrgScope, {\n nullable: true,\n description: 'Reference to the organization scope mapping for this KPI value.'\n })\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,4 +0,0 @@
|
|
|
1
|
-
import { KpiPeriodType } from '../kpi/kpi';
|
|
2
|
-
export declare function getISOWeek(date: Date): number;
|
|
3
|
-
export declare function normalizePeriodDate(valueDate: string, periodType: KpiPeriodType): Date;
|
|
4
|
-
export declare function getDefaultValueDate(periodType: KpiPeriodType, mode?: 'current' | 'last'): string;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getISOWeek = getISOWeek;
|
|
4
|
-
exports.normalizePeriodDate = normalizePeriodDate;
|
|
5
|
-
exports.getDefaultValueDate = getDefaultValueDate;
|
|
6
|
-
const kpi_1 = require("../kpi/kpi");
|
|
7
|
-
function getISOWeek(date) {
|
|
8
|
-
const tmp = new Date(date.getTime());
|
|
9
|
-
tmp.setHours(0, 0, 0, 0);
|
|
10
|
-
tmp.setDate(tmp.getDate() + 4 - (tmp.getDay() || 7));
|
|
11
|
-
const yearStart = new Date(tmp.getFullYear(), 0, 1);
|
|
12
|
-
const weekNo = Math.ceil(((tmp.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);
|
|
13
|
-
return weekNo;
|
|
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
|
-
}
|
|
55
|
-
function getDefaultValueDate(periodType, mode = 'current') {
|
|
56
|
-
const now = new Date();
|
|
57
|
-
if (mode === 'last') {
|
|
58
|
-
switch (periodType) {
|
|
59
|
-
case kpi_1.KpiPeriodType.DAY: {
|
|
60
|
-
const d = new Date(now);
|
|
61
|
-
d.setDate(d.getDate() - 1);
|
|
62
|
-
return d.toISOString().slice(0, 10);
|
|
63
|
-
}
|
|
64
|
-
case kpi_1.KpiPeriodType.MONTH: {
|
|
65
|
-
const d = new Date(now);
|
|
66
|
-
d.setMonth(d.getMonth() - 1);
|
|
67
|
-
return d.toISOString().slice(0, 7);
|
|
68
|
-
}
|
|
69
|
-
case kpi_1.KpiPeriodType.QUARTER: {
|
|
70
|
-
let year = now.getFullYear();
|
|
71
|
-
let quarter = Math.floor(now.getMonth() / 3);
|
|
72
|
-
if (quarter === 0) {
|
|
73
|
-
year -= 1;
|
|
74
|
-
quarter = 4;
|
|
75
|
-
}
|
|
76
|
-
return `${year}-Q${quarter}`;
|
|
77
|
-
}
|
|
78
|
-
case kpi_1.KpiPeriodType.WEEK: {
|
|
79
|
-
const d = new Date(now);
|
|
80
|
-
d.setDate(d.getDate() - 7);
|
|
81
|
-
const year = d.getFullYear();
|
|
82
|
-
const week = getISOWeek(d);
|
|
83
|
-
return `${year}-W${week}`;
|
|
84
|
-
}
|
|
85
|
-
case kpi_1.KpiPeriodType.ALLTIME:
|
|
86
|
-
return 'ALLTIME';
|
|
87
|
-
default: {
|
|
88
|
-
const d = new Date(now);
|
|
89
|
-
d.setDate(d.getDate() - 1);
|
|
90
|
-
return d.toISOString().slice(0, 10);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
switch (periodType) {
|
|
96
|
-
case kpi_1.KpiPeriodType.DAY:
|
|
97
|
-
return now.toISOString().slice(0, 10);
|
|
98
|
-
case kpi_1.KpiPeriodType.MONTH:
|
|
99
|
-
return now.toISOString().slice(0, 7);
|
|
100
|
-
case kpi_1.KpiPeriodType.QUARTER: {
|
|
101
|
-
const year = now.getFullYear();
|
|
102
|
-
const quarter = Math.floor(now.getMonth() / 3) + 1;
|
|
103
|
-
return `${year}-Q${quarter}`;
|
|
104
|
-
}
|
|
105
|
-
case kpi_1.KpiPeriodType.WEEK: {
|
|
106
|
-
const year = now.getFullYear();
|
|
107
|
-
const week = getISOWeek(now);
|
|
108
|
-
return `${year}-W${week}`;
|
|
109
|
-
}
|
|
110
|
-
case kpi_1.KpiPeriodType.ALLTIME:
|
|
111
|
-
return 'ALLTIME';
|
|
112
|
-
default:
|
|
113
|
-
return now.toISOString().slice(0, 10);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=value-date-util.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACxB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACpD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IACpF,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,IAAY;IAC3C,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IACpD,MAAM,GAAG,GAAG,MAAM,CAAC,MAA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gBACpB,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;YACvC,KAAK,mBAAa,CAAC,KAAK;gBACtB,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YACtC,KAAK,mBAAa,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC3B,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;gBAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;gBAClD,OAAO,GAAG,IAAI,KAAK,OAAO,EAAE,CAAA;YAC9B,CAAC;YACD,KAAK,mBAAa,CAAC,IAAI,CAAC,CAAC,CAAC;gBACxB,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"]}
|