react-semaphor 0.1.369 → 0.1.370

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.
@@ -564,7 +564,7 @@ declare type SemaphorAnalyticsFilterBase = {
564
564
 
565
565
  declare type SemaphorAnalyticsFilterOperator = SemaphorInputOperator | 'not_contains' | 'is_null' | 'is_not_null';
566
566
 
567
- declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
567
+ declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent | SemaphorMatrixIntent;
568
568
 
569
569
  declare type SemaphorAnalyticsNullFilter = SemaphorAnalyticsFilterBase & {
570
570
  operator: SemaphorAnalyticsNullFilterOperator;
@@ -582,6 +582,14 @@ declare type SemaphorAnalyticsValueFilterOperator = Exclude<SemaphorAnalyticsFil
582
582
 
583
583
  declare type SemaphorDialect = 'postgres' | 'mysql' | 'mssql' | 'snowflake' | 'clickhouse' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
584
584
 
585
+ /**
586
+ * Explorer-backed table source. This is intentionally distinct from raw SQL:
587
+ * matrix planning needs stable source metadata, fields, and dialect context.
588
+ */
589
+ declare type SemaphorExplorerSourceRef = Extract<SemaphorSourceRef, {
590
+ kind: 'physical';
591
+ }>;
592
+
585
593
  declare type SemaphorFieldRef = {
586
594
  name: string;
587
595
  label?: string;
@@ -612,6 +620,149 @@ declare type SemaphorInputOptionsIntent = {
612
620
  limit?: number;
613
621
  };
614
622
 
623
+ declare type SemaphorMatrixAxisExpansionOptions = {
624
+ defaultDepth?: number;
625
+ lazy?: boolean;
626
+ expandedPaths?: SemaphorMatrixMemberPathSegment[][];
627
+ };
628
+
629
+ declare type SemaphorMatrixAxisLevel = {
630
+ id?: string;
631
+ field: SemaphorFieldRef;
632
+ grain?: SemaphorTimeGrain;
633
+ label?: string;
634
+ subtotal?: boolean | SemaphorMatrixSubtotalOptions;
635
+ sortBy?: SemaphorMatrixAxisSortRule;
636
+ };
637
+
638
+ declare type SemaphorMatrixAxisSortRule = {
639
+ direction: 'asc' | 'desc';
640
+ by: {
641
+ kind: 'label';
642
+ } | {
643
+ kind: 'field';
644
+ field: SemaphorFieldRef;
645
+ aggregate?: SemaphorAggregateFunction;
646
+ };
647
+ nulls?: 'warehouseDefault' | 'first' | 'last';
648
+ scope?: 'global' | 'withinParent';
649
+ };
650
+
651
+ declare type SemaphorMatrixDisplayLimitOptions = {
652
+ rows?: SemaphorMatrixDisplayLimitRule;
653
+ columns?: SemaphorMatrixDisplayLimitRule;
654
+ };
655
+
656
+ declare type SemaphorMatrixDisplayLimitRule = {
657
+ limit: number;
658
+ by?: 'label' | 'value';
659
+ direction?: 'top' | 'bottom';
660
+ others?: boolean | {
661
+ label?: string;
662
+ };
663
+ };
664
+
665
+ declare type SemaphorMatrixExpansionOptions = {
666
+ rows?: SemaphorMatrixAxisExpansionOptions;
667
+ columns?: SemaphorMatrixAxisExpansionOptions;
668
+ };
669
+
670
+ declare type SemaphorMatrixIntent = {
671
+ kind: 'matrix';
672
+ version?: SemaphorProtocolVersion;
673
+ id?: string;
674
+ label?: string;
675
+ source: SemaphorMatrixSourceRef;
676
+ rows: SemaphorMatrixAxisLevel[];
677
+ columns?: SemaphorMatrixAxisLevel[];
678
+ values: SemaphorMatrixValueField[];
679
+ filters?: SemaphorAnalyticsFilter[];
680
+ inputs?: SemaphorInputBinding[];
681
+ totals?: SemaphorMatrixTotalOptions;
682
+ sort?: SemaphorMatrixSortRule[];
683
+ expansion?: SemaphorMatrixExpansionOptions;
684
+ layout?: SemaphorMatrixLayoutOptions;
685
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
686
+ };
687
+
688
+ declare type SemaphorMatrixLayoutOptions = {
689
+ hierarchy?: 'compact' | 'tabular' | 'outline';
690
+ valuesPlacement?: 'columns' | 'rows';
691
+ stickyRowHeaders?: boolean;
692
+ stickyColumnHeaders?: boolean;
693
+ };
694
+
695
+ declare type SemaphorMatrixMemberPathSegment = {
696
+ levelId: string;
697
+ value: unknown;
698
+ };
699
+
700
+ declare type SemaphorMatrixSortRule = {
701
+ axis: 'row' | 'column';
702
+ targetId?: string;
703
+ direction: 'asc' | 'desc';
704
+ by: {
705
+ kind: 'label';
706
+ } | {
707
+ kind: 'field';
708
+ field: SemaphorFieldRef;
709
+ aggregate?: SemaphorAggregateFunction;
710
+ } | {
711
+ kind: 'value';
712
+ valueId: string;
713
+ rowPath?: SemaphorMatrixMemberPathSegment[];
714
+ columnPath?: SemaphorMatrixMemberPathSegment[];
715
+ };
716
+ nulls?: 'warehouseDefault' | 'first' | 'last';
717
+ scope?: 'global' | 'withinParent';
718
+ };
719
+
720
+ declare type SemaphorMatrixSourceRef = SemaphorSemanticSourceRef | SemaphorExplorerSourceRef;
721
+
722
+ declare type SemaphorMatrixSubtotalOptions = {
723
+ enabled?: boolean;
724
+ position?: 'before' | 'after';
725
+ label?: string;
726
+ };
727
+
728
+ declare type SemaphorMatrixTotalCalculation = {
729
+ kind: 'defaultAggregate';
730
+ } | {
731
+ kind: 'blank';
732
+ } | {
733
+ kind: 'labelOnly';
734
+ label?: string;
735
+ } | {
736
+ kind: 'customAggregate';
737
+ aggregate: SemaphorAggregateFunction;
738
+ } | {
739
+ kind: 'percentOfParent';
740
+ } | {
741
+ kind: 'percentOfGrandTotal';
742
+ } | {
743
+ kind: 'customExpression';
744
+ expressionId: string;
745
+ };
746
+
747
+ declare type SemaphorMatrixTotalOptions = {
748
+ rows?: boolean | 'perLevel';
749
+ columns?: boolean | 'perLevel';
750
+ grandTotal?: boolean | {
751
+ rows?: boolean;
752
+ columns?: boolean;
753
+ };
754
+ rowPosition?: 'top' | 'bottom';
755
+ columnPosition?: 'left' | 'right';
756
+ };
757
+
758
+ declare type SemaphorMatrixValueField = {
759
+ id?: string;
760
+ field: SemaphorFieldRef;
761
+ aggregate?: SemaphorAggregateFunction;
762
+ label?: string;
763
+ totalBehavior?: SemaphorMatrixTotalCalculation;
764
+ };
765
+
615
766
  declare type SemaphorMetricAnalysis = {
616
767
  kind: 'period_change';
617
768
  orderBy?: 'absolute_change' | 'positive_change' | 'negative_change' | 'period';
@@ -680,6 +831,10 @@ declare type SemaphorRelativeTimeWindow = {
680
831
  completeness?: 'include_partial' | 'complete_periods';
681
832
  };
682
833
 
834
+ declare type SemaphorSemanticSourceRef = Extract<SemaphorSourceRef, {
835
+ kind: 'semantic';
836
+ }>;
837
+
683
838
  declare type SemaphorSourceRef = {
684
839
  kind: 'semantic';
685
840
  domainId: string;
@@ -27,6 +27,289 @@ declare type CalendarContext = {
27
27
  };
28
28
  };
29
29
 
30
+ declare type MatrixAxisLevelDescriptor = {
31
+ instanceId: string;
32
+ fieldKey: string;
33
+ label: string;
34
+ field: SemaphorFieldRef;
35
+ grain?: SemaphorTimeGrain;
36
+ subtotal?: SemaphorMatrixSubtotalOptions;
37
+ };
38
+
39
+ declare type MatrixAxisPayload = {
40
+ id: 'rows' | 'columns';
41
+ levels: MatrixAxisLevelDescriptor[];
42
+ nodes: MatrixNode[];
43
+ };
44
+
45
+ declare type MatrixCapability = 'rowHierarchy' | 'columnHierarchy' | 'rowSubtotals' | 'columnSubtotals' | 'grandTotals' | 'lazyRows' | 'lazyColumns' | 'conditionalFormatting' | 'visualExport' | (string & {});
46
+
47
+ declare type MatrixCell = {
48
+ id: string;
49
+ rowNodeId: string;
50
+ columnNodeId?: string;
51
+ measureInstanceId: string;
52
+ rowPath: MatrixMemberPathSegment[];
53
+ columnPath: MatrixMemberPathSegment[];
54
+ rawValue: unknown;
55
+ presence: MatrixCellPresence;
56
+ formattedValue?: string;
57
+ role: MatrixCellRole;
58
+ aggregateFunction?: SemaphorAggregateFunction;
59
+ formattingScope: MatrixCellFormattingScope;
60
+ actions?: MatrixCellAction[];
61
+ };
62
+
63
+ declare type MatrixCellAction = {
64
+ kind: 'requestSubgoal' | 'filter' | 'copyValue' | 'explainCalculation' | 'inspectContributingRows' | 'drillThrough' | (string & {});
65
+ label?: string;
66
+ payload?: Record<string, unknown>;
67
+ };
68
+
69
+ declare type MatrixCellFormattingScope = {
70
+ rowNodeId: string;
71
+ columnNodeId?: string;
72
+ measureInstanceId: string;
73
+ role: MatrixCellRole;
74
+ rowPath: MatrixMemberPathSegment[];
75
+ columnPath: MatrixMemberPathSegment[];
76
+ };
77
+
78
+ declare type MatrixCellPresence = 'present' | 'presentNull' | 'missing' | 'densified';
79
+
80
+ declare type MatrixCellRole = 'value' | 'rowSubtotal' | 'columnSubtotal' | 'subtotalIntersection' | 'rowGrandTotal' | 'columnGrandTotal' | 'matrixGrandTotal';
81
+
82
+ declare type MatrixExecutionMetadata = {
83
+ strategy?: MatrixQueryStrategy;
84
+ dialect?: SemaphorDialect;
85
+ rowNodeCount?: number;
86
+ columnNodeCount?: number;
87
+ cellCount?: number;
88
+ groupingSetCount?: number;
89
+ queryDurationMs?: number;
90
+ budgetRejected?: boolean;
91
+ cacheStatus?: 'hit' | 'miss' | 'bypass';
92
+ [key: string]: unknown;
93
+ };
94
+
95
+ declare type MatrixExpansionRequest = {
96
+ axis: 'row' | 'column';
97
+ path: MatrixMemberPathSegment[];
98
+ depth?: number;
99
+ };
100
+
101
+ declare type MatrixExpansionResponseHints = {
102
+ rowLazyLoading?: boolean;
103
+ columnLazyLoading?: boolean;
104
+ expandableRowNodeIds?: string[];
105
+ expandableColumnNodeIds?: string[];
106
+ nextRequests?: MatrixExpansionRequest[];
107
+ };
108
+
109
+ declare type MatrixFieldDescriptor = {
110
+ instanceId: string;
111
+ fieldKey: string;
112
+ field: SemaphorFieldRef;
113
+ role: 'row' | 'column' | 'measure' | 'sort' | 'filter';
114
+ label?: string;
115
+ };
116
+
117
+ declare type MatrixFieldDirectory = {
118
+ fieldsByInstanceId: Record<string, MatrixFieldDescriptor>;
119
+ };
120
+
121
+ declare type MatrixFormattingContext = {
122
+ domains?: Record<string, {
123
+ min?: number;
124
+ max?: number;
125
+ }>;
126
+ rules?: Array<Record<string, unknown>>;
127
+ };
128
+
129
+ declare type MatrixGridCell = {
130
+ id: string;
131
+ columnId: string;
132
+ cellId?: string;
133
+ rawValue: unknown;
134
+ formattedValue?: string;
135
+ presence: MatrixCellPresence;
136
+ role: MatrixCellRole;
137
+ measureInstanceId: string;
138
+ rowPath: MatrixMemberPathSegment[];
139
+ columnPath: MatrixMemberPathSegment[];
140
+ };
141
+
142
+ declare type MatrixGridColumn = {
143
+ id: string;
144
+ label: string;
145
+ columnNodeId?: string;
146
+ columnPath: MatrixMemberPathSegment[];
147
+ measureInstanceId: string;
148
+ role: 'value' | 'columnSubtotal' | 'columnGrandTotal';
149
+ };
150
+
151
+ declare type MatrixGridHeaderCell = {
152
+ id: string;
153
+ label: string;
154
+ role: 'rowHeader' | 'columnHeader' | 'measureHeader' | 'subtotal' | 'grandTotal';
155
+ colSpan: number;
156
+ rowSpan: number;
157
+ columnPath: MatrixMemberPathSegment[];
158
+ measureInstanceId?: string;
159
+ };
160
+
161
+ declare type MatrixGridHeaderRow = {
162
+ id: string;
163
+ cells: MatrixGridHeaderCell[];
164
+ };
165
+
166
+ declare type MatrixGridProjection = {
167
+ schemaVersion: 1;
168
+ shape: MatrixShape;
169
+ rowHeaderLevels: MatrixGridRowHeaderLevel[];
170
+ columnHeaderRows: MatrixGridHeaderRow[];
171
+ columns: MatrixGridColumn[];
172
+ rows: MatrixGridRow[];
173
+ };
174
+
175
+ declare type MatrixGridRow = {
176
+ id: string;
177
+ rowNodeId: string;
178
+ rowPath: MatrixMemberPathSegment[];
179
+ depth: number;
180
+ label: string;
181
+ role: 'value' | 'rowSubtotal' | 'rowGrandTotal';
182
+ isExpanded?: boolean;
183
+ hasChildren?: boolean;
184
+ cells: MatrixGridCell[];
185
+ };
186
+
187
+ declare type MatrixGridRowHeaderLevel = {
188
+ id: string;
189
+ label: string;
190
+ fieldInstanceId: string;
191
+ };
192
+
193
+ declare type MatrixMeasureDescriptor = {
194
+ instanceId: string;
195
+ fieldKey: string;
196
+ label: string;
197
+ field: SemaphorFieldRef;
198
+ aggregate?: SemaphorAggregateFunction;
199
+ totalBehavior?: SemaphorMatrixTotalCalculation;
200
+ };
201
+
202
+ declare type MatrixMeasureSemantics = {
203
+ kind: 'additive';
204
+ aggregate?: SemaphorAggregateFunction;
205
+ } | {
206
+ kind: 'semiAdditive';
207
+ aggregate?: SemaphorAggregateFunction;
208
+ grain?: SemaphorTimeGrain;
209
+ } | {
210
+ kind: 'nonAdditive';
211
+ aggregate?: SemaphorAggregateFunction;
212
+ } | {
213
+ kind: 'ratio';
214
+ numeratorMeasureInstanceId?: string;
215
+ denominatorMeasureInstanceId?: string;
216
+ } | {
217
+ kind: 'custom';
218
+ expressionId?: string;
219
+ };
220
+
221
+ declare type MatrixMemberPathSegment = {
222
+ instanceId: string;
223
+ fieldKey: string;
224
+ value: unknown;
225
+ label: string;
226
+ };
227
+
228
+ declare type MatrixNode = {
229
+ id: string;
230
+ axis: 'row' | 'column';
231
+ path: MatrixMemberPathSegment[];
232
+ level: number;
233
+ label: string;
234
+ value: unknown;
235
+ parentId?: string;
236
+ hasChildren: boolean;
237
+ isExpanded?: boolean;
238
+ isSubtotal?: boolean;
239
+ isGrandTotal?: boolean;
240
+ subtotalFunction?: SemaphorAggregateFunction;
241
+ childCount?: number;
242
+ actions?: MatrixNodeAction[];
243
+ };
244
+
245
+ declare type MatrixNodeAction = {
246
+ kind: 'expand' | 'collapse' | 'requestSubgoal' | 'filter' | 'drillThrough' | 'openRelatedRecords' | (string & {});
247
+ label?: string;
248
+ payload?: Record<string, unknown>;
249
+ };
250
+
251
+ declare type MatrixPageInfo = {
252
+ rowOffset?: number;
253
+ rowLimit?: number;
254
+ columnOffset?: number;
255
+ columnLimit?: number;
256
+ hasMoreRows?: boolean;
257
+ hasMoreColumns?: boolean;
258
+ };
259
+
260
+ declare type MatrixPayload = {
261
+ kind: 'matrixPayload';
262
+ schemaVersion: 1;
263
+ shape: MatrixShape;
264
+ capabilities: MatrixCapability[];
265
+ executionMetadata: MatrixExecutionMetadata;
266
+ axes: {
267
+ rows: MatrixAxisPayload;
268
+ columns: MatrixAxisPayload;
269
+ };
270
+ measures: MatrixMeasureDescriptor[];
271
+ measureSemantics: Record<string, MatrixMeasureSemantics>;
272
+ fieldDirectory: MatrixFieldDirectory;
273
+ rowNodes: MatrixNode[];
274
+ columnNodes: MatrixNode[];
275
+ cells: MatrixCell[];
276
+ totals: MatrixTotals;
277
+ sort: MatrixResolvedSort[];
278
+ formattingContext: MatrixFormattingContext;
279
+ pageInfo?: MatrixPageInfo;
280
+ warnings?: MatrixWarning[];
281
+ };
282
+
283
+ declare type MatrixQueryStrategy = 'tall' | 'wide' | 'lazy' | 'export';
284
+
285
+ declare type MatrixResolvedSort = {
286
+ id: string;
287
+ axis: 'row' | 'column';
288
+ targetInstanceId?: string;
289
+ direction: 'asc' | 'desc';
290
+ nulls?: 'warehouseDefault' | 'first' | 'last';
291
+ scope?: 'global' | 'withinParent';
292
+ by: SemaphorMatrixSortRule['by'];
293
+ };
294
+
295
+ declare type MatrixShape = 'hierarchical' | 'pivot';
296
+
297
+ declare type MatrixTotals = {
298
+ rows?: boolean;
299
+ columns?: boolean;
300
+ grandTotal?: boolean | {
301
+ rows?: boolean;
302
+ columns?: boolean;
303
+ };
304
+ };
305
+
306
+ declare type MatrixWarning = {
307
+ code: string;
308
+ message: string;
309
+ path?: string;
310
+ severity?: 'info' | 'warning' | 'error';
311
+ };
312
+
30
313
  export declare function normalizeSemaphorAnalysisQueryOptions(value: unknown, options?: {
31
314
  pathPrefix?: string;
32
315
  validateTimezone?: SemaphorAnalysisTimezoneValidator;
@@ -128,7 +411,7 @@ declare type SemaphorAnalyticsFilterBase = {
128
411
 
129
412
  declare type SemaphorAnalyticsFilterOperator = SemaphorInputOperator | 'not_contains' | 'is_null' | 'is_not_null';
130
413
 
131
- declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
414
+ declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent | SemaphorMatrixIntent;
132
415
 
133
416
  declare type SemaphorAnalyticsNullFilter = SemaphorAnalyticsFilterBase & {
134
417
  operator: SemaphorAnalyticsNullFilterOperator;
@@ -153,7 +436,7 @@ declare type SemaphorAnalyticsRepairHint = {
153
436
  recommendedNextStep: string;
154
437
  };
155
438
 
156
- declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult;
439
+ declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult | SemaphorMatrixResult;
157
440
 
158
441
  declare type SemaphorAnalyticsResultBase = {
159
442
  intentId?: string;
@@ -268,6 +551,14 @@ declare type SemaphorExecutionFieldRef = SemaphorFieldRef & {
268
551
  aggregateSource?: SemaphorMetricAggregateSource;
269
552
  };
270
553
 
554
+ /**
555
+ * Explorer-backed table source. This is intentionally distinct from raw SQL:
556
+ * matrix planning needs stable source metadata, fields, and dialect context.
557
+ */
558
+ declare type SemaphorExplorerSourceRef = Extract<SemaphorSourceRef, {
559
+ kind: 'physical';
560
+ }>;
561
+
271
562
  declare type SemaphorFieldRef = {
272
563
  name: string;
273
564
  label?: string;
@@ -368,6 +659,178 @@ declare type SemaphorInputSpec<TValue extends SemaphorInputValue = SemaphorInput
368
659
 
369
660
  declare type SemaphorInputValue = SemaphorScalar | SemaphorScalar[];
370
661
 
662
+ declare type SemaphorMatrixAxisExpansionOptions = {
663
+ defaultDepth?: number;
664
+ lazy?: boolean;
665
+ expandedPaths?: SemaphorMatrixMemberPathSegment[][];
666
+ };
667
+
668
+ declare type SemaphorMatrixAxisLevel = {
669
+ id?: string;
670
+ field: SemaphorFieldRef;
671
+ grain?: SemaphorTimeGrain;
672
+ label?: string;
673
+ subtotal?: boolean | SemaphorMatrixSubtotalOptions;
674
+ sortBy?: SemaphorMatrixAxisSortRule;
675
+ };
676
+
677
+ declare type SemaphorMatrixAxisLevelInput = SemaphorQueryField | SemaphorMatrixAxisLevel;
678
+
679
+ declare type SemaphorMatrixAxisSortRule = {
680
+ direction: 'asc' | 'desc';
681
+ by: {
682
+ kind: 'label';
683
+ } | {
684
+ kind: 'field';
685
+ field: SemaphorFieldRef;
686
+ aggregate?: SemaphorAggregateFunction;
687
+ };
688
+ nulls?: 'warehouseDefault' | 'first' | 'last';
689
+ scope?: 'global' | 'withinParent';
690
+ };
691
+
692
+ declare type SemaphorMatrixDisplayLimitOptions = {
693
+ rows?: SemaphorMatrixDisplayLimitRule;
694
+ columns?: SemaphorMatrixDisplayLimitRule;
695
+ };
696
+
697
+ declare type SemaphorMatrixDisplayLimitRule = {
698
+ limit: number;
699
+ by?: 'label' | 'value';
700
+ direction?: 'top' | 'bottom';
701
+ others?: boolean | {
702
+ label?: string;
703
+ };
704
+ };
705
+
706
+ declare type SemaphorMatrixExpansionOptions = {
707
+ rows?: SemaphorMatrixAxisExpansionOptions;
708
+ columns?: SemaphorMatrixAxisExpansionOptions;
709
+ };
710
+
711
+ declare type SemaphorMatrixIntent = {
712
+ kind: 'matrix';
713
+ version?: SemaphorProtocolVersion;
714
+ id?: string;
715
+ label?: string;
716
+ source: SemaphorMatrixSourceRef;
717
+ rows: SemaphorMatrixAxisLevel[];
718
+ columns?: SemaphorMatrixAxisLevel[];
719
+ values: SemaphorMatrixValueField[];
720
+ filters?: SemaphorAnalyticsFilter[];
721
+ inputs?: SemaphorInputBinding[];
722
+ totals?: SemaphorMatrixTotalOptions;
723
+ sort?: SemaphorMatrixSortRule[];
724
+ expansion?: SemaphorMatrixExpansionOptions;
725
+ layout?: SemaphorMatrixLayoutOptions;
726
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
727
+ };
728
+
729
+ declare type SemaphorMatrixLayoutOptions = {
730
+ hierarchy?: 'compact' | 'tabular' | 'outline';
731
+ valuesPlacement?: 'columns' | 'rows';
732
+ stickyRowHeaders?: boolean;
733
+ stickyColumnHeaders?: boolean;
734
+ };
735
+
736
+ declare type SemaphorMatrixMemberPathSegment = {
737
+ levelId: string;
738
+ value: unknown;
739
+ };
740
+
741
+ declare type SemaphorMatrixQueryDefinition = SemaphorMatrixQuerySpec & {
742
+ queryKind: 'matrix';
743
+ };
744
+
745
+ declare type SemaphorMatrixQuerySpec = Omit<SemaphorMatrixIntent, 'kind' | 'version' | 'rows' | 'columns' | 'values' | 'source' | 'inputs'> & {
746
+ source: SemaphorMatrixSourceRef;
747
+ rows: SemaphorNonEmptyArray<SemaphorMatrixAxisLevelInput>;
748
+ columns?: SemaphorMatrixAxisLevelInput[];
749
+ values: SemaphorNonEmptyArray<SemaphorMatrixValueFieldInput>;
750
+ inputs?: SemaphorInputReference[];
751
+ totals?: SemaphorMatrixTotalOptions;
752
+ sort?: SemaphorMatrixSortRule[];
753
+ expansion?: SemaphorMatrixExpansionOptions;
754
+ layout?: SemaphorMatrixIntent['layout'];
755
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
756
+ };
757
+
758
+ declare type SemaphorMatrixResult = SemaphorAnalyticsResultBase & {
759
+ kind: 'matrix';
760
+ intent: SemaphorMatrixIntent;
761
+ payload: MatrixPayload;
762
+ grid: MatrixGridProjection;
763
+ expansion?: MatrixExpansionResponseHints;
764
+ };
765
+
766
+ declare type SemaphorMatrixSortRule = {
767
+ axis: 'row' | 'column';
768
+ targetId?: string;
769
+ direction: 'asc' | 'desc';
770
+ by: {
771
+ kind: 'label';
772
+ } | {
773
+ kind: 'field';
774
+ field: SemaphorFieldRef;
775
+ aggregate?: SemaphorAggregateFunction;
776
+ } | {
777
+ kind: 'value';
778
+ valueId: string;
779
+ rowPath?: SemaphorMatrixMemberPathSegment[];
780
+ columnPath?: SemaphorMatrixMemberPathSegment[];
781
+ };
782
+ nulls?: 'warehouseDefault' | 'first' | 'last';
783
+ scope?: 'global' | 'withinParent';
784
+ };
785
+
786
+ declare type SemaphorMatrixSourceRef = SemaphorSemanticSourceRef | SemaphorExplorerSourceRef;
787
+
788
+ declare type SemaphorMatrixSubtotalOptions = {
789
+ enabled?: boolean;
790
+ position?: 'before' | 'after';
791
+ label?: string;
792
+ };
793
+
794
+ declare type SemaphorMatrixTotalCalculation = {
795
+ kind: 'defaultAggregate';
796
+ } | {
797
+ kind: 'blank';
798
+ } | {
799
+ kind: 'labelOnly';
800
+ label?: string;
801
+ } | {
802
+ kind: 'customAggregate';
803
+ aggregate: SemaphorAggregateFunction;
804
+ } | {
805
+ kind: 'percentOfParent';
806
+ } | {
807
+ kind: 'percentOfGrandTotal';
808
+ } | {
809
+ kind: 'customExpression';
810
+ expressionId: string;
811
+ };
812
+
813
+ declare type SemaphorMatrixTotalOptions = {
814
+ rows?: boolean | 'perLevel';
815
+ columns?: boolean | 'perLevel';
816
+ grandTotal?: boolean | {
817
+ rows?: boolean;
818
+ columns?: boolean;
819
+ };
820
+ rowPosition?: 'top' | 'bottom';
821
+ columnPosition?: 'left' | 'right';
822
+ };
823
+
824
+ declare type SemaphorMatrixValueField = {
825
+ id?: string;
826
+ field: SemaphorFieldRef;
827
+ aggregate?: SemaphorAggregateFunction;
828
+ label?: string;
829
+ totalBehavior?: SemaphorMatrixTotalCalculation;
830
+ };
831
+
832
+ declare type SemaphorMatrixValueFieldInput = SemaphorQueryField | SemaphorMatrixValueField;
833
+
371
834
  declare type SemaphorMetricAggregateSource = 'semantic_model' | 'caller_override' | 'default_sum';
372
835
 
373
836
  declare type SemaphorMetricAnalysis = {
@@ -463,7 +926,7 @@ declare type SemaphorProtocolIssue = {
463
926
 
464
927
  declare type SemaphorProtocolVersion = 1;
465
928
 
466
- declare type SemaphorQueryDefinition = SemaphorMetricQueryDefinition | SemaphorAnalysisQueryDefinition | SemaphorRecordsQueryDefinition | SemaphorInputOptionsQueryDefinition | SemaphorSqlQueryDefinition;
929
+ declare type SemaphorQueryDefinition = SemaphorMetricQueryDefinition | SemaphorAnalysisQueryDefinition | SemaphorRecordsQueryDefinition | SemaphorInputOptionsQueryDefinition | SemaphorSqlQueryDefinition | SemaphorMatrixQueryDefinition;
467
930
 
468
931
  declare type SemaphorQueryField = SemaphorFieldRef;
469
932
 
@@ -584,6 +1047,10 @@ declare type SemaphorResultColumn = {
584
1047
 
585
1048
  declare type SemaphorScalar = string | number | boolean | null;
586
1049
 
1050
+ declare type SemaphorSemanticSourceRef = Extract<SemaphorSourceRef, {
1051
+ kind: 'semantic';
1052
+ }>;
1053
+
587
1054
  declare type SemaphorSourceRef = {
588
1055
  kind: 'semantic';
589
1056
  domainId: string;