react-semaphor 0.1.369 → 0.1.371

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.
Files changed (53) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +40 -38
  3. package/dist/chunks/{calendar-preferences-dialog-6q51A6XC.js → calendar-preferences-dialog-ClBAkMmF.js} +1 -1
  4. package/dist/chunks/{calendar-preferences-dialog-CUGzkNcE.js → calendar-preferences-dialog-Dn6o2r2Y.js} +1 -1
  5. package/dist/chunks/{dashboard-briefing-launcher-BEZnvIla.js → dashboard-briefing-launcher-BO-kXtEd.js} +1 -1
  6. package/dist/chunks/{dashboard-briefing-launcher-ptERmNJr.js → dashboard-briefing-launcher-D3Xfc_26.js} +3 -3
  7. package/dist/chunks/{dashboard-controls-CqKC5oEk.js → dashboard-controls-B3sdy_Zx.js} +3 -3
  8. package/dist/chunks/{dashboard-controls-CGt6_hMf.js → dashboard-controls-DcXMFgGR.js} +1 -1
  9. package/dist/chunks/{dashboard-json-6SgPm_QW.js → dashboard-json-BWfkEy48.js} +1 -1
  10. package/dist/chunks/{dashboard-json-CYSbOdmE.js → dashboard-json-CFURS_OR.js} +1 -1
  11. package/dist/chunks/{edit-dashboard-visual-w6hKbjlw.js → edit-dashboard-visual-BD2AJLiT.js} +1 -1
  12. package/dist/chunks/{edit-dashboard-visual-ByQx_M2i.js → edit-dashboard-visual-DjdhKiP2.js} +3 -3
  13. package/dist/chunks/{index-CPyEi9gS.js → index-C0Qnfr_7.js} +5 -4
  14. package/dist/chunks/{index-BtqYNH_S.js → index-DlLvzmJF.js} +2 -2
  15. package/dist/chunks/{resource-management-panel-Bf8-3eUf.js → resource-management-panel-DytUMSGA.js} +1 -1
  16. package/dist/chunks/{resource-management-panel-mJ84NxzC.js → resource-management-panel-YvIfaphX.js} +2 -2
  17. package/dist/chunks/{use-create-flow-overlay-state-BfoXDDrd.js → use-create-flow-overlay-state-BETXykC9.js} +2 -2
  18. package/dist/chunks/{use-create-flow-overlay-state-c6rCm36x.js → use-create-flow-overlay-state-CwIG1Ekp.js} +1 -1
  19. package/dist/chunks/{use-visual-utils-NN0e3fBP.js → use-visual-utils-Bk135OgA.js} +1 -1
  20. package/dist/chunks/{use-visual-utils-C_c-aiqi.js → use-visual-utils-BzFjIykb.js} +1 -1
  21. package/dist/chunks/{validation-nOPr0mTk.js → validation-CQFpcSSP.js} +446 -246
  22. package/dist/chunks/validation-D4Zz6WPD.js +1 -0
  23. package/dist/chunks/validators-CuKnUZFO.js +2171 -0
  24. package/dist/chunks/validators-DHee9kM2.js +1 -0
  25. package/dist/dashboard/index.cjs +1 -1
  26. package/dist/dashboard/index.js +1 -1
  27. package/dist/dashboard-authoring/index.cjs +1 -1
  28. package/dist/dashboard-authoring/index.js +1 -1
  29. package/dist/data-app-builder/index.cjs +1 -1
  30. package/dist/data-app-builder/index.js +1 -1
  31. package/dist/data-app-sdk/index.cjs +1 -1
  32. package/dist/data-app-sdk/index.js +261 -183
  33. package/dist/data-app-sdk-validation/index.cjs +1 -1
  34. package/dist/data-app-sdk-validation/index.js +4 -3
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.js +5 -5
  37. package/dist/surfboard/index.cjs +1 -1
  38. package/dist/surfboard/index.js +2 -2
  39. package/dist/types/analytics-protocol.d.ts +542 -2
  40. package/dist/types/dashboard-assistant.d.ts +508 -4
  41. package/dist/types/dashboard-authoring.d.ts +217 -3
  42. package/dist/types/dashboard.d.ts +67 -2
  43. package/dist/types/data-app-builder.d.ts +197 -1
  44. package/dist/types/data-app-sdk-validation.d.ts +520 -6
  45. package/dist/types/data-app-sdk.d.ts +543 -8
  46. package/dist/types/main.d.ts +215 -3
  47. package/dist/types/shared.d.ts +66 -2
  48. package/dist/types/surfboard.d.ts +67 -2
  49. package/dist/types/types.d.ts +67 -2
  50. package/package.json +1 -1
  51. package/dist/chunks/validation-Dsf7PydY.js +0 -1
  52. package/dist/chunks/validators-CVuWOHYv.js +0 -1032
  53. package/dist/chunks/validators-oc8qtP4q.js +0 -1
@@ -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;
@@ -187,6 +470,10 @@ declare type SemaphorAnalyticsValueFilter = SemaphorAnalyticsFilterBase & {
187
470
 
188
471
  declare type SemaphorAnalyticsValueFilterOperator = Exclude<SemaphorAnalyticsFilterOperator, 'is_null' | 'is_not_null'>;
189
472
 
473
+ declare type SemaphorAppDerivedFieldsSpec = {
474
+ derivedFields?: SemaphorDerivedFieldDefinition[];
475
+ };
476
+
190
477
  declare type SemaphorCompiledQuery = {
191
478
  kind: 'config';
192
479
  queryId: string;
@@ -260,14 +547,61 @@ export declare type SemaphorDataAppValidationResult = {
260
547
  executionResults: SemaphorAnalyticsExecutionResult[];
261
548
  };
262
549
 
550
+ declare type SemaphorDerivedFieldAggregationBehavior = 'additive' | 'non_additive' | 'ratio_of_sums' | 'weighted' | 'pre_aggregated' | 'snapshot';
551
+
552
+ declare type SemaphorDerivedFieldAggregationStrategy = 'default' | 'symmetric_aggregate' | 'aggregate_then_join' | 'weighted';
553
+
554
+ declare type SemaphorDerivedFieldComputeStage = 'row' | 'aggregate';
555
+
556
+ declare type SemaphorDerivedFieldDefinition = {
557
+ kind: 'derived_field';
558
+ name: string;
559
+ label: string;
560
+ description?: string;
561
+ resultRole: SemaphorDerivedFieldResultRole;
562
+ dataType: NonNullable<SemaphorFieldRef['dataType']>;
563
+ computeStage: SemaphorDerivedFieldComputeStage;
564
+ expression: string;
565
+ expressionLanguage?: 'semaphor_sql_template';
566
+ inputs: Record<string, SemaphorDerivedFieldInput>;
567
+ defaultAggregate?: SemaphorAggregateFunction;
568
+ aggregationBehavior?: SemaphorDerivedFieldAggregationBehavior;
569
+ aggregationStrategy?: SemaphorDerivedFieldAggregationStrategy;
570
+ format?: unknown;
571
+ tags?: string[];
572
+ };
573
+
574
+ declare type SemaphorDerivedFieldInput = {
575
+ kind: 'field';
576
+ field: SemaphorFieldRef;
577
+ aggregate?: SemaphorAggregateFunction;
578
+ } | {
579
+ kind: 'metric';
580
+ metric: SemaphorFieldRef;
581
+ } | {
582
+ kind: 'dimension';
583
+ dimension: SemaphorFieldRef;
584
+ };
585
+
586
+ declare type SemaphorDerivedFieldResultRole = 'measure' | 'group' | 'date' | 'id' | 'filter';
587
+
263
588
  declare type SemaphorDialect = 'postgres' | 'mysql' | 'mssql' | 'snowflake' | 'clickhouse' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
264
589
 
265
590
  declare type SemaphorExecutionFieldRef = SemaphorFieldRef & {
266
591
  semanticAggregate?: SemaphorAggregateFunction;
267
592
  effectiveAggregate?: SemaphorAggregateFunction;
268
593
  aggregateSource?: SemaphorMetricAggregateSource;
594
+ derivedField?: SemaphorDerivedFieldDefinition;
269
595
  };
270
596
 
597
+ /**
598
+ * Explorer-backed table source. This is intentionally distinct from raw SQL:
599
+ * matrix planning needs stable source metadata, fields, and dialect context.
600
+ */
601
+ declare type SemaphorExplorerSourceRef = Extract<SemaphorSourceRef, {
602
+ kind: 'physical';
603
+ }>;
604
+
271
605
  declare type SemaphorFieldRef = {
272
606
  name: string;
273
607
  label?: string;
@@ -339,13 +673,14 @@ declare type SemaphorInputOptionsIntent = {
339
673
  field: SemaphorFieldRef;
340
674
  search?: string;
341
675
  limit?: number;
676
+ derivedFields?: SemaphorDerivedFieldDefinition[];
342
677
  };
343
678
 
344
679
  declare type SemaphorInputOptionsQueryDefinition = SemaphorInputOptionsQuerySpec & {
345
680
  queryKind: 'inputOptions';
346
681
  };
347
682
 
348
- declare type SemaphorInputOptionsQuerySpec = SemaphorQuerySourceSpec & {
683
+ declare type SemaphorInputOptionsQuerySpec = SemaphorQuerySourceSpec & SemaphorAppDerivedFieldsSpec & {
349
684
  id?: string;
350
685
  label?: string;
351
686
  field: SemaphorQueryField;
@@ -368,6 +703,178 @@ declare type SemaphorInputSpec<TValue extends SemaphorInputValue = SemaphorInput
368
703
 
369
704
  declare type SemaphorInputValue = SemaphorScalar | SemaphorScalar[];
370
705
 
706
+ declare type SemaphorMatrixAxisExpansionOptions = {
707
+ defaultDepth?: number;
708
+ lazy?: boolean;
709
+ expandedPaths?: SemaphorMatrixMemberPathSegment[][];
710
+ };
711
+
712
+ declare type SemaphorMatrixAxisLevel = {
713
+ id?: string;
714
+ field: SemaphorFieldRef;
715
+ grain?: SemaphorTimeGrain;
716
+ label?: string;
717
+ subtotal?: boolean | SemaphorMatrixSubtotalOptions;
718
+ sortBy?: SemaphorMatrixAxisSortRule;
719
+ };
720
+
721
+ declare type SemaphorMatrixAxisLevelInput = SemaphorQueryField | SemaphorMatrixAxisLevel;
722
+
723
+ declare type SemaphorMatrixAxisSortRule = {
724
+ direction: 'asc' | 'desc';
725
+ by: {
726
+ kind: 'label';
727
+ } | {
728
+ kind: 'field';
729
+ field: SemaphorFieldRef;
730
+ aggregate?: SemaphorAggregateFunction;
731
+ };
732
+ nulls?: 'warehouseDefault' | 'first' | 'last';
733
+ scope?: 'global' | 'withinParent';
734
+ };
735
+
736
+ declare type SemaphorMatrixDisplayLimitOptions = {
737
+ rows?: SemaphorMatrixDisplayLimitRule;
738
+ columns?: SemaphorMatrixDisplayLimitRule;
739
+ };
740
+
741
+ declare type SemaphorMatrixDisplayLimitRule = {
742
+ limit: number;
743
+ by?: 'label' | 'value';
744
+ direction?: 'top' | 'bottom';
745
+ others?: boolean | {
746
+ label?: string;
747
+ };
748
+ };
749
+
750
+ declare type SemaphorMatrixExpansionOptions = {
751
+ rows?: SemaphorMatrixAxisExpansionOptions;
752
+ columns?: SemaphorMatrixAxisExpansionOptions;
753
+ };
754
+
755
+ declare type SemaphorMatrixIntent = {
756
+ kind: 'matrix';
757
+ version?: SemaphorProtocolVersion;
758
+ id?: string;
759
+ label?: string;
760
+ source: SemaphorMatrixSourceRef;
761
+ rows: SemaphorMatrixAxisLevel[];
762
+ columns?: SemaphorMatrixAxisLevel[];
763
+ values: SemaphorMatrixValueField[];
764
+ filters?: SemaphorAnalyticsFilter[];
765
+ inputs?: SemaphorInputBinding[];
766
+ totals?: SemaphorMatrixTotalOptions;
767
+ sort?: SemaphorMatrixSortRule[];
768
+ expansion?: SemaphorMatrixExpansionOptions;
769
+ layout?: SemaphorMatrixLayoutOptions;
770
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
771
+ };
772
+
773
+ declare type SemaphorMatrixLayoutOptions = {
774
+ hierarchy?: 'compact' | 'tabular' | 'outline';
775
+ valuesPlacement?: 'columns' | 'rows';
776
+ stickyRowHeaders?: boolean;
777
+ stickyColumnHeaders?: boolean;
778
+ };
779
+
780
+ declare type SemaphorMatrixMemberPathSegment = {
781
+ levelId: string;
782
+ value: unknown;
783
+ };
784
+
785
+ declare type SemaphorMatrixQueryDefinition = SemaphorMatrixQuerySpec & {
786
+ queryKind: 'matrix';
787
+ };
788
+
789
+ declare type SemaphorMatrixQuerySpec = Omit<SemaphorMatrixIntent, 'kind' | 'version' | 'rows' | 'columns' | 'values' | 'source' | 'inputs'> & {
790
+ source: SemaphorMatrixSourceRef;
791
+ rows: SemaphorNonEmptyArray<SemaphorMatrixAxisLevelInput>;
792
+ columns?: SemaphorMatrixAxisLevelInput[];
793
+ values: SemaphorNonEmptyArray<SemaphorMatrixValueFieldInput>;
794
+ inputs?: SemaphorInputReference[];
795
+ totals?: SemaphorMatrixTotalOptions;
796
+ sort?: SemaphorMatrixSortRule[];
797
+ expansion?: SemaphorMatrixExpansionOptions;
798
+ layout?: SemaphorMatrixIntent['layout'];
799
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
800
+ };
801
+
802
+ declare type SemaphorMatrixResult = SemaphorAnalyticsResultBase & {
803
+ kind: 'matrix';
804
+ intent: SemaphorMatrixIntent;
805
+ payload: MatrixPayload;
806
+ grid: MatrixGridProjection;
807
+ expansion?: MatrixExpansionResponseHints;
808
+ };
809
+
810
+ declare type SemaphorMatrixSortRule = {
811
+ axis: 'row' | 'column';
812
+ targetId?: string;
813
+ direction: 'asc' | 'desc';
814
+ by: {
815
+ kind: 'label';
816
+ } | {
817
+ kind: 'field';
818
+ field: SemaphorFieldRef;
819
+ aggregate?: SemaphorAggregateFunction;
820
+ } | {
821
+ kind: 'value';
822
+ valueId: string;
823
+ rowPath?: SemaphorMatrixMemberPathSegment[];
824
+ columnPath?: SemaphorMatrixMemberPathSegment[];
825
+ };
826
+ nulls?: 'warehouseDefault' | 'first' | 'last';
827
+ scope?: 'global' | 'withinParent';
828
+ };
829
+
830
+ declare type SemaphorMatrixSourceRef = SemaphorSemanticSourceRef | SemaphorExplorerSourceRef;
831
+
832
+ declare type SemaphorMatrixSubtotalOptions = {
833
+ enabled?: boolean;
834
+ position?: 'before' | 'after';
835
+ label?: string;
836
+ };
837
+
838
+ declare type SemaphorMatrixTotalCalculation = {
839
+ kind: 'defaultAggregate';
840
+ } | {
841
+ kind: 'blank';
842
+ } | {
843
+ kind: 'labelOnly';
844
+ label?: string;
845
+ } | {
846
+ kind: 'customAggregate';
847
+ aggregate: SemaphorAggregateFunction;
848
+ } | {
849
+ kind: 'percentOfParent';
850
+ } | {
851
+ kind: 'percentOfGrandTotal';
852
+ } | {
853
+ kind: 'customExpression';
854
+ expressionId: string;
855
+ };
856
+
857
+ declare type SemaphorMatrixTotalOptions = {
858
+ rows?: boolean | 'perLevel';
859
+ columns?: boolean | 'perLevel';
860
+ grandTotal?: boolean | {
861
+ rows?: boolean;
862
+ columns?: boolean;
863
+ };
864
+ rowPosition?: 'top' | 'bottom';
865
+ columnPosition?: 'left' | 'right';
866
+ };
867
+
868
+ declare type SemaphorMatrixValueField = {
869
+ id?: string;
870
+ field: SemaphorFieldRef;
871
+ aggregate?: SemaphorAggregateFunction;
872
+ label?: string;
873
+ totalBehavior?: SemaphorMatrixTotalCalculation;
874
+ };
875
+
876
+ declare type SemaphorMatrixValueFieldInput = SemaphorQueryField | SemaphorMatrixValueField;
877
+
371
878
  declare type SemaphorMetricAggregateSource = 'semantic_model' | 'caller_override' | 'default_sum';
372
879
 
373
880
  declare type SemaphorMetricAnalysis = {
@@ -406,13 +913,14 @@ declare type SemaphorMetricIntent = {
406
913
  };
407
914
  inputs?: SemaphorInputBinding[];
408
915
  limit?: number;
916
+ derivedFields?: SemaphorDerivedFieldDefinition[];
409
917
  };
410
918
 
411
919
  declare type SemaphorMetricQueryDefinition = SemaphorMetricQuerySpec & {
412
920
  queryKind: 'metric';
413
921
  };
414
922
 
415
- declare type SemaphorMetricQuerySpec = SemaphorQuerySourceSpec & {
923
+ declare type SemaphorMetricQuerySpec = SemaphorQuerySourceSpec & SemaphorAppDerivedFieldsSpec & {
416
924
  id?: string;
417
925
  label?: string;
418
926
  metrics: SemaphorNonEmptyArray<SemaphorQueryField>;
@@ -463,7 +971,7 @@ declare type SemaphorProtocolIssue = {
463
971
 
464
972
  declare type SemaphorProtocolVersion = 1;
465
973
 
466
- declare type SemaphorQueryDefinition = SemaphorMetricQueryDefinition | SemaphorAnalysisQueryDefinition | SemaphorRecordsQueryDefinition | SemaphorInputOptionsQueryDefinition | SemaphorSqlQueryDefinition;
974
+ declare type SemaphorQueryDefinition = SemaphorMetricQueryDefinition | SemaphorAnalysisQueryDefinition | SemaphorRecordsQueryDefinition | SemaphorInputOptionsQueryDefinition | SemaphorSqlQueryDefinition | SemaphorMatrixQueryDefinition;
467
975
 
468
976
  declare type SemaphorQueryField = SemaphorFieldRef;
469
977
 
@@ -478,7 +986,7 @@ declare type SemaphorQuerySourceSpec = {
478
986
  source: SemaphorSourceRef;
479
987
  };
480
988
 
481
- declare type SemaphorRecordsBaseQuerySpec = SemaphorQuerySourceSpec & {
989
+ declare type SemaphorRecordsBaseQuerySpec = SemaphorQuerySourceSpec & SemaphorAppDerivedFieldsSpec & {
482
990
  id?: string;
483
991
  label?: string;
484
992
  dateField?: SemaphorQueryField;
@@ -513,6 +1021,7 @@ declare type SemaphorRecordsIntent = {
513
1021
  direction: 'asc' | 'desc';
514
1022
  };
515
1023
  inputs?: SemaphorInputBinding[];
1024
+ derivedFields?: SemaphorDerivedFieldDefinition[];
516
1025
  };
517
1026
 
518
1027
  declare type SemaphorRecordsOrderBy = SemaphorQueryOrderBy;
@@ -580,10 +1089,15 @@ declare type SemaphorResultColumn = {
580
1089
  dataType?: SemaphorFieldRef['dataType'];
581
1090
  aggregate?: SemaphorFieldRef['aggregate'];
582
1091
  source?: SemaphorFieldRef['source'];
1092
+ derivedField?: SemaphorDerivedFieldDefinition;
583
1093
  };
584
1094
 
585
1095
  declare type SemaphorScalar = string | number | boolean | null;
586
1096
 
1097
+ declare type SemaphorSemanticSourceRef = Extract<SemaphorSourceRef, {
1098
+ kind: 'semantic';
1099
+ }>;
1100
+
587
1101
  declare type SemaphorSourceRef = {
588
1102
  kind: 'semantic';
589
1103
  domainId: string;