@things-factory/kpi 10.1.248 → 10.1.249
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/dist-client/bootstrap.d.ts +2 -0
- package/dist-client/bootstrap.js +7 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/charts/kpi-boxplot-chart.d.ts +24 -0
- package/dist-client/charts/kpi-boxplot-chart.js +324 -0
- package/dist-client/charts/kpi-boxplot-chart.js.map +1 -0
- package/dist-client/charts/kpi-mini-trend-chart.d.ts +14 -0
- package/dist-client/charts/kpi-mini-trend-chart.js +148 -0
- package/dist-client/charts/kpi-mini-trend-chart.js.map +1 -0
- package/dist-client/charts/kpi-radar-chart.d.ts +16 -0
- package/dist-client/charts/kpi-radar-chart.js +138 -0
- package/dist-client/charts/kpi-radar-chart.js.map +1 -0
- package/dist-client/charts/kpi-trend-chart.d.ts +25 -0
- package/dist-client/charts/kpi-trend-chart.js +186 -0
- package/dist-client/charts/kpi-trend-chart.js.map +1 -0
- package/dist-client/google-map/common-google-map.d.ts +34 -0
- package/dist-client/google-map/common-google-map.js +333 -0
- package/dist-client/google-map/common-google-map.js.map +1 -0
- package/dist-client/google-map/google-map-loader.d.ts +8 -0
- package/dist-client/google-map/google-map-loader.js +22 -0
- package/dist-client/google-map/google-map-loader.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/kpi/kpi-grade-editor.d.ts +35 -0
- package/dist-client/pages/kpi/kpi-grade-editor.js +165 -0
- package/dist-client/pages/kpi/kpi-grade-editor.js.map +1 -0
- package/dist-client/pages/kpi/kpi-importer.d.ts +23 -0
- package/dist-client/pages/kpi/kpi-importer.js +92 -0
- package/dist-client/pages/kpi/kpi-importer.js.map +1 -0
- package/dist-client/pages/kpi/kpi-list-page.d.ts +136 -0
- package/dist-client/pages/kpi/kpi-list-page.js +948 -0
- package/dist-client/pages/kpi/kpi-list-page.js.map +1 -0
- package/dist-client/pages/kpi/kpi-overview-sample.d.ts +36 -0
- package/dist-client/pages/kpi/kpi-overview-sample.js +264 -0
- package/dist-client/pages/kpi/kpi-overview-sample.js.map +1 -0
- package/dist-client/pages/kpi/kpi-overview.d.ts +14 -0
- package/dist-client/pages/kpi/kpi-overview.js +361 -0
- package/dist-client/pages/kpi/kpi-overview.js.map +1 -0
- package/dist-client/pages/kpi/kpi-tree-page.d.ts +51 -0
- package/dist-client/pages/kpi/kpi-tree-page.js +355 -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 +193 -0
- package/dist-client/pages/kpi/kpi-view.js.map +1 -0
- package/dist-client/pages/kpi/kpi-viz-editor.d.ts +19 -0
- package/dist-client/pages/kpi/kpi-viz-editor.js +562 -0
- package/dist-client/pages/kpi/kpi-viz-editor.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.d.ts +17 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js +279 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.d.ts +19 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js +385 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.d.ts +23 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js +465 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.d.ts +8 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js +78 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.d.ts +24 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js +440 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.d.ts +33 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js +444 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.d.ts +23 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js +369 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.d.ts +18 -0
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js +128 -0
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.d.ts +31 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js +493 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.d.ts +50 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +884 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.d.ts +12 -0
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js +82 -0
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.d.ts +11 -0
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js +65 -0
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.d.ts +13 -0
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.js +115 -0
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.d.ts +15 -0
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js +146 -0
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.d.ts +7 -0
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.js +86 -0
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.js.map +1 -0
- package/dist-client/pages/kpi-history/kpi-history-list-page.d.ts +21 -0
- package/dist-client/pages/kpi-history/kpi-history-list-page.js +160 -0
- package/dist-client/pages/kpi-history/kpi-history-list-page.js.map +1 -0
- package/dist-client/pages/kpi-metric/kpi-metric-importer.d.ts +23 -0
- package/dist-client/pages/kpi-metric/kpi-metric-importer.js +92 -0
- package/dist-client/pages/kpi-metric/kpi-metric-importer.js.map +1 -0
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.d.ts +65 -0
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +415 -0
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +52 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +678 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +1 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.d.ts +23 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js +75 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js.map +1 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +64 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +311 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.d.ts +12 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js +175 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js.map +1 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.d.ts +35 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js +161 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js.map +1 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.d.ts +47 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js +655 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js.map +1 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-importer.d.ts +23 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-importer.js +92 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-importer.js.map +1 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.d.ts +65 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js +416 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js.map +1 -0
- package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +50 -0
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js +700 -0
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +1 -0
- package/dist-client/pages/kpi-value/kpi-value-importer.d.ts +23 -0
- package/dist-client/pages/kpi-value/kpi-value-importer.js +92 -0
- package/dist-client/pages/kpi-value/kpi-value-importer.js.map +1 -0
- package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +73 -0
- package/dist-client/pages/kpi-value/kpi-value-list-page.js +403 -0
- package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +47 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/viewparts/kpi-metric-input.d.ts +23 -0
- package/dist-client/viewparts/kpi-metric-input.js +140 -0
- package/dist-client/viewparts/kpi-metric-input.js.map +1 -0
- package/dist-client/viewparts/kpi-metric-meta-editor.d.ts +36 -0
- package/dist-client/viewparts/kpi-metric-meta-editor.js +321 -0
- package/dist-client/viewparts/kpi-metric-meta-editor.js.map +1 -0
- package/dist-client/viewparts/metric-input-hint.d.ts +26 -0
- package/dist-client/viewparts/metric-input-hint.js +19 -0
- package/dist-client/viewparts/metric-input-hint.js.map +1 -0
- package/dist-client/viewparts/metric-input.test.d.ts +1 -0
- package/dist-client/viewparts/metric-input.test.js +43 -0
- package/dist-client/viewparts/metric-input.test.js.map +1 -0
- package/dist-client/viewparts/metric-renderer-registry.d.ts +18 -0
- package/dist-client/viewparts/metric-renderer-registry.js +29 -0
- package/dist-client/viewparts/metric-renderer-registry.js.map +1 -0
- package/dist-client/viewparts/ox-grist-editor-metric-input-hint.d.ts +19 -0
- package/dist-client/viewparts/ox-grist-editor-metric-input-hint.js +76 -0
- package/dist-client/viewparts/ox-grist-editor-metric-input-hint.js.map +1 -0
- package/dist-server/calculator/calculator.test.d.ts +1 -0
- package/dist-server/calculator/calculator.test.js +126 -0
- package/dist-server/calculator/calculator.test.js.map +1 -0
- package/dist-server/calculator/evaluator.d.ts +8 -0
- package/dist-server/calculator/evaluator.js +42 -0
- package/dist-server/calculator/evaluator.js.map +1 -0
- package/dist-server/calculator/functions.d.ts +3 -0
- package/dist-server/calculator/functions.js +62 -0
- package/dist-server/calculator/functions.js.map +1 -0
- package/dist-server/calculator/index.d.ts +6 -0
- package/dist-server/calculator/index.js +10 -0
- package/dist-server/calculator/index.js.map +1 -0
- package/dist-server/calculator/parser.d.ts +34 -0
- package/dist-server/calculator/parser.js +185 -0
- package/dist-server/calculator/parser.js.map +1 -0
- package/dist-server/calculator/provider.d.ts +8 -0
- package/dist-server/calculator/provider.js +13 -0
- package/dist-server/calculator/provider.js.map +1 -0
- package/dist-server/calculator/score.d.ts +21 -0
- package/dist-server/calculator/score.js +36 -0
- package/dist-server/calculator/score.js.map +1 -0
- package/dist-server/calculator/score.test.d.ts +1 -0
- package/dist-server/calculator/score.test.js +47 -0
- package/dist-server/calculator/score.test.js.map +1 -0
- package/dist-server/calculator/validate.d.ts +15 -0
- package/dist-server/calculator/validate.js +30 -0
- package/dist-server/calculator/validate.js.map +1 -0
- package/dist-server/calculator/validate.test.d.ts +1 -0
- package/dist-server/calculator/validate.test.js +45 -0
- package/dist-server/calculator/validate.test.js.map +1 -0
- package/dist-server/controllers/index.d.ts +2 -0
- package/dist-server/controllers/index.js +6 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/controllers/kpi-metric-value-provider.d.ts +11 -0
- package/dist-server/controllers/kpi-metric-value-provider.js +97 -0
- package/dist-server/controllers/kpi-metric-value-provider.js.map +1 -0
- package/dist-server/controllers/kpi-value-provider.d.ts +11 -0
- package/dist-server/controllers/kpi-value-provider.js +50 -0
- package/dist-server/controllers/kpi-value-provider.js.map +1 -0
- package/dist-server/index.d.ts +5 -0
- package/dist-server/index.js +9 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.d.ts +6 -0
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.js +102 -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/1752192090200-add-meta-to-kpi-metric.d.ts +10 -0
- package/dist-server/migrations/1752192090200-add-meta-to-kpi-metric.js +26 -0
- package/dist-server/migrations/1752192090200-add-meta-to-kpi-metric.js.map +1 -0
- package/dist-server/migrations/1752192090201-backfill-kpi-metric-meta.d.ts +11 -0
- package/dist-server/migrations/1752192090201-backfill-kpi-metric-meta.js +54 -0
- package/dist-server/migrations/1752192090201-backfill-kpi-metric-meta.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/index.d.ts +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/migrations/seed-data/kpi-metrics-seed.json +517 -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/routes.d.ts +1 -0
- package/dist-server/routes.js +72 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/index.d.ts +15 -0
- package/dist-server/service/index.js +49 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/kpi/aggregate-kpi.d.ts +8 -0
- package/dist-server/service/kpi/aggregate-kpi.js +123 -0
- package/dist-server/service/kpi/aggregate-kpi.js.map +1 -0
- package/dist-server/service/kpi/event-subscriber.d.ts +9 -0
- package/dist-server/service/kpi/event-subscriber.js +31 -0
- package/dist-server/service/kpi/event-subscriber.js.map +1 -0
- package/dist-server/service/kpi/index.d.ts +8 -0
- package/dist-server/service/kpi/index.js +12 -0
- package/dist-server/service/kpi/index.js.map +1 -0
- package/dist-server/service/kpi/kpi-formula.service.d.ts +49 -0
- package/dist-server/service/kpi/kpi-formula.service.js +165 -0
- package/dist-server/service/kpi/kpi-formula.service.js.map +1 -0
- package/dist-server/service/kpi/kpi-grade.types.d.ts +22 -0
- package/dist-server/service/kpi/kpi-grade.types.js +3 -0
- package/dist-server/service/kpi/kpi-grade.types.js.map +1 -0
- package/dist-server/service/kpi/kpi-history.d.ts +29 -0
- package/dist-server/service/kpi/kpi-history.js +148 -0
- package/dist-server/service/kpi/kpi-history.js.map +1 -0
- package/dist-server/service/kpi/kpi-mutation.d.ts +14 -0
- package/dist-server/service/kpi/kpi-mutation.js +553 -0
- package/dist-server/service/kpi/kpi-mutation.js.map +1 -0
- package/dist-server/service/kpi/kpi-query.d.ts +24 -0
- package/dist-server/service/kpi/kpi-query.js +309 -0
- package/dist-server/service/kpi/kpi-query.js.map +1 -0
- package/dist-server/service/kpi/kpi-type.d.ts +48 -0
- package/dist-server/service/kpi/kpi-type.js +221 -0
- package/dist-server/service/kpi/kpi-type.js.map +1 -0
- package/dist-server/service/kpi/kpi.d.ts +130 -0
- package/dist-server/service/kpi/kpi.js +356 -0
- package/dist-server/service/kpi/kpi.js.map +1 -0
- package/dist-server/service/kpi-alert/index.d.ts +2 -0
- package/dist-server/service/kpi-alert/index.js +6 -0
- package/dist-server/service/kpi-alert/index.js.map +1 -0
- package/dist-server/service/kpi-alert/kpi-alert-query.d.ts +4 -0
- package/dist-server/service/kpi-alert/kpi-alert-query.js +72 -0
- package/dist-server/service/kpi-alert/kpi-alert-query.js.map +1 -0
- package/dist-server/service/kpi-alert/kpi-alert-type.d.ts +8 -0
- package/dist-server/service/kpi-alert/kpi-alert-type.js +33 -0
- package/dist-server/service/kpi-alert/kpi-alert-type.js.map +1 -0
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.d.ts +8 -0
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js +126 -0
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js.map +1 -0
- package/dist-server/service/kpi-metric/index.d.ts +6 -0
- package/dist-server/service/kpi-metric/index.js +10 -0
- package/dist-server/service/kpi-metric/index.js.map +1 -0
- package/dist-server/service/kpi-metric/kpi-metric-meta.d.ts +46 -0
- package/dist-server/service/kpi-metric/kpi-metric-meta.js +27 -0
- package/dist-server/service/kpi-metric/kpi-metric-meta.js.map +1 -0
- package/dist-server/service/kpi-metric/kpi-metric-meta.test.d.ts +1 -0
- package/dist-server/service/kpi-metric/kpi-metric-meta.test.js +43 -0
- package/dist-server/service/kpi-metric/kpi-metric-meta.test.js.map +1 -0
- package/dist-server/service/kpi-metric/kpi-metric-mutation.d.ts +10 -0
- package/dist-server/service/kpi-metric/kpi-metric-mutation.js +296 -0
- package/dist-server/service/kpi-metric/kpi-metric-mutation.js.map +1 -0
- package/dist-server/service/kpi-metric/kpi-metric-query.d.ts +14 -0
- package/dist-server/service/kpi-metric/kpi-metric-query.js +126 -0
- package/dist-server/service/kpi-metric/kpi-metric-query.js.map +1 -0
- package/dist-server/service/kpi-metric/kpi-metric-type.d.ts +45 -0
- package/dist-server/service/kpi-metric/kpi-metric-type.js +177 -0
- package/dist-server/service/kpi-metric/kpi-metric-type.js.map +1 -0
- package/dist-server/service/kpi-metric/kpi-metric.d.ts +39 -0
- package/dist-server/service/kpi-metric/kpi-metric.js +174 -0
- package/dist-server/service/kpi-metric/kpi-metric.js.map +1 -0
- package/dist-server/service/kpi-metric-value/index.d.ts +6 -0
- package/dist-server/service/kpi-metric-value/index.js +10 -0
- package/dist-server/service/kpi-metric-value/index.js.map +1 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.d.ts +11 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +283 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +1 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-query.d.ts +13 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js +106 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js.map +1 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.d.ts +26 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js +112 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js.map +1 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value.d.ts +23 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js +107 -0
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js.map +1 -0
- 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 +140 -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/index.d.ts +6 -0
- package/dist-server/service/kpi-statistic/index.js +10 -0
- package/dist-server/service/kpi-statistic/index.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 +14 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js +279 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js.map +1 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-query.d.ts +17 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-query.js +183 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-query.js.map +1 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-type.d.ts +59 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-type.js +200 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-type.js.map +1 -0
- package/dist-server/service/kpi-statistic/kpi-statistic.d.ts +42 -0
- package/dist-server/service/kpi-statistic/kpi-statistic.js +210 -0
- package/dist-server/service/kpi-statistic/kpi-statistic.js.map +1 -0
- package/dist-server/service/kpi-value/index.d.ts +6 -0
- package/dist-server/service/kpi-value/index.js +10 -0
- package/dist-server/service/kpi-value/index.js.map +1 -0
- package/dist-server/service/kpi-value/kpi-value-mutation.d.ts +13 -0
- package/dist-server/service/kpi-value/kpi-value-mutation.js +447 -0
- package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -0
- package/dist-server/service/kpi-value/kpi-value-query.d.ts +22 -0
- package/dist-server/service/kpi-value/kpi-value-query.js +149 -0
- package/dist-server/service/kpi-value/kpi-value-query.js.map +1 -0
- package/dist-server/service/kpi-value/kpi-value-score.service.d.ts +24 -0
- package/dist-server/service/kpi-value/kpi-value-score.service.js +61 -0
- package/dist-server/service/kpi-value/kpi-value-score.service.js.map +1 -0
- package/dist-server/service/kpi-value/kpi-value-type.d.ts +33 -0
- package/dist-server/service/kpi-value/kpi-value-type.js +156 -0
- package/dist-server/service/kpi-value/kpi-value-type.js.map +1 -0
- package/dist-server/service/kpi-value/kpi-value.d.ts +32 -0
- package/dist-server/service/kpi-value/kpi-value.js +175 -0
- package/dist-server/service/kpi-value/kpi-value.js.map +1 -0
- package/dist-server/service/utils/value-date-util.d.ts +4 -0
- package/dist-server/service/utils/value-date-util.js +117 -0
- package/dist-server/service/utils/value-date-util.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,175 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
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;
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|