@opencxh/domain 1.281.0 → 1.282.0

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.
@@ -1,6 +1,7 @@
1
+ import { SavedView } from '../saved-view/types';
1
2
  import { OwnerScope } from '../scope/types';
2
3
  import { DimensionId } from './dimensions';
3
- import { WidgetConfig } from './report';
4
+ import { FilterClause, WidgetConfig } from './report';
4
5
  /**
5
6
  * A dashboard SECTION, declaratively. The analytics frontend runs the right widget(s) for the viz and
6
7
  * renders the matching component. `title` and the parent def's `title` are i18n keys resolved against the
@@ -61,3 +62,17 @@ export interface DashboardConfig {
61
62
  createdAt?: number;
62
63
  updatedAt?: number;
63
64
  }
65
+ /** What a report view keeps: the window as the URL writes it (`30d`, `2026-08-01~2026-08-31`) and the filters. */
66
+ export interface ReportViewFilters {
67
+ period: string;
68
+ clauses: FilterClause[];
69
+ }
70
+ /**
71
+ * A saved report view: a preset dashboard with a period and filters, under a name. The shared
72
+ * `SavedView` shape; `layout` is always `"report"` and the dashboard rides in its own column,
73
+ * because the list of dashboards is discovered, not fixed.
74
+ */
75
+ export type ReportView = SavedView<ReportViewFilters, "report"> & {
76
+ dashboardKey: string;
77
+ };
78
+ export declare const REPORT_VIEW_LAYOUTS: readonly ["report"];
@@ -1,3 +1,4 @@
1
+ import { SlaMetric } from '../sla/types';
1
2
  import { DimensionId } from './dimensions';
2
3
  /**
3
4
  * Metric register — the declarative building block. Fixed in code as a typed `const` in the owning app
@@ -13,6 +14,15 @@ export type MetricAggregation = "sum" | "avg" | "rate" | "distinct" | "p50" | "p
13
14
  * conversations is more work, not better work, so its delta stays grey.
14
15
  */
15
16
  export type MetricPolarity = "higher" | "lower" | "neutral";
17
+ /**
18
+ * Where the goal for a metric lives. Only SLA targets today: the minutes an SLA
19
+ * profile sets for one of its metrics. A report shows the goal only when exactly
20
+ * one profile applies — picking between several would be a guess.
21
+ */
22
+ export type MetricTarget = {
23
+ kind: "sla";
24
+ metric: SlaMetric;
25
+ };
16
26
  export interface MetricDefinition {
17
27
  /**
18
28
  * Globally-unique, app-namespaced id: "<source>.<family>.<name>", e.g. "comms.reply_time.first",
@@ -42,4 +52,6 @@ export interface MetricDefinition {
42
52
  hidden?: boolean;
43
53
  /** Good direction for a delta. Omitted = the analytics app guesses from id and aggregation. */
44
54
  polarity?: MetricPolarity;
55
+ /** The goal this metric is measured against, if any (a duration metric against an SLA target). */
56
+ target?: MetricTarget;
45
57
  }