@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,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KpiMetricValue = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const type_graphql_1 = require("type-graphql");
|
|
7
|
-
const shell_1 = require("@things-factory/shell");
|
|
8
|
-
const kpi_metric_1 = require("../kpi-metric/kpi-metric");
|
|
9
|
-
const kpi_1 = require("../kpi/kpi");
|
|
10
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
11
|
-
let KpiMetricValue = class KpiMetricValue {
|
|
12
|
-
};
|
|
13
|
-
exports.KpiMetricValue = KpiMetricValue;
|
|
14
|
-
tslib_1.__decorate([
|
|
15
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
16
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
17
|
-
tslib_1.__metadata("design:type", String)
|
|
18
|
-
], KpiMetricValue.prototype, "id", void 0);
|
|
19
|
-
tslib_1.__decorate([
|
|
20
|
-
(0, typeorm_1.ManyToOne)(() => shell_1.Domain),
|
|
21
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true }),
|
|
22
|
-
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
23
|
-
], KpiMetricValue.prototype, "domain", void 0);
|
|
24
|
-
tslib_1.__decorate([
|
|
25
|
-
(0, typeorm_1.RelationId)((entity) => entity.domain),
|
|
26
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
27
|
-
tslib_1.__metadata("design:type", String)
|
|
28
|
-
], KpiMetricValue.prototype, "domainId", void 0);
|
|
29
|
-
tslib_1.__decorate([
|
|
30
|
-
(0, typeorm_1.ManyToOne)(() => kpi_metric_1.KpiMetric, { nullable: false, onDelete: 'CASCADE' }),
|
|
31
|
-
(0, typeorm_1.JoinColumn)({ name: 'metricId' }),
|
|
32
|
-
(0, type_graphql_1.Field)(type => kpi_metric_1.KpiMetric),
|
|
33
|
-
tslib_1.__metadata("design:type", kpi_metric_1.KpiMetric)
|
|
34
|
-
], KpiMetricValue.prototype, "metric", void 0);
|
|
35
|
-
tslib_1.__decorate([
|
|
36
|
-
(0, typeorm_1.RelationId)((entity) => entity.metric),
|
|
37
|
-
(0, type_graphql_1.Field)(),
|
|
38
|
-
tslib_1.__metadata("design:type", String)
|
|
39
|
-
], KpiMetricValue.prototype, "metricId", void 0);
|
|
40
|
-
tslib_1.__decorate([
|
|
41
|
-
(0, typeorm_1.Column)('float'),
|
|
42
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Float),
|
|
43
|
-
tslib_1.__metadata("design:type", Number)
|
|
44
|
-
], KpiMetricValue.prototype, "value", void 0);
|
|
45
|
-
tslib_1.__decorate([
|
|
46
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
47
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
48
|
-
tslib_1.__metadata("design:type", String)
|
|
49
|
-
], KpiMetricValue.prototype, "unit", void 0);
|
|
50
|
-
tslib_1.__decorate([
|
|
51
|
-
(0, typeorm_1.Column)(),
|
|
52
|
-
(0, type_graphql_1.Field)({
|
|
53
|
-
description: 'Date or period for which this metric value is recorded (e.g., day: YYYY-MM-DD, month: YYYY-MM, range: YYYY-MM-DD~YYYY-MM-DD).'
|
|
54
|
-
}),
|
|
55
|
-
tslib_1.__metadata("design:type", String)
|
|
56
|
-
], KpiMetricValue.prototype, "valueDate", void 0);
|
|
57
|
-
tslib_1.__decorate([
|
|
58
|
-
(0, typeorm_1.Column)({ default: 'DAY' }),
|
|
59
|
-
(0, type_graphql_1.Field)(type => kpi_1.KpiPeriodType),
|
|
60
|
-
tslib_1.__metadata("design:type", String)
|
|
61
|
-
], KpiMetricValue.prototype, "periodType", void 0);
|
|
62
|
-
tslib_1.__decorate([
|
|
63
|
-
(0, typeorm_1.Column)({ default: '' }),
|
|
64
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'Organizational unit for this value (project, department, company, employee, etc.)' }),
|
|
65
|
-
tslib_1.__metadata("design:type", String)
|
|
66
|
-
], KpiMetricValue.prototype, "org", void 0);
|
|
67
|
-
tslib_1.__decorate([
|
|
68
|
-
(0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
|
|
69
|
-
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
|
70
|
-
tslib_1.__metadata("design:type", Object)
|
|
71
|
-
], KpiMetricValue.prototype, "meta", void 0);
|
|
72
|
-
tslib_1.__decorate([
|
|
73
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
74
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
75
|
-
tslib_1.__metadata("design:type", Date)
|
|
76
|
-
], KpiMetricValue.prototype, "createdAt", void 0);
|
|
77
|
-
tslib_1.__decorate([
|
|
78
|
-
(0, typeorm_1.UpdateDateColumn)(),
|
|
79
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
80
|
-
tslib_1.__metadata("design:type", Date)
|
|
81
|
-
], KpiMetricValue.prototype, "updatedAt", void 0);
|
|
82
|
-
tslib_1.__decorate([
|
|
83
|
-
(0, typeorm_1.ManyToOne)(() => auth_base_1.User, { nullable: true }),
|
|
84
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
85
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
86
|
-
], KpiMetricValue.prototype, "creator", void 0);
|
|
87
|
-
tslib_1.__decorate([
|
|
88
|
-
(0, typeorm_1.RelationId)((entity) => entity.creator),
|
|
89
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
90
|
-
tslib_1.__metadata("design:type", String)
|
|
91
|
-
], KpiMetricValue.prototype, "creatorId", void 0);
|
|
92
|
-
tslib_1.__decorate([
|
|
93
|
-
(0, typeorm_1.ManyToOne)(() => auth_base_1.User, { nullable: true }),
|
|
94
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
95
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
96
|
-
], KpiMetricValue.prototype, "updater", void 0);
|
|
97
|
-
tslib_1.__decorate([
|
|
98
|
-
(0, typeorm_1.RelationId)((entity) => entity.updater),
|
|
99
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
100
|
-
tslib_1.__metadata("design:type", String)
|
|
101
|
-
], KpiMetricValue.prototype, "updaterId", void 0);
|
|
102
|
-
exports.KpiMetricValue = KpiMetricValue = tslib_1.__decorate([
|
|
103
|
-
(0, typeorm_1.Entity)(),
|
|
104
|
-
(0, typeorm_1.Index)('ix_kpi_metric_value_latest', ['domain', 'metric', 'valueDate', 'org'], { unique: true }),
|
|
105
|
-
(0, type_graphql_1.ObjectType)({ description: 'Current value for each KPI metric (can be used for both state and history).' })
|
|
106
|
-
], KpiMetricValue);
|
|
107
|
-
//# sourceMappingURL=kpi-metric-value.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-metric-value.js","sourceRoot":"","sources":["../../../server/service/kpi-metric-value/kpi-metric-value.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAA2D;AAC3D,iDAA4D;AAC5D,yDAAoD;AACpD,oCAA0C;AAC1C,yDAAgD;AAKzC,IAAM,cAAc,GAApB,MAAM,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oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;+CAAA;AAId;IAFC,IAAA,oBAAU,EAAC,CAAC,MAAsB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;IACtD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACR;yBAvEP,cAAc;IAH1B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,4BAA4B,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC/F,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,6EAA6E,EAAE,CAAC;GAC9F,cAAc,CAwE1B","sourcesContent":["import {\n Entity,\n PrimaryGeneratedColumn,\n Column,\n ManyToOne,\n Index,\n JoinColumn,\n CreateDateColumn,\n UpdateDateColumn,\n RelationId\n} from 'typeorm'\nimport { ObjectType, Field, ID, Float } from 'type-graphql'\nimport { Domain, ScalarObject } from '@things-factory/shell'\nimport { KpiMetric } from '../kpi-metric/kpi-metric'\nimport { KpiPeriodType } from '../kpi/kpi'\nimport { User } from '@things-factory/auth-base'\n\n@Entity()\n@Index('ix_kpi_metric_value_latest', ['domain', 'metric', 'valueDate', 'org'], { unique: true })\n@ObjectType({ description: 'Current value for each KPI metric (can be used for both state and history).' })\nexport class KpiMetricValue {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n id: string\n\n @ManyToOne(() => Domain)\n @Field(type => Domain, { nullable: true })\n domain?: Domain\n\n @RelationId((entity: KpiMetricValue) => entity.domain)\n @Field({ nullable: true })\n domainId?: string\n\n @ManyToOne(() => KpiMetric, { nullable: false, onDelete: 'CASCADE' })\n @JoinColumn({ name: 'metricId' })\n @Field(type => KpiMetric)\n metric: KpiMetric\n\n @RelationId((entity: KpiMetricValue) => entity.metric)\n @Field()\n metricId: string\n\n @Column('float')\n @Field(type => Float)\n value: number\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n unit?: string\n\n @Column()\n @Field({\n description:\n 'Date or period for which this metric value is recorded (e.g., day: YYYY-MM-DD, month: YYYY-MM, range: YYYY-MM-DD~YYYY-MM-DD).'\n })\n valueDate: string\n\n @Column({ default: 'DAY' })\n @Field(type => KpiPeriodType)\n periodType: KpiPeriodType\n\n @Column({ default: '' })\n @Field({ nullable: true, description: 'Organizational unit for this value (project, department, company, employee, etc.)' })\n org?: string\n\n @Column({ type: 'simple-json', nullable: true })\n @Field(type => ScalarObject, { nullable: true })\n meta?: any\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(() => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((entity: KpiMetricValue) => entity.creator)\n @Field({ nullable: true })\n creatorId?: string\n\n @ManyToOne(() => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((entity: KpiMetricValue) => entity.updater)\n @Field({ nullable: true })\n updaterId?: string\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { KpiOrgScope } from './kpi-org-scope';
|
|
2
|
-
import { KpiOrgScopeQuery } from './kpi-org-scope-query';
|
|
3
|
-
import { KpiOrgScopeMutation } from './kpi-org-scope-mutation';
|
|
4
|
-
export declare const entities: (typeof KpiOrgScope)[];
|
|
5
|
-
export declare const resolvers: (typeof KpiOrgScopeQuery | typeof KpiOrgScopeMutation)[];
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolvers = exports.entities = void 0;
|
|
4
|
-
const kpi_org_scope_1 = require("./kpi-org-scope");
|
|
5
|
-
const kpi_org_scope_query_1 = require("./kpi-org-scope-query");
|
|
6
|
-
const kpi_org_scope_mutation_1 = require("./kpi-org-scope-mutation");
|
|
7
|
-
exports.entities = [kpi_org_scope_1.KpiOrgScope];
|
|
8
|
-
exports.resolvers = [kpi_org_scope_query_1.KpiOrgScopeQuery, kpi_org_scope_mutation_1.KpiOrgScopeMutation];
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/kpi-org-scope/index.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,+DAAwD;AACxD,qEAA8D;AAEjD,QAAA,QAAQ,GAAG,CAAC,2BAAW,CAAC,CAAA;AACxB,QAAA,SAAS,GAAG,CAAC,sCAAgB,EAAE,4CAAmB,CAAC,CAAA","sourcesContent":["import { KpiOrgScope } from './kpi-org-scope'\nimport { KpiOrgScopeQuery } from './kpi-org-scope-query'\nimport { KpiOrgScopeMutation } from './kpi-org-scope-mutation'\n\nexport const entities = [KpiOrgScope]\nexport const resolvers = [KpiOrgScopeQuery, KpiOrgScopeMutation]\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { KpiOrgScope } from './kpi-org-scope';
|
|
2
|
-
import { NewKpiOrgScope, KpiOrgScopePatch } from './kpi-org-scope-type';
|
|
3
|
-
export declare class KpiOrgScopeMutation {
|
|
4
|
-
createKpiOrgScope(kpiOrgScope: NewKpiOrgScope, context: ResolverContext): Promise<KpiOrgScope>;
|
|
5
|
-
updateMultipleKpiOrgScope(patches: KpiOrgScopePatch[], context: ResolverContext): Promise<KpiOrgScope[]>;
|
|
6
|
-
deleteKpiOrgScopes(ids: string[], context: ResolverContext): Promise<boolean>;
|
|
7
|
-
bulkUpsertKpiOrgScopes(orgScopes: NewKpiOrgScope[], context: ResolverContext): Promise<KpiOrgScope[]>;
|
|
8
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KpiOrgScopeMutation = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const type_graphql_1 = require("type-graphql");
|
|
6
|
-
const typeorm_1 = require("typeorm");
|
|
7
|
-
const shell_1 = require("@things-factory/shell");
|
|
8
|
-
const kpi_org_scope_1 = require("./kpi-org-scope");
|
|
9
|
-
const kpi_org_scope_type_1 = require("./kpi-org-scope-type");
|
|
10
|
-
let KpiOrgScopeMutation = class KpiOrgScopeMutation {
|
|
11
|
-
async createKpiOrgScope(kpiOrgScope, context) {
|
|
12
|
-
const { domain, user, tx } = context.state;
|
|
13
|
-
// Check if org already exists for this domain
|
|
14
|
-
const existingOrgScope = await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).findOne({
|
|
15
|
-
where: { domain: { id: domain.id }, org: kpiOrgScope.org }
|
|
16
|
-
});
|
|
17
|
-
if (existingOrgScope) {
|
|
18
|
-
throw new Error(`Organization '${kpiOrgScope.org}' already has a scope mapping in this domain`);
|
|
19
|
-
}
|
|
20
|
-
const entity = {
|
|
21
|
-
...kpiOrgScope,
|
|
22
|
-
domain,
|
|
23
|
-
creator: user,
|
|
24
|
-
updater: user
|
|
25
|
-
};
|
|
26
|
-
return await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).save(entity);
|
|
27
|
-
}
|
|
28
|
-
async updateMultipleKpiOrgScope(patches, context) {
|
|
29
|
-
const { domain, user, tx } = context.state;
|
|
30
|
-
const ids = patches.map(patch => patch.id);
|
|
31
|
-
const existingOrgScopes = await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).find({
|
|
32
|
-
where: {
|
|
33
|
-
domain: { id: domain.id },
|
|
34
|
-
id: (0, typeorm_1.In)(ids)
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
if (existingOrgScopes.length !== patches.length) {
|
|
38
|
-
throw new Error('Some org-scope mappings not found or not accessible');
|
|
39
|
-
}
|
|
40
|
-
const updatedOrgScopes = [];
|
|
41
|
-
for (const patch of patches) {
|
|
42
|
-
const existingOrgScope = existingOrgScopes.find(os => os.id === patch.id);
|
|
43
|
-
if (!existingOrgScope)
|
|
44
|
-
continue;
|
|
45
|
-
// Check if org is being changed and if new org already exists
|
|
46
|
-
if (patch.org && patch.org !== existingOrgScope.org) {
|
|
47
|
-
const duplicateOrgScope = await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).findOne({
|
|
48
|
-
where: {
|
|
49
|
-
domain: { id: domain.id },
|
|
50
|
-
org: patch.org,
|
|
51
|
-
id: (0, typeorm_1.In)(ids.filter(id => id !== patch.id))
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
if (duplicateOrgScope) {
|
|
55
|
-
throw new Error(`Organization '${patch.org}' already has a scope mapping in this domain`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const updatedEntity = {
|
|
59
|
-
...existingOrgScope,
|
|
60
|
-
...patch,
|
|
61
|
-
updater: user,
|
|
62
|
-
updatedAt: new Date()
|
|
63
|
-
};
|
|
64
|
-
const savedOrgScope = await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).save(updatedEntity);
|
|
65
|
-
updatedOrgScopes.push(savedOrgScope);
|
|
66
|
-
}
|
|
67
|
-
return updatedOrgScopes;
|
|
68
|
-
}
|
|
69
|
-
async deleteKpiOrgScopes(ids, context) {
|
|
70
|
-
const { domain, tx } = context.state;
|
|
71
|
-
const existingOrgScopes = await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).find({
|
|
72
|
-
where: {
|
|
73
|
-
domain: { id: domain.id },
|
|
74
|
-
id: (0, typeorm_1.In)(ids)
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
if (existingOrgScopes.length === 0) {
|
|
78
|
-
throw new Error('No org-scope mappings found to delete');
|
|
79
|
-
}
|
|
80
|
-
// Soft delete
|
|
81
|
-
await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).softDelete(existingOrgScopes.map(os => os.id));
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
async bulkUpsertKpiOrgScopes(orgScopes, context) {
|
|
85
|
-
const { domain, user, tx } = context.state;
|
|
86
|
-
const orgs = orgScopes.map(os => os.org);
|
|
87
|
-
const existingOrgScopes = await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).find({
|
|
88
|
-
where: {
|
|
89
|
-
domain: { id: domain.id },
|
|
90
|
-
org: (0, typeorm_1.In)(orgs)
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
const results = [];
|
|
94
|
-
for (const orgScopeData of orgScopes) {
|
|
95
|
-
const existing = existingOrgScopes.find(os => os.org === orgScopeData.org);
|
|
96
|
-
if (existing) {
|
|
97
|
-
// Update existing
|
|
98
|
-
const updatedEntity = {
|
|
99
|
-
...existing,
|
|
100
|
-
...orgScopeData,
|
|
101
|
-
updater: user,
|
|
102
|
-
updatedAt: new Date()
|
|
103
|
-
};
|
|
104
|
-
const updated = await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).save(updatedEntity);
|
|
105
|
-
results.push(updated);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
// Create new
|
|
109
|
-
const newEntity = {
|
|
110
|
-
...orgScopeData,
|
|
111
|
-
domain,
|
|
112
|
-
creator: user,
|
|
113
|
-
updater: user
|
|
114
|
-
};
|
|
115
|
-
const saved = await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope, tx).save(newEntity);
|
|
116
|
-
results.push(saved);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return results;
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
exports.KpiOrgScopeMutation = KpiOrgScopeMutation;
|
|
123
|
-
tslib_1.__decorate([
|
|
124
|
-
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
|
125
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
|
126
|
-
(0, type_graphql_1.Mutation)(returns => kpi_org_scope_1.KpiOrgScope, { description: 'Create a new KPI org-scope mapping with the provided details.' }),
|
|
127
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('kpiOrgScope', { description: 'Input object containing details for the new org-scope mapping.' })),
|
|
128
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
129
|
-
tslib_1.__metadata("design:type", Function),
|
|
130
|
-
tslib_1.__metadata("design:paramtypes", [kpi_org_scope_type_1.NewKpiOrgScope, Object]),
|
|
131
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
132
|
-
], KpiOrgScopeMutation.prototype, "createKpiOrgScope", null);
|
|
133
|
-
tslib_1.__decorate([
|
|
134
|
-
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
|
135
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
|
136
|
-
(0, type_graphql_1.Mutation)(returns => [kpi_org_scope_1.KpiOrgScope], {
|
|
137
|
-
description: 'Update multiple KPI org-scope mappings with the provided patches.'
|
|
138
|
-
}),
|
|
139
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [kpi_org_scope_type_1.KpiOrgScopePatch], {
|
|
140
|
-
description: 'Array of patch objects for updating org-scope mappings.'
|
|
141
|
-
})),
|
|
142
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
143
|
-
tslib_1.__metadata("design:type", Function),
|
|
144
|
-
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
145
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
146
|
-
], KpiOrgScopeMutation.prototype, "updateMultipleKpiOrgScope", null);
|
|
147
|
-
tslib_1.__decorate([
|
|
148
|
-
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
|
149
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
|
150
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'Delete KPI org-scope mappings by their IDs.' }),
|
|
151
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String], { description: 'Array of org-scope mapping IDs to delete.' })),
|
|
152
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
153
|
-
tslib_1.__metadata("design:type", Function),
|
|
154
|
-
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
155
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
156
|
-
], KpiOrgScopeMutation.prototype, "deleteKpiOrgScopes", null);
|
|
157
|
-
tslib_1.__decorate([
|
|
158
|
-
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
|
159
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
|
160
|
-
(0, type_graphql_1.Mutation)(returns => [kpi_org_scope_1.KpiOrgScope], { description: 'Bulk create or update KPI org-scope mappings.' }),
|
|
161
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('orgScopes', type => [kpi_org_scope_type_1.NewKpiOrgScope], { description: 'Array of org-scope mapping data for bulk upsert.' })),
|
|
162
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
163
|
-
tslib_1.__metadata("design:type", Function),
|
|
164
|
-
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
165
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
166
|
-
], KpiOrgScopeMutation.prototype, "bulkUpsertKpiOrgScopes", null);
|
|
167
|
-
exports.KpiOrgScopeMutation = KpiOrgScopeMutation = tslib_1.__decorate([
|
|
168
|
-
(0, type_graphql_1.Resolver)(kpi_org_scope_1.KpiOrgScope)
|
|
169
|
-
], KpiOrgScopeMutation);
|
|
170
|
-
//# sourceMappingURL=kpi-org-scope-mutation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,2BAAW,CAAC,EAAE,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;IAElG,mBAAA,IAAA,kBAAG,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,mCAAc,CAAC,EAAE,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC,CAAA;IAE/G,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAyCP;8BAnKU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,2BAAW,CAAC;GACT,mBAAmB,CAoK/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { KpiOrgScope } from './kpi-org-scope'\nimport { NewKpiOrgScope, KpiOrgScopePatch } from './kpi-org-scope-type'\n\n@Resolver(KpiOrgScope)\nexport class KpiOrgScopeMutation {\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => KpiOrgScope, { description: 'Create a new KPI org-scope mapping with the provided details.' })\n async createKpiOrgScope(\n @Arg('kpiOrgScope', { description: 'Input object containing details for the new org-scope mapping.' })\n kpiOrgScope: NewKpiOrgScope,\n @Ctx() context: ResolverContext\n ): Promise<KpiOrgScope> {\n const { domain, user, tx } = context.state\n\n // Check if org already exists for this domain\n const existingOrgScope = await getRepository(KpiOrgScope, tx).findOne({\n where: { domain: { id: domain.id }, org: kpiOrgScope.org }\n })\n\n if (existingOrgScope) {\n throw new Error(`Organization '${kpiOrgScope.org}' already has a scope mapping in this domain`)\n }\n\n const entity: Partial<KpiOrgScope> = {\n ...kpiOrgScope,\n domain,\n creator: user,\n updater: user\n }\n\n return await getRepository(KpiOrgScope, tx).save(entity)\n }\n\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => [KpiOrgScope], {\n description: 'Update multiple KPI org-scope mappings with the provided patches.'\n })\n async updateMultipleKpiOrgScope(\n @Arg('patches', type => [KpiOrgScopePatch], {\n description: 'Array of patch objects for updating org-scope mappings.'\n })\n patches: KpiOrgScopePatch[],\n @Ctx() context: ResolverContext\n ): Promise<KpiOrgScope[]> {\n const { domain, user, tx } = context.state\n\n const ids = patches.map(patch => patch.id)\n const existingOrgScopes = await getRepository(KpiOrgScope, tx).find({\n where: {\n domain: { id: domain.id },\n id: In(ids)\n }\n })\n\n if (existingOrgScopes.length !== patches.length) {\n throw new Error('Some org-scope mappings not found or not accessible')\n }\n\n const updatedOrgScopes: KpiOrgScope[] = []\n\n for (const patch of patches) {\n const existingOrgScope = existingOrgScopes.find(os => os.id === patch.id)\n if (!existingOrgScope) continue\n\n // Check if org is being changed and if new org already exists\n if (patch.org && patch.org !== existingOrgScope.org) {\n const duplicateOrgScope = await getRepository(KpiOrgScope, tx).findOne({\n where: {\n domain: { id: domain.id },\n org: patch.org,\n id: In(ids.filter(id => id !== patch.id))\n }\n })\n if (duplicateOrgScope) {\n throw new Error(`Organization '${patch.org}' already has a scope mapping in this domain`)\n }\n }\n\n const updatedEntity: Partial<KpiOrgScope> = {\n ...existingOrgScope,\n ...patch,\n updater: user,\n updatedAt: new Date()\n }\n\n const savedOrgScope = await getRepository(KpiOrgScope, tx).save(updatedEntity)\n updatedOrgScopes.push(savedOrgScope)\n }\n\n return updatedOrgScopes\n }\n\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'Delete KPI org-scope mappings by their IDs.' })\n async deleteKpiOrgScopes(\n @Arg('ids', type => [String], { description: 'Array of org-scope mapping IDs to delete.' }) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n const existingOrgScopes = await getRepository(KpiOrgScope, tx).find({\n where: {\n domain: { id: domain.id },\n id: In(ids)\n }\n })\n\n if (existingOrgScopes.length === 0) {\n throw new Error('No org-scope mappings found to delete')\n }\n\n // Soft delete\n await getRepository(KpiOrgScope, tx).softDelete(existingOrgScopes.map(os => os.id))\n\n return true\n }\n\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => [KpiOrgScope], { description: 'Bulk create or update KPI org-scope mappings.' })\n async bulkUpsertKpiOrgScopes(\n @Arg('orgScopes', type => [NewKpiOrgScope], { description: 'Array of org-scope mapping data for bulk upsert.' })\n orgScopes: NewKpiOrgScope[],\n @Ctx() context: ResolverContext\n ): Promise<KpiOrgScope[]> {\n const { domain, user, tx } = context.state\n\n const orgs = orgScopes.map(os => os.org)\n const existingOrgScopes = await getRepository(KpiOrgScope, tx).find({\n where: {\n domain: { id: domain.id },\n org: In(orgs)\n }\n })\n\n const results: KpiOrgScope[] = []\n\n for (const orgScopeData of orgScopes) {\n const existing = existingOrgScopes.find(os => os.org === orgScopeData.org)\n\n if (existing) {\n // Update existing\n const updatedEntity: Partial<KpiOrgScope> = {\n ...existing,\n ...orgScopeData,\n updater: user,\n updatedAt: new Date()\n }\n const updated = await getRepository(KpiOrgScope, tx).save(updatedEntity)\n results.push(updated)\n } else {\n // Create new\n const newEntity: Partial<KpiOrgScope> = {\n ...orgScopeData,\n domain,\n creator: user,\n updater: user\n }\n const saved = await getRepository(KpiOrgScope, tx).save(newEntity)\n results.push(saved)\n }\n }\n\n return results\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Domain, ListParam } from '@things-factory/shell';
|
|
2
|
-
import { User } from '@things-factory/auth-base';
|
|
3
|
-
import { KpiOrgScope } from './kpi-org-scope';
|
|
4
|
-
import { KpiOrgScopeList } from './kpi-org-scope-type';
|
|
5
|
-
export declare class KpiOrgScopeQuery {
|
|
6
|
-
kpiOrgScope(id: string, context: ResolverContext): Promise<KpiOrgScope>;
|
|
7
|
-
kpiOrgScopes(params: ListParam, context: ResolverContext): Promise<KpiOrgScopeList>;
|
|
8
|
-
kpiOrgScopeValues(scopeField: 'scope01' | 'scope02' | 'scope03' | 'scope04' | 'scope05', context: ResolverContext, searchTerm?: string): Promise<string[]>;
|
|
9
|
-
kpiOrgValues(context: ResolverContext, searchTerm?: string): Promise<string[]>;
|
|
10
|
-
kpiOrgScopeByOrg(org: string, context: ResolverContext): Promise<KpiOrgScope | undefined>;
|
|
11
|
-
domain(kpiOrgScope: KpiOrgScope): Promise<Domain>;
|
|
12
|
-
creator(kpiOrgScope: KpiOrgScope): Promise<User>;
|
|
13
|
-
updater(kpiOrgScope: KpiOrgScope): Promise<User>;
|
|
14
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KpiOrgScopeQuery = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const type_graphql_1 = require("type-graphql");
|
|
6
|
-
const shell_1 = require("@things-factory/shell");
|
|
7
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
-
const kpi_org_scope_1 = require("./kpi-org-scope");
|
|
9
|
-
const kpi_org_scope_type_1 = require("./kpi-org-scope-type");
|
|
10
|
-
let KpiOrgScopeQuery = class KpiOrgScopeQuery {
|
|
11
|
-
async kpiOrgScope(id, context) {
|
|
12
|
-
const { domain } = context.state;
|
|
13
|
-
return await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope).findOne({
|
|
14
|
-
where: { domain: { id: domain.id }, id }
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
async kpiOrgScopes(params, context) {
|
|
18
|
-
const { domain } = context.state;
|
|
19
|
-
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
20
|
-
domain,
|
|
21
|
-
params,
|
|
22
|
-
repository: await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope),
|
|
23
|
-
searchables: ['org', 'scope01', 'scope02', 'scope03', 'scope04', 'scope05']
|
|
24
|
-
});
|
|
25
|
-
const [items, total] = await queryBuilder.getManyAndCount();
|
|
26
|
-
return { items, total };
|
|
27
|
-
}
|
|
28
|
-
async kpiOrgScopeValues(scopeField, context, searchTerm) {
|
|
29
|
-
const { domain } = context.state;
|
|
30
|
-
const queryBuilder = (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope)
|
|
31
|
-
.createQueryBuilder('orgScope')
|
|
32
|
-
.select(`DISTINCT orgScope.${scopeField}`, 'value')
|
|
33
|
-
.where('orgScope.domain_id = :domainId', { domainId: domain.id })
|
|
34
|
-
.andWhere(`orgScope.${scopeField} IS NOT NULL`)
|
|
35
|
-
.andWhere(`orgScope.${scopeField} != ''`)
|
|
36
|
-
.andWhere('orgScope.active = true');
|
|
37
|
-
if (searchTerm) {
|
|
38
|
-
queryBuilder.andWhere(`orgScope.${scopeField} ILIKE :searchTerm`, {
|
|
39
|
-
searchTerm: `%${searchTerm}%`
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
const results = await queryBuilder.getRawMany();
|
|
43
|
-
return results.map(r => r.value).filter(v => v);
|
|
44
|
-
}
|
|
45
|
-
async kpiOrgValues(context, searchTerm) {
|
|
46
|
-
const { domain } = context.state;
|
|
47
|
-
const queryBuilder = (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope)
|
|
48
|
-
.createQueryBuilder('orgScope')
|
|
49
|
-
.select('DISTINCT orgScope.org', 'value')
|
|
50
|
-
.where('orgScope.domain_id = :domainId', { domainId: domain.id })
|
|
51
|
-
.andWhere('orgScope.active = true');
|
|
52
|
-
if (searchTerm) {
|
|
53
|
-
queryBuilder.andWhere('orgScope.org ILIKE :searchTerm', {
|
|
54
|
-
searchTerm: `%${searchTerm}%`
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
const results = await queryBuilder.getRawMany();
|
|
58
|
-
return results.map(r => r.value);
|
|
59
|
-
}
|
|
60
|
-
async kpiOrgScopeByOrg(org, context) {
|
|
61
|
-
const { domain } = context.state;
|
|
62
|
-
return await (0, shell_1.getRepository)(kpi_org_scope_1.KpiOrgScope).findOne({
|
|
63
|
-
where: { domain: { id: domain.id }, org }
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
async domain(kpiOrgScope) {
|
|
67
|
-
return kpiOrgScope.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: kpiOrgScope.domainId }));
|
|
68
|
-
}
|
|
69
|
-
async creator(kpiOrgScope) {
|
|
70
|
-
return kpiOrgScope.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: kpiOrgScope.creatorId }));
|
|
71
|
-
}
|
|
72
|
-
async updater(kpiOrgScope) {
|
|
73
|
-
return kpiOrgScope.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: kpiOrgScope.updaterId }));
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
exports.KpiOrgScopeQuery = KpiOrgScopeQuery;
|
|
77
|
-
tslib_1.__decorate([
|
|
78
|
-
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
|
|
79
|
-
(0, type_graphql_1.Query)(returns => kpi_org_scope_1.KpiOrgScope, {
|
|
80
|
-
nullable: true,
|
|
81
|
-
description: 'Fetch a single KPI org-scope mapping by its unique identifier.'
|
|
82
|
-
}),
|
|
83
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('id', { description: 'Unique identifier of the org-scope mapping to fetch.' })),
|
|
84
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
85
|
-
tslib_1.__metadata("design:type", Function),
|
|
86
|
-
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
87
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
88
|
-
], KpiOrgScopeQuery.prototype, "kpiOrgScope", null);
|
|
89
|
-
tslib_1.__decorate([
|
|
90
|
-
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
|
|
91
|
-
(0, type_graphql_1.Query)(returns => kpi_org_scope_type_1.KpiOrgScopeList, {
|
|
92
|
-
description: 'Fetch multiple KPI org-scope mappings with filters and pagination'
|
|
93
|
-
}),
|
|
94
|
-
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
95
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
96
|
-
tslib_1.__metadata("design:type", Function),
|
|
97
|
-
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
98
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
99
|
-
], KpiOrgScopeQuery.prototype, "kpiOrgScopes", null);
|
|
100
|
-
tslib_1.__decorate([
|
|
101
|
-
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
|
|
102
|
-
(0, type_graphql_1.Query)(returns => [String], { description: 'Get distinct values for a specific scope field' }),
|
|
103
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('scopeField', { description: 'Scope field to get distinct values from' })),
|
|
104
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
105
|
-
tslib_1.__param(2, (0, type_graphql_1.Arg)('searchTerm', { nullable: true, description: 'Optional search term to filter values' })),
|
|
106
|
-
tslib_1.__metadata("design:type", Function),
|
|
107
|
-
tslib_1.__metadata("design:paramtypes", [String, Object, String]),
|
|
108
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
109
|
-
], KpiOrgScopeQuery.prototype, "kpiOrgScopeValues", null);
|
|
110
|
-
tslib_1.__decorate([
|
|
111
|
-
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
|
|
112
|
-
(0, type_graphql_1.Query)(returns => [String], { description: 'Get distinct org values' }),
|
|
113
|
-
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
|
114
|
-
tslib_1.__param(1, (0, type_graphql_1.Arg)('searchTerm', { nullable: true, description: 'Optional search term to filter org values' })),
|
|
115
|
-
tslib_1.__metadata("design:type", Function),
|
|
116
|
-
tslib_1.__metadata("design:paramtypes", [Object, String]),
|
|
117
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
118
|
-
], KpiOrgScopeQuery.prototype, "kpiOrgValues", null);
|
|
119
|
-
tslib_1.__decorate([
|
|
120
|
-
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
|
|
121
|
-
(0, type_graphql_1.Query)(returns => kpi_org_scope_1.KpiOrgScope, { nullable: true, description: 'Find org-scope mapping by org identifier' }),
|
|
122
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('org', { description: 'Organization identifier to search for' })),
|
|
123
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
124
|
-
tslib_1.__metadata("design:type", Function),
|
|
125
|
-
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
126
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
127
|
-
], KpiOrgScopeQuery.prototype, "kpiOrgScopeByOrg", null);
|
|
128
|
-
tslib_1.__decorate([
|
|
129
|
-
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
130
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
131
|
-
tslib_1.__metadata("design:type", Function),
|
|
132
|
-
tslib_1.__metadata("design:paramtypes", [kpi_org_scope_1.KpiOrgScope]),
|
|
133
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
134
|
-
], KpiOrgScopeQuery.prototype, "domain", null);
|
|
135
|
-
tslib_1.__decorate([
|
|
136
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
137
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
138
|
-
tslib_1.__metadata("design:type", Function),
|
|
139
|
-
tslib_1.__metadata("design:paramtypes", [kpi_org_scope_1.KpiOrgScope]),
|
|
140
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
141
|
-
], KpiOrgScopeQuery.prototype, "creator", null);
|
|
142
|
-
tslib_1.__decorate([
|
|
143
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
144
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
145
|
-
tslib_1.__metadata("design:type", Function),
|
|
146
|
-
tslib_1.__metadata("design:paramtypes", [kpi_org_scope_1.KpiOrgScope]),
|
|
147
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
148
|
-
], KpiOrgScopeQuery.prototype, "updater", null);
|
|
149
|
-
exports.KpiOrgScopeQuery = KpiOrgScopeQuery = tslib_1.__decorate([
|
|
150
|
-
(0, type_graphql_1.Resolver)(kpi_org_scope_1.KpiOrgScope)
|
|
151
|
-
], KpiOrgScopeQuery);
|
|
152
|
-
//# sourceMappingURL=kpi-org-scope-query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-org-scope-query.js","sourceRoot":"","sources":["../../../server/service/kpi-org-scope/kpi-org-scope-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAEhD,mDAA6C;AAC7C,6DAAsD;AAG/C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAMrB,AAAN,KAAK,CAAC,WAAW,CACqE,EAAU,EACvF,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,2BAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAMK,AAAN,KAAK,CAAC,YA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C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,2BAAW;;+CAE7C;2BArHU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,2BAAW,CAAC;GACT,gBAAgB,CAsH5B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nimport { KpiOrgScope } from './kpi-org-scope'\nimport { KpiOrgScopeList } from './kpi-org-scope-type'\n\n@Resolver(KpiOrgScope)\nexport class KpiOrgScopeQuery {\n @Directive('@privilege(category: \"kpi\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => KpiOrgScope!, {\n nullable: true,\n description: 'Fetch a single KPI org-scope mapping by its unique identifier.'\n })\n async kpiOrgScope(\n @Arg('id', { description: 'Unique identifier of the org-scope mapping to fetch.' }) id: string,\n @Ctx() context: ResolverContext\n ): Promise<KpiOrgScope> {\n const { domain } = context.state\n\n return await getRepository(KpiOrgScope).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"kpi\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => KpiOrgScopeList, {\n description: 'Fetch multiple KPI org-scope mappings with filters and pagination'\n })\n async kpiOrgScopes(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<KpiOrgScopeList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(KpiOrgScope),\n searchables: ['org', 'scope01', 'scope02', 'scope03', 'scope04', 'scope05']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Directive('@privilege(category: \"kpi\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => [String], { description: 'Get distinct values for a specific scope field' })\n async kpiOrgScopeValues(\n @Arg('scopeField', { description: 'Scope field to get distinct values from' })\n scopeField: 'scope01' | 'scope02' | 'scope03' | 'scope04' | 'scope05',\n @Ctx() context: ResolverContext,\n @Arg('searchTerm', { nullable: true, description: 'Optional search term to filter values' }) searchTerm?: string\n ): Promise<string[]> {\n const { domain } = context.state\n\n const queryBuilder = getRepository(KpiOrgScope)\n .createQueryBuilder('orgScope')\n .select(`DISTINCT orgScope.${scopeField}`, 'value')\n .where('orgScope.domain_id = :domainId', { domainId: domain.id })\n .andWhere(`orgScope.${scopeField} IS NOT NULL`)\n .andWhere(`orgScope.${scopeField} != ''`)\n .andWhere('orgScope.active = true')\n\n if (searchTerm) {\n queryBuilder.andWhere(`orgScope.${scopeField} ILIKE :searchTerm`, {\n searchTerm: `%${searchTerm}%`\n })\n }\n\n const results = await queryBuilder.getRawMany()\n return results.map(r => r.value).filter(v => v)\n }\n\n @Directive('@privilege(category: \"kpi\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => [String], { description: 'Get distinct org values' })\n async kpiOrgValues(\n @Ctx() context: ResolverContext,\n @Arg('searchTerm', { nullable: true, description: 'Optional search term to filter org values' }) searchTerm?: string\n ): Promise<string[]> {\n const { domain } = context.state\n\n const queryBuilder = getRepository(KpiOrgScope)\n .createQueryBuilder('orgScope')\n .select('DISTINCT orgScope.org', 'value')\n .where('orgScope.domain_id = :domainId', { domainId: domain.id })\n .andWhere('orgScope.active = true')\n\n if (searchTerm) {\n queryBuilder.andWhere('orgScope.org ILIKE :searchTerm', {\n searchTerm: `%${searchTerm}%`\n })\n }\n\n const results = await queryBuilder.getRawMany()\n return results.map(r => r.value)\n }\n\n @Directive('@privilege(category: \"kpi\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => KpiOrgScope, { nullable: true, description: 'Find org-scope mapping by org identifier' })\n async kpiOrgScopeByOrg(\n @Arg('org', { description: 'Organization identifier to search for' }) org: string,\n @Ctx() context: ResolverContext\n ): Promise<KpiOrgScope | undefined> {\n const { domain } = context.state\n\n return await getRepository(KpiOrgScope).findOne({\n where: { domain: { id: domain.id }, org }\n })\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() kpiOrgScope: KpiOrgScope): Promise<Domain> {\n return kpiOrgScope.domainId && (await getRepository(Domain).findOneBy({ id: kpiOrgScope.domainId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() kpiOrgScope: KpiOrgScope): Promise<User> {\n return kpiOrgScope.creatorId && (await getRepository(User).findOneBy({ id: kpiOrgScope.creatorId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() kpiOrgScope: KpiOrgScope): Promise<User> {\n return kpiOrgScope.updaterId && (await getRepository(User).findOneBy({ id: kpiOrgScope.updaterId }))\n }\n}\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { KpiOrgScope } from './kpi-org-scope';
|
|
2
|
-
export declare class NewKpiOrgScope {
|
|
3
|
-
org: string;
|
|
4
|
-
scope01?: string;
|
|
5
|
-
scope02?: string;
|
|
6
|
-
scope03?: string;
|
|
7
|
-
scope04?: string;
|
|
8
|
-
scope05?: string;
|
|
9
|
-
displayName?: string;
|
|
10
|
-
active?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare class KpiOrgScopePatch {
|
|
13
|
-
id: string;
|
|
14
|
-
org?: string;
|
|
15
|
-
scope01?: string;
|
|
16
|
-
scope02?: string;
|
|
17
|
-
scope03?: string;
|
|
18
|
-
scope04?: string;
|
|
19
|
-
scope05?: string;
|
|
20
|
-
displayName?: string;
|
|
21
|
-
active?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare class KpiOrgScopeList {
|
|
24
|
-
items: KpiOrgScope[];
|
|
25
|
-
total: number;
|
|
26
|
-
}
|