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
@@ -39,6 +39,289 @@ export declare function defineSemaphorInput<TValue extends SemaphorInputValue =
39
39
 
40
40
  export declare function hasSemaphorInputValue(value: unknown): boolean;
41
41
 
42
+ declare type MatrixAxisLevelDescriptor = {
43
+ instanceId: string;
44
+ fieldKey: string;
45
+ label: string;
46
+ field: SemaphorFieldRef;
47
+ grain?: SemaphorTimeGrain;
48
+ subtotal?: SemaphorMatrixSubtotalOptions;
49
+ };
50
+
51
+ declare type MatrixAxisPayload = {
52
+ id: 'rows' | 'columns';
53
+ levels: MatrixAxisLevelDescriptor[];
54
+ nodes: MatrixNode[];
55
+ };
56
+
57
+ declare type MatrixCapability = 'rowHierarchy' | 'columnHierarchy' | 'rowSubtotals' | 'columnSubtotals' | 'grandTotals' | 'lazyRows' | 'lazyColumns' | 'conditionalFormatting' | 'visualExport' | (string & {});
58
+
59
+ declare type MatrixCell = {
60
+ id: string;
61
+ rowNodeId: string;
62
+ columnNodeId?: string;
63
+ measureInstanceId: string;
64
+ rowPath: MatrixMemberPathSegment[];
65
+ columnPath: MatrixMemberPathSegment[];
66
+ rawValue: unknown;
67
+ presence: MatrixCellPresence;
68
+ formattedValue?: string;
69
+ role: MatrixCellRole;
70
+ aggregateFunction?: SemaphorAggregateFunction;
71
+ formattingScope: MatrixCellFormattingScope;
72
+ actions?: MatrixCellAction[];
73
+ };
74
+
75
+ declare type MatrixCellAction = {
76
+ kind: 'requestSubgoal' | 'filter' | 'copyValue' | 'explainCalculation' | 'inspectContributingRows' | 'drillThrough' | (string & {});
77
+ label?: string;
78
+ payload?: Record<string, unknown>;
79
+ };
80
+
81
+ declare type MatrixCellFormattingScope = {
82
+ rowNodeId: string;
83
+ columnNodeId?: string;
84
+ measureInstanceId: string;
85
+ role: MatrixCellRole;
86
+ rowPath: MatrixMemberPathSegment[];
87
+ columnPath: MatrixMemberPathSegment[];
88
+ };
89
+
90
+ declare type MatrixCellPresence = 'present' | 'presentNull' | 'missing' | 'densified';
91
+
92
+ declare type MatrixCellRole = 'value' | 'rowSubtotal' | 'columnSubtotal' | 'subtotalIntersection' | 'rowGrandTotal' | 'columnGrandTotal' | 'matrixGrandTotal';
93
+
94
+ declare type MatrixExecutionMetadata = {
95
+ strategy?: MatrixQueryStrategy;
96
+ dialect?: SemaphorDialect;
97
+ rowNodeCount?: number;
98
+ columnNodeCount?: number;
99
+ cellCount?: number;
100
+ groupingSetCount?: number;
101
+ queryDurationMs?: number;
102
+ budgetRejected?: boolean;
103
+ cacheStatus?: 'hit' | 'miss' | 'bypass';
104
+ [key: string]: unknown;
105
+ };
106
+
107
+ declare type MatrixExpansionRequest = {
108
+ axis: 'row' | 'column';
109
+ path: MatrixMemberPathSegment[];
110
+ depth?: number;
111
+ };
112
+
113
+ export declare type MatrixExpansionResponseHints = {
114
+ rowLazyLoading?: boolean;
115
+ columnLazyLoading?: boolean;
116
+ expandableRowNodeIds?: string[];
117
+ expandableColumnNodeIds?: string[];
118
+ nextRequests?: MatrixExpansionRequest[];
119
+ };
120
+
121
+ declare type MatrixFieldDescriptor = {
122
+ instanceId: string;
123
+ fieldKey: string;
124
+ field: SemaphorFieldRef;
125
+ role: 'row' | 'column' | 'measure' | 'sort' | 'filter';
126
+ label?: string;
127
+ };
128
+
129
+ declare type MatrixFieldDirectory = {
130
+ fieldsByInstanceId: Record<string, MatrixFieldDescriptor>;
131
+ };
132
+
133
+ declare type MatrixFormattingContext = {
134
+ domains?: Record<string, {
135
+ min?: number;
136
+ max?: number;
137
+ }>;
138
+ rules?: Array<Record<string, unknown>>;
139
+ };
140
+
141
+ declare type MatrixGridCell = {
142
+ id: string;
143
+ columnId: string;
144
+ cellId?: string;
145
+ rawValue: unknown;
146
+ formattedValue?: string;
147
+ presence: MatrixCellPresence;
148
+ role: MatrixCellRole;
149
+ measureInstanceId: string;
150
+ rowPath: MatrixMemberPathSegment[];
151
+ columnPath: MatrixMemberPathSegment[];
152
+ };
153
+
154
+ declare type MatrixGridColumn = {
155
+ id: string;
156
+ label: string;
157
+ columnNodeId?: string;
158
+ columnPath: MatrixMemberPathSegment[];
159
+ measureInstanceId: string;
160
+ role: 'value' | 'columnSubtotal' | 'columnGrandTotal';
161
+ };
162
+
163
+ declare type MatrixGridHeaderCell = {
164
+ id: string;
165
+ label: string;
166
+ role: 'rowHeader' | 'columnHeader' | 'measureHeader' | 'subtotal' | 'grandTotal';
167
+ colSpan: number;
168
+ rowSpan: number;
169
+ columnPath: MatrixMemberPathSegment[];
170
+ measureInstanceId?: string;
171
+ };
172
+
173
+ declare type MatrixGridHeaderRow = {
174
+ id: string;
175
+ cells: MatrixGridHeaderCell[];
176
+ };
177
+
178
+ export declare type MatrixGridProjection = {
179
+ schemaVersion: 1;
180
+ shape: MatrixShape;
181
+ rowHeaderLevels: MatrixGridRowHeaderLevel[];
182
+ columnHeaderRows: MatrixGridHeaderRow[];
183
+ columns: MatrixGridColumn[];
184
+ rows: MatrixGridRow[];
185
+ };
186
+
187
+ declare type MatrixGridRow = {
188
+ id: string;
189
+ rowNodeId: string;
190
+ rowPath: MatrixMemberPathSegment[];
191
+ depth: number;
192
+ label: string;
193
+ role: 'value' | 'rowSubtotal' | 'rowGrandTotal';
194
+ isExpanded?: boolean;
195
+ hasChildren?: boolean;
196
+ cells: MatrixGridCell[];
197
+ };
198
+
199
+ declare type MatrixGridRowHeaderLevel = {
200
+ id: string;
201
+ label: string;
202
+ fieldInstanceId: string;
203
+ };
204
+
205
+ declare type MatrixMeasureDescriptor = {
206
+ instanceId: string;
207
+ fieldKey: string;
208
+ label: string;
209
+ field: SemaphorFieldRef;
210
+ aggregate?: SemaphorAggregateFunction;
211
+ totalBehavior?: SemaphorMatrixTotalCalculation;
212
+ };
213
+
214
+ declare type MatrixMeasureSemantics = {
215
+ kind: 'additive';
216
+ aggregate?: SemaphorAggregateFunction;
217
+ } | {
218
+ kind: 'semiAdditive';
219
+ aggregate?: SemaphorAggregateFunction;
220
+ grain?: SemaphorTimeGrain;
221
+ } | {
222
+ kind: 'nonAdditive';
223
+ aggregate?: SemaphorAggregateFunction;
224
+ } | {
225
+ kind: 'ratio';
226
+ numeratorMeasureInstanceId?: string;
227
+ denominatorMeasureInstanceId?: string;
228
+ } | {
229
+ kind: 'custom';
230
+ expressionId?: string;
231
+ };
232
+
233
+ declare type MatrixMemberPathSegment = {
234
+ instanceId: string;
235
+ fieldKey: string;
236
+ value: unknown;
237
+ label: string;
238
+ };
239
+
240
+ declare type MatrixNode = {
241
+ id: string;
242
+ axis: 'row' | 'column';
243
+ path: MatrixMemberPathSegment[];
244
+ level: number;
245
+ label: string;
246
+ value: unknown;
247
+ parentId?: string;
248
+ hasChildren: boolean;
249
+ isExpanded?: boolean;
250
+ isSubtotal?: boolean;
251
+ isGrandTotal?: boolean;
252
+ subtotalFunction?: SemaphorAggregateFunction;
253
+ childCount?: number;
254
+ actions?: MatrixNodeAction[];
255
+ };
256
+
257
+ declare type MatrixNodeAction = {
258
+ kind: 'expand' | 'collapse' | 'requestSubgoal' | 'filter' | 'drillThrough' | 'openRelatedRecords' | (string & {});
259
+ label?: string;
260
+ payload?: Record<string, unknown>;
261
+ };
262
+
263
+ declare type MatrixPageInfo = {
264
+ rowOffset?: number;
265
+ rowLimit?: number;
266
+ columnOffset?: number;
267
+ columnLimit?: number;
268
+ hasMoreRows?: boolean;
269
+ hasMoreColumns?: boolean;
270
+ };
271
+
272
+ export declare type MatrixPayload = {
273
+ kind: 'matrixPayload';
274
+ schemaVersion: 1;
275
+ shape: MatrixShape;
276
+ capabilities: MatrixCapability[];
277
+ executionMetadata: MatrixExecutionMetadata;
278
+ axes: {
279
+ rows: MatrixAxisPayload;
280
+ columns: MatrixAxisPayload;
281
+ };
282
+ measures: MatrixMeasureDescriptor[];
283
+ measureSemantics: Record<string, MatrixMeasureSemantics>;
284
+ fieldDirectory: MatrixFieldDirectory;
285
+ rowNodes: MatrixNode[];
286
+ columnNodes: MatrixNode[];
287
+ cells: MatrixCell[];
288
+ totals: MatrixTotals;
289
+ sort: MatrixResolvedSort[];
290
+ formattingContext: MatrixFormattingContext;
291
+ pageInfo?: MatrixPageInfo;
292
+ warnings?: MatrixWarning[];
293
+ };
294
+
295
+ declare type MatrixQueryStrategy = 'tall' | 'wide' | 'lazy' | 'export';
296
+
297
+ declare type MatrixResolvedSort = {
298
+ id: string;
299
+ axis: 'row' | 'column';
300
+ targetInstanceId?: string;
301
+ direction: 'asc' | 'desc';
302
+ nulls?: 'warehouseDefault' | 'first' | 'last';
303
+ scope?: 'global' | 'withinParent';
304
+ by: SemaphorMatrixSortRule['by'];
305
+ };
306
+
307
+ declare type MatrixShape = 'hierarchical' | 'pivot';
308
+
309
+ declare type MatrixTotals = {
310
+ rows?: boolean;
311
+ columns?: boolean;
312
+ grandTotal?: boolean | {
313
+ rows?: boolean;
314
+ columns?: boolean;
315
+ };
316
+ };
317
+
318
+ declare type MatrixWarning = {
319
+ code: string;
320
+ message: string;
321
+ path?: string;
322
+ severity?: 'info' | 'warning' | 'error';
323
+ };
324
+
42
325
  export declare function normalizeSemaphorAnalysisPayload(payload: SemaphorAnalysisPayload | undefined | null): SemaphorAnalysisPayload;
43
326
 
44
327
  export declare function normalizeSemaphorAnalysisQueryOptions(value: unknown, options?: {
@@ -60,11 +343,15 @@ export declare const semaphor: {
60
343
  filter<TValue extends SemaphorInputValue = SemaphorInputValue>(spec: Omit<SemaphorFilterInputSpec<TValue>, "kind">): SemaphorFilterInputSpec<TValue>;
61
344
  control<TValue extends SemaphorInputValue = SemaphorInputValue>(spec: SemaphorControlBuilderSpec<TValue>): SemaphorControlInputSpec<TValue>;
62
345
  sqlParam<TValue extends SemaphorSqlParameterValue = SemaphorSqlParameterValue>(spec: SemaphorSqlParamInputSpec<TValue>): SemaphorControlInputSpec<TValue>;
346
+ derivedField(spec: Omit<SemaphorDerivedFieldDefinition, "kind"> & {
347
+ kind?: "derived_field";
348
+ }): SemaphorDerivedFieldDefinition;
63
349
  metric(spec: SemaphorMetricQuerySpec): SemaphorMetricQueryDefinition;
64
350
  analysis(spec: SemaphorAnalysisQuerySpec): SemaphorAnalysisQueryDefinition;
65
351
  records(spec: SemaphorRecordsQuerySpec): SemaphorRecordsQueryDefinition;
66
352
  inputOptions(spec: SemaphorInputOptionsQuerySpec): SemaphorInputOptionsQueryDefinition;
67
353
  sql(spec: SemaphorSqlQuerySpec): SemaphorSqlQueryDefinition;
354
+ matrix(spec: SemaphorMatrixQuerySpec): SemaphorMatrixQueryDefinition;
68
355
  };
69
356
 
70
357
  declare type SemaphorAbsoluteTimeWindow = {
@@ -197,7 +484,7 @@ declare type SemaphorAnalyticsFilterBase = {
197
484
 
198
485
  declare type SemaphorAnalyticsFilterOperator = SemaphorInputOperator | 'not_contains' | 'is_null' | 'is_not_null';
199
486
 
200
- declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
487
+ declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent | SemaphorMatrixIntent;
201
488
 
202
489
  declare type SemaphorAnalyticsNullFilter = SemaphorAnalyticsFilterBase & {
203
490
  operator: SemaphorAnalyticsNullFilterOperator;
@@ -222,7 +509,7 @@ declare type SemaphorAnalyticsRepairHint = {
222
509
  recommendedNextStep: string;
223
510
  };
224
511
 
225
- declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult;
512
+ declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult | SemaphorMatrixResult;
226
513
 
227
514
  declare type SemaphorAnalyticsResultBase = {
228
515
  intentId?: string;
@@ -258,6 +545,10 @@ declare type SemaphorAnalyticsValueFilterOperator = Exclude<SemaphorAnalyticsFil
258
545
 
259
546
  export declare type SemaphorAnyQueryResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorQueryResult<TRecord>;
260
547
 
548
+ export declare type SemaphorAppDerivedFieldsSpec = {
549
+ derivedFields?: SemaphorDerivedFieldDefinition[];
550
+ };
551
+
261
552
  declare type SemaphorCompiledQuery = {
262
553
  kind: 'config';
263
554
  queryId: string;
@@ -373,14 +664,61 @@ declare type SemaphorDataAppWindowRuntime = {
373
664
  };
374
665
  };
375
666
 
667
+ declare type SemaphorDerivedFieldAggregationBehavior = 'additive' | 'non_additive' | 'ratio_of_sums' | 'weighted' | 'pre_aggregated' | 'snapshot';
668
+
669
+ declare type SemaphorDerivedFieldAggregationStrategy = 'default' | 'symmetric_aggregate' | 'aggregate_then_join' | 'weighted';
670
+
671
+ declare type SemaphorDerivedFieldComputeStage = 'row' | 'aggregate';
672
+
673
+ export declare type SemaphorDerivedFieldDefinition = {
674
+ kind: 'derived_field';
675
+ name: string;
676
+ label: string;
677
+ description?: string;
678
+ resultRole: SemaphorDerivedFieldResultRole;
679
+ dataType: NonNullable<SemaphorFieldRef['dataType']>;
680
+ computeStage: SemaphorDerivedFieldComputeStage;
681
+ expression: string;
682
+ expressionLanguage?: 'semaphor_sql_template';
683
+ inputs: Record<string, SemaphorDerivedFieldInput>;
684
+ defaultAggregate?: SemaphorAggregateFunction;
685
+ aggregationBehavior?: SemaphorDerivedFieldAggregationBehavior;
686
+ aggregationStrategy?: SemaphorDerivedFieldAggregationStrategy;
687
+ format?: unknown;
688
+ tags?: string[];
689
+ };
690
+
691
+ declare type SemaphorDerivedFieldInput = {
692
+ kind: 'field';
693
+ field: SemaphorFieldRef;
694
+ aggregate?: SemaphorAggregateFunction;
695
+ } | {
696
+ kind: 'metric';
697
+ metric: SemaphorFieldRef;
698
+ } | {
699
+ kind: 'dimension';
700
+ dimension: SemaphorFieldRef;
701
+ };
702
+
703
+ declare type SemaphorDerivedFieldResultRole = 'measure' | 'group' | 'date' | 'id' | 'filter';
704
+
376
705
  declare type SemaphorDialect = 'postgres' | 'mysql' | 'mssql' | 'snowflake' | 'clickhouse' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
377
706
 
378
707
  declare type SemaphorExecutionFieldRef = SemaphorFieldRef & {
379
708
  semanticAggregate?: SemaphorAggregateFunction;
380
709
  effectiveAggregate?: SemaphorAggregateFunction;
381
710
  aggregateSource?: SemaphorMetricAggregateSource;
711
+ derivedField?: SemaphorDerivedFieldDefinition;
382
712
  };
383
713
 
714
+ /**
715
+ * Explorer-backed table source. This is intentionally distinct from raw SQL:
716
+ * matrix planning needs stable source metadata, fields, and dialect context.
717
+ */
718
+ declare type SemaphorExplorerSourceRef = Extract<SemaphorSourceRef, {
719
+ kind: 'physical';
720
+ }>;
721
+
384
722
  export declare type SemaphorFieldRef = {
385
723
  name: string;
386
724
  label?: string;
@@ -452,6 +790,7 @@ declare type SemaphorInputOptionsIntent = {
452
790
  field: SemaphorFieldRef;
453
791
  search?: string;
454
792
  limit?: number;
793
+ derivedFields?: SemaphorDerivedFieldDefinition[];
455
794
  };
456
795
 
457
796
  export declare type SemaphorInputOptionsPayload = {
@@ -470,7 +809,7 @@ export declare type SemaphorInputOptionsQueryResult = SemaphorQueryState & Semap
470
809
  }>;
471
810
  };
472
811
 
473
- export declare type SemaphorInputOptionsQuerySpec = SemaphorQuerySourceSpec & {
812
+ export declare type SemaphorInputOptionsQuerySpec = SemaphorQuerySourceSpec & SemaphorAppDerivedFieldsSpec & {
474
813
  id?: string;
475
814
  label?: string;
476
815
  field: SemaphorQueryField;
@@ -493,6 +832,190 @@ export declare type SemaphorInputSpec<TValue extends SemaphorInputValue = Semaph
493
832
 
494
833
  export declare type SemaphorInputValue = SemaphorScalar | SemaphorScalar[];
495
834
 
835
+ declare type SemaphorMatrixAxisExpansionOptions = {
836
+ defaultDepth?: number;
837
+ lazy?: boolean;
838
+ expandedPaths?: SemaphorMatrixMemberPathSegment[][];
839
+ };
840
+
841
+ export declare type SemaphorMatrixAxisLevel = {
842
+ id?: string;
843
+ field: SemaphorFieldRef;
844
+ grain?: SemaphorTimeGrain;
845
+ label?: string;
846
+ subtotal?: boolean | SemaphorMatrixSubtotalOptions;
847
+ sortBy?: SemaphorMatrixAxisSortRule;
848
+ };
849
+
850
+ export declare type SemaphorMatrixAxisLevelInput = SemaphorQueryField | SemaphorMatrixAxisLevel;
851
+
852
+ declare type SemaphorMatrixAxisSortRule = {
853
+ direction: 'asc' | 'desc';
854
+ by: {
855
+ kind: 'label';
856
+ } | {
857
+ kind: 'field';
858
+ field: SemaphorFieldRef;
859
+ aggregate?: SemaphorAggregateFunction;
860
+ };
861
+ nulls?: 'warehouseDefault' | 'first' | 'last';
862
+ scope?: 'global' | 'withinParent';
863
+ };
864
+
865
+ export declare type SemaphorMatrixDisplayLimitOptions = {
866
+ rows?: SemaphorMatrixDisplayLimitRule;
867
+ columns?: SemaphorMatrixDisplayLimitRule;
868
+ };
869
+
870
+ declare type SemaphorMatrixDisplayLimitRule = {
871
+ limit: number;
872
+ by?: 'label' | 'value';
873
+ direction?: 'top' | 'bottom';
874
+ others?: boolean | {
875
+ label?: string;
876
+ };
877
+ };
878
+
879
+ export declare type SemaphorMatrixExpansionOptions = {
880
+ rows?: SemaphorMatrixAxisExpansionOptions;
881
+ columns?: SemaphorMatrixAxisExpansionOptions;
882
+ };
883
+
884
+ export declare type SemaphorMatrixIntent = {
885
+ kind: 'matrix';
886
+ version?: SemaphorProtocolVersion;
887
+ id?: string;
888
+ label?: string;
889
+ source: SemaphorMatrixSourceRef;
890
+ rows: SemaphorMatrixAxisLevel[];
891
+ columns?: SemaphorMatrixAxisLevel[];
892
+ values: SemaphorMatrixValueField[];
893
+ filters?: SemaphorAnalyticsFilter[];
894
+ inputs?: SemaphorInputBinding[];
895
+ totals?: SemaphorMatrixTotalOptions;
896
+ sort?: SemaphorMatrixSortRule[];
897
+ expansion?: SemaphorMatrixExpansionOptions;
898
+ layout?: SemaphorMatrixLayoutOptions;
899
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
900
+ };
901
+
902
+ declare type SemaphorMatrixLayoutOptions = {
903
+ hierarchy?: 'compact' | 'tabular' | 'outline';
904
+ valuesPlacement?: 'columns' | 'rows';
905
+ stickyRowHeaders?: boolean;
906
+ stickyColumnHeaders?: boolean;
907
+ };
908
+
909
+ declare type SemaphorMatrixMemberPathSegment = {
910
+ levelId: string;
911
+ value: unknown;
912
+ };
913
+
914
+ export declare type SemaphorMatrixPayload = {
915
+ payload?: MatrixPayload;
916
+ grid?: MatrixGridProjection;
917
+ expansion?: MatrixExpansionResponseHints;
918
+ executionResult?: SemaphorAnalyticsExecutionResult;
919
+ };
920
+
921
+ export declare type SemaphorMatrixQueryDefinition = SemaphorMatrixQuerySpec & {
922
+ queryKind: 'matrix';
923
+ };
924
+
925
+ export declare type SemaphorMatrixQueryResult = SemaphorQueryState & SemaphorMatrixPayload & {
926
+ id?: string;
927
+ intent?: SemaphorMatrixIntent;
928
+ };
929
+
930
+ export declare type SemaphorMatrixQuerySpec = Omit<SemaphorMatrixIntent, 'kind' | 'version' | 'rows' | 'columns' | 'values' | 'source' | 'inputs'> & {
931
+ source: SemaphorMatrixSourceRef;
932
+ rows: SemaphorNonEmptyArray<SemaphorMatrixAxisLevelInput>;
933
+ columns?: SemaphorMatrixAxisLevelInput[];
934
+ values: SemaphorNonEmptyArray<SemaphorMatrixValueFieldInput>;
935
+ inputs?: SemaphorInputReference[];
936
+ totals?: SemaphorMatrixTotalOptions;
937
+ sort?: SemaphorMatrixSortRule[];
938
+ expansion?: SemaphorMatrixExpansionOptions;
939
+ layout?: SemaphorMatrixIntent['layout'];
940
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
941
+ };
942
+
943
+ declare type SemaphorMatrixResult = SemaphorAnalyticsResultBase & {
944
+ kind: 'matrix';
945
+ intent: SemaphorMatrixIntent;
946
+ payload: MatrixPayload;
947
+ grid: MatrixGridProjection;
948
+ expansion?: MatrixExpansionResponseHints;
949
+ };
950
+
951
+ export declare type SemaphorMatrixSortRule = {
952
+ axis: 'row' | 'column';
953
+ targetId?: string;
954
+ direction: 'asc' | 'desc';
955
+ by: {
956
+ kind: 'label';
957
+ } | {
958
+ kind: 'field';
959
+ field: SemaphorFieldRef;
960
+ aggregate?: SemaphorAggregateFunction;
961
+ } | {
962
+ kind: 'value';
963
+ valueId: string;
964
+ rowPath?: SemaphorMatrixMemberPathSegment[];
965
+ columnPath?: SemaphorMatrixMemberPathSegment[];
966
+ };
967
+ nulls?: 'warehouseDefault' | 'first' | 'last';
968
+ scope?: 'global' | 'withinParent';
969
+ };
970
+
971
+ export declare type SemaphorMatrixSourceRef = SemaphorSemanticSourceRef | SemaphorExplorerSourceRef;
972
+
973
+ declare type SemaphorMatrixSubtotalOptions = {
974
+ enabled?: boolean;
975
+ position?: 'before' | 'after';
976
+ label?: string;
977
+ };
978
+
979
+ declare type SemaphorMatrixTotalCalculation = {
980
+ kind: 'defaultAggregate';
981
+ } | {
982
+ kind: 'blank';
983
+ } | {
984
+ kind: 'labelOnly';
985
+ label?: string;
986
+ } | {
987
+ kind: 'customAggregate';
988
+ aggregate: SemaphorAggregateFunction;
989
+ } | {
990
+ kind: 'percentOfParent';
991
+ } | {
992
+ kind: 'percentOfGrandTotal';
993
+ } | {
994
+ kind: 'customExpression';
995
+ expressionId: string;
996
+ };
997
+
998
+ export declare type SemaphorMatrixTotalOptions = {
999
+ rows?: boolean | 'perLevel';
1000
+ columns?: boolean | 'perLevel';
1001
+ grandTotal?: boolean | {
1002
+ rows?: boolean;
1003
+ columns?: boolean;
1004
+ };
1005
+ rowPosition?: 'top' | 'bottom';
1006
+ columnPosition?: 'left' | 'right';
1007
+ };
1008
+
1009
+ export declare type SemaphorMatrixValueField = {
1010
+ id?: string;
1011
+ field: SemaphorFieldRef;
1012
+ aggregate?: SemaphorAggregateFunction;
1013
+ label?: string;
1014
+ totalBehavior?: SemaphorMatrixTotalCalculation;
1015
+ };
1016
+
1017
+ export declare type SemaphorMatrixValueFieldInput = SemaphorQueryField | SemaphorMatrixValueField;
1018
+
496
1019
  declare type SemaphorMetricAggregateSource = 'semantic_model' | 'caller_override' | 'default_sum';
497
1020
 
498
1021
  declare type SemaphorMetricAnalysis = {
@@ -531,6 +1054,7 @@ declare type SemaphorMetricIntent = {
531
1054
  };
532
1055
  inputs?: SemaphorInputBinding[];
533
1056
  limit?: number;
1057
+ derivedFields?: SemaphorDerivedFieldDefinition[];
534
1058
  };
535
1059
 
536
1060
  export declare type SemaphorMetricPayload = {
@@ -552,7 +1076,7 @@ export declare type SemaphorMetricQueryResult = SemaphorQueryState & SemaphorMet
552
1076
  intent?: SemaphorMetricIntent;
553
1077
  };
554
1078
 
555
- export declare type SemaphorMetricQuerySpec = SemaphorQuerySourceSpec & {
1079
+ export declare type SemaphorMetricQuerySpec = SemaphorQuerySourceSpec & SemaphorAppDerivedFieldsSpec & {
556
1080
  id?: string;
557
1081
  label?: string;
558
1082
  metrics: SemaphorNonEmptyArray<SemaphorQueryField>;
@@ -603,7 +1127,7 @@ declare type SemaphorProtocolIssue = {
603
1127
 
604
1128
  declare type SemaphorProtocolVersion = 1;
605
1129
 
606
- export declare type SemaphorQueryDefinition = SemaphorMetricQueryDefinition | SemaphorAnalysisQueryDefinition | SemaphorRecordsQueryDefinition | SemaphorInputOptionsQueryDefinition | SemaphorSqlQueryDefinition;
1130
+ export declare type SemaphorQueryDefinition = SemaphorMetricQueryDefinition | SemaphorAnalysisQueryDefinition | SemaphorRecordsQueryDefinition | SemaphorInputOptionsQueryDefinition | SemaphorSqlQueryDefinition | SemaphorMatrixQueryDefinition;
607
1131
 
608
1132
  export declare type SemaphorQueryExecutor = {
609
1133
  executeAnalysis?(intent: SemaphorMetricIntent, context: SemaphorQueryExecutorContext, options?: SemaphorAnalysisQueryOptions): Promise<SemaphorAnalysisPayload>;
@@ -613,6 +1137,7 @@ export declare type SemaphorQueryExecutor = {
613
1137
  kind: 'inputOptions';
614
1138
  }>, context: SemaphorQueryExecutorContext): Promise<SemaphorInputOptionsPayload>;
615
1139
  executeSql?<TRecord extends Record<string, unknown> = Record<string, unknown>>(intent: SemaphorSqlIntent, context: SemaphorQueryExecutorContext): Promise<SemaphorSqlPayload<TRecord>>;
1140
+ executeMatrix?(intent: SemaphorMatrixIntent, context: SemaphorQueryExecutorContext): Promise<SemaphorMatrixPayload>;
616
1141
  };
617
1142
 
618
1143
  export declare type SemaphorQueryExecutorContext = {
@@ -630,9 +1155,9 @@ export declare type SemaphorQueryOrderBy = {
630
1155
 
631
1156
  declare type SemaphorQueryPath = 'query_spec' | 'sql' | 'sql_python';
632
1157
 
633
- export declare type SemaphorQueryResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorMetricQueryResult | SemaphorAnalysisQueryResult | SemaphorRowsQueryResult<TRecord> | SemaphorInputOptionsQueryResult;
1158
+ export declare type SemaphorQueryResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorMetricQueryResult | SemaphorAnalysisQueryResult | SemaphorRowsQueryResult<TRecord> | SemaphorInputOptionsQueryResult | SemaphorMatrixQueryResult;
634
1159
 
635
- export declare type SemaphorQueryResultFor<TQuery extends SemaphorQueryDefinition, TRecord extends Record<string, unknown> = Record<string, unknown>> = TQuery extends SemaphorMetricQueryDefinition ? SemaphorMetricQueryResult : TQuery extends SemaphorAnalysisQueryDefinition ? SemaphorAnalysisQueryResult : TQuery extends SemaphorRecordsQueryDefinition ? SemaphorRecordsQueryResult<TRecord> : TQuery extends SemaphorInputOptionsQueryDefinition ? SemaphorInputOptionsQueryResult : TQuery extends SemaphorSqlQueryDefinition ? SemaphorSqlQueryResult<TRecord> : never;
1160
+ export declare type SemaphorQueryResultFor<TQuery extends SemaphorQueryDefinition, TRecord extends Record<string, unknown> = Record<string, unknown>> = TQuery extends SemaphorMetricQueryDefinition ? SemaphorMetricQueryResult : TQuery extends SemaphorAnalysisQueryDefinition ? SemaphorAnalysisQueryResult : TQuery extends SemaphorRecordsQueryDefinition ? SemaphorRecordsQueryResult<TRecord> : TQuery extends SemaphorInputOptionsQueryDefinition ? SemaphorInputOptionsQueryResult : TQuery extends SemaphorSqlQueryDefinition ? SemaphorSqlQueryResult<TRecord> : TQuery extends SemaphorMatrixQueryDefinition ? SemaphorMatrixQueryResult : never;
636
1161
 
637
1162
  export declare type SemaphorQueryRuntimeOptions = {
638
1163
  inputs?: SemaphorInputReference[];
@@ -650,7 +1175,7 @@ export declare type SemaphorQueryState = {
650
1175
 
651
1176
  export declare type SemaphorQueryStatus = 'idle' | 'loading' | 'success' | 'error';
652
1177
 
653
- declare type SemaphorRecordsBaseQuerySpec = SemaphorQuerySourceSpec & {
1178
+ declare type SemaphorRecordsBaseQuerySpec = SemaphorQuerySourceSpec & SemaphorAppDerivedFieldsSpec & {
654
1179
  id?: string;
655
1180
  label?: string;
656
1181
  dateField?: SemaphorQueryField;
@@ -685,6 +1210,7 @@ declare type SemaphorRecordsIntent = {
685
1210
  direction: 'asc' | 'desc';
686
1211
  };
687
1212
  inputs?: SemaphorInputBinding[];
1213
+ derivedFields?: SemaphorDerivedFieldDefinition[];
688
1214
  };
689
1215
 
690
1216
  export declare type SemaphorRecordsOrderBy = SemaphorQueryOrderBy;
@@ -765,12 +1291,17 @@ export declare type SemaphorResultColumn = {
765
1291
  dataType?: SemaphorFieldRef['dataType'];
766
1292
  aggregate?: SemaphorFieldRef['aggregate'];
767
1293
  source?: SemaphorFieldRef['source'];
1294
+ derivedField?: SemaphorDerivedFieldDefinition;
768
1295
  };
769
1296
 
770
1297
  export declare type SemaphorRowsQueryResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorRecordsQueryResult<TRecord> | SemaphorSqlQueryResult<TRecord>;
771
1298
 
772
1299
  export declare type SemaphorScalar = string | number | boolean | null;
773
1300
 
1301
+ declare type SemaphorSemanticSourceRef = Extract<SemaphorSourceRef, {
1302
+ kind: 'semantic';
1303
+ }>;
1304
+
774
1305
  export declare type SemaphorSourceRef = {
775
1306
  kind: 'semantic';
776
1307
  domainId: string;
@@ -895,6 +1426,8 @@ export declare function toSemaphorInputSpec<TValue extends SemaphorInputValue =
895
1426
  controlRole?: SemaphorControlRole;
896
1427
  };
897
1428
 
1429
+ export declare function toSemaphorMatrixIntent(spec: SemaphorMatrixQuerySpec): SemaphorMatrixIntent;
1430
+
898
1431
  export declare function toSemaphorMetricIntent(spec: SemaphorMetricQuerySpec): SemaphorMetricIntent;
899
1432
 
900
1433
  export declare function toSemaphorRecordsIntent(spec: SemaphorRecordsQuerySpec): SemaphorRecordsIntent;
@@ -917,6 +1450,8 @@ export declare function useSemaphorQuery(spec: SemaphorInputOptionsQueryDefiniti
917
1450
 
918
1451
  export declare function useSemaphorQuery<TRecord extends Record<string, unknown> = Record<string, unknown>>(spec: SemaphorSqlQueryDefinition, options?: SemaphorQueryRuntimeOptions): SemaphorSqlQueryResult<TRecord>;
919
1452
 
1453
+ export declare function useSemaphorQuery(spec: SemaphorMatrixQueryDefinition, options?: SemaphorQueryRuntimeOptions): SemaphorMatrixQueryResult;
1454
+
920
1455
  export declare function validateSemaphorDataAppQuerySpecs(input: {
921
1456
  queries: SemaphorDataAppQuerySpecEnvelope[];
922
1457
  fieldCatalogs?: SemaphorDataAppFieldCatalog[];