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
@@ -2,8 +2,14 @@ declare type AggregateFunction = 'COUNT' | 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'MEDI
2
2
 
3
3
  /**
4
4
  * Formula metadata for calculated fields (UI-only metadata)
5
- * This is supplementary data to help the UI display and edit calculated fields.
6
- * The `expression` field remains the source of truth for the backend.
5
+ * This is supplementary runtime/compiler data to help dashboard UI display,
6
+ * edit, and execute calculated fields.
7
+ *
8
+ * Public source-level calculation metadata belongs in `Field.derivedField`
9
+ * (`SemaphorDerivedFieldDefinition`). `calculatedFormula` deliberately uses
10
+ * indexed `{field_N}` tokens and full runtime Field objects so current dashboard
11
+ * query execution can resolve aliases, joins, filters, and aggregates without
12
+ * doing catalog lookups.
7
13
  *
8
14
  * IMPORTANT: This metadata is ALWAYS updated atomically with the expression field.
9
15
  * Both are generated together from the same dialog inputs, preventing drift.
@@ -389,6 +395,15 @@ declare interface Field {
389
395
  role?: 'groupby' | 'metric' | 'sortby' | 'pivotby' | 'detail';
390
396
  expression?: string;
391
397
  calculatedFormula?: CalculatedFieldFormula;
398
+ /**
399
+ * Public, source-level derived-field metadata for semantic/domain-authored
400
+ * calculations. This is the AI/MCP/Data App-facing contract: named-token
401
+ * expression, typed inputs, result role, and compute stage.
402
+ *
403
+ * Dashboard-local calculated fields may omit this because they are local
404
+ * runtime artifacts rather than semantic-domain definitions.
405
+ */
406
+ derivedField?: SemaphorDerivedFieldDefinition;
392
407
  format?: FormatSpec;
393
408
  aggregate?: AggregateFunction;
394
409
  fieldScope?: FieldScope;
@@ -534,6 +549,289 @@ declare interface JoinPlan {
534
549
 
535
550
  declare type LogicalOperator = 'AND' | 'OR';
536
551
 
552
+ declare type MatrixAxisLevelDescriptor = {
553
+ instanceId: string;
554
+ fieldKey: string;
555
+ label: string;
556
+ field: SemaphorFieldRef;
557
+ grain?: SemaphorTimeGrain;
558
+ subtotal?: SemaphorMatrixSubtotalOptions;
559
+ };
560
+
561
+ declare type MatrixAxisPayload = {
562
+ id: 'rows' | 'columns';
563
+ levels: MatrixAxisLevelDescriptor[];
564
+ nodes: MatrixNode[];
565
+ };
566
+
567
+ declare type MatrixCapability = 'rowHierarchy' | 'columnHierarchy' | 'rowSubtotals' | 'columnSubtotals' | 'grandTotals' | 'lazyRows' | 'lazyColumns' | 'conditionalFormatting' | 'visualExport' | (string & {});
568
+
569
+ declare type MatrixCell = {
570
+ id: string;
571
+ rowNodeId: string;
572
+ columnNodeId?: string;
573
+ measureInstanceId: string;
574
+ rowPath: MatrixMemberPathSegment[];
575
+ columnPath: MatrixMemberPathSegment[];
576
+ rawValue: unknown;
577
+ presence: MatrixCellPresence;
578
+ formattedValue?: string;
579
+ role: MatrixCellRole;
580
+ aggregateFunction?: SemaphorAggregateFunction;
581
+ formattingScope: MatrixCellFormattingScope;
582
+ actions?: MatrixCellAction[];
583
+ };
584
+
585
+ declare type MatrixCellAction = {
586
+ kind: 'requestSubgoal' | 'filter' | 'copyValue' | 'explainCalculation' | 'inspectContributingRows' | 'drillThrough' | (string & {});
587
+ label?: string;
588
+ payload?: Record<string, unknown>;
589
+ };
590
+
591
+ declare type MatrixCellFormattingScope = {
592
+ rowNodeId: string;
593
+ columnNodeId?: string;
594
+ measureInstanceId: string;
595
+ role: MatrixCellRole;
596
+ rowPath: MatrixMemberPathSegment[];
597
+ columnPath: MatrixMemberPathSegment[];
598
+ };
599
+
600
+ declare type MatrixCellPresence = 'present' | 'presentNull' | 'missing' | 'densified';
601
+
602
+ declare type MatrixCellRole = 'value' | 'rowSubtotal' | 'columnSubtotal' | 'subtotalIntersection' | 'rowGrandTotal' | 'columnGrandTotal' | 'matrixGrandTotal';
603
+
604
+ declare type MatrixExecutionMetadata = {
605
+ strategy?: MatrixQueryStrategy;
606
+ dialect?: SemaphorDialect;
607
+ rowNodeCount?: number;
608
+ columnNodeCount?: number;
609
+ cellCount?: number;
610
+ groupingSetCount?: number;
611
+ queryDurationMs?: number;
612
+ budgetRejected?: boolean;
613
+ cacheStatus?: 'hit' | 'miss' | 'bypass';
614
+ [key: string]: unknown;
615
+ };
616
+
617
+ declare type MatrixExpansionRequest = {
618
+ axis: 'row' | 'column';
619
+ path: MatrixMemberPathSegment[];
620
+ depth?: number;
621
+ };
622
+
623
+ declare type MatrixExpansionResponseHints = {
624
+ rowLazyLoading?: boolean;
625
+ columnLazyLoading?: boolean;
626
+ expandableRowNodeIds?: string[];
627
+ expandableColumnNodeIds?: string[];
628
+ nextRequests?: MatrixExpansionRequest[];
629
+ };
630
+
631
+ declare type MatrixFieldDescriptor = {
632
+ instanceId: string;
633
+ fieldKey: string;
634
+ field: SemaphorFieldRef;
635
+ role: 'row' | 'column' | 'measure' | 'sort' | 'filter';
636
+ label?: string;
637
+ };
638
+
639
+ declare type MatrixFieldDirectory = {
640
+ fieldsByInstanceId: Record<string, MatrixFieldDescriptor>;
641
+ };
642
+
643
+ declare type MatrixFormattingContext = {
644
+ domains?: Record<string, {
645
+ min?: number;
646
+ max?: number;
647
+ }>;
648
+ rules?: Array<Record<string, unknown>>;
649
+ };
650
+
651
+ declare type MatrixGridCell = {
652
+ id: string;
653
+ columnId: string;
654
+ cellId?: string;
655
+ rawValue: unknown;
656
+ formattedValue?: string;
657
+ presence: MatrixCellPresence;
658
+ role: MatrixCellRole;
659
+ measureInstanceId: string;
660
+ rowPath: MatrixMemberPathSegment[];
661
+ columnPath: MatrixMemberPathSegment[];
662
+ };
663
+
664
+ declare type MatrixGridColumn = {
665
+ id: string;
666
+ label: string;
667
+ columnNodeId?: string;
668
+ columnPath: MatrixMemberPathSegment[];
669
+ measureInstanceId: string;
670
+ role: 'value' | 'columnSubtotal' | 'columnGrandTotal';
671
+ };
672
+
673
+ declare type MatrixGridHeaderCell = {
674
+ id: string;
675
+ label: string;
676
+ role: 'rowHeader' | 'columnHeader' | 'measureHeader' | 'subtotal' | 'grandTotal';
677
+ colSpan: number;
678
+ rowSpan: number;
679
+ columnPath: MatrixMemberPathSegment[];
680
+ measureInstanceId?: string;
681
+ };
682
+
683
+ declare type MatrixGridHeaderRow = {
684
+ id: string;
685
+ cells: MatrixGridHeaderCell[];
686
+ };
687
+
688
+ declare type MatrixGridProjection = {
689
+ schemaVersion: 1;
690
+ shape: MatrixShape;
691
+ rowHeaderLevels: MatrixGridRowHeaderLevel[];
692
+ columnHeaderRows: MatrixGridHeaderRow[];
693
+ columns: MatrixGridColumn[];
694
+ rows: MatrixGridRow[];
695
+ };
696
+
697
+ declare type MatrixGridRow = {
698
+ id: string;
699
+ rowNodeId: string;
700
+ rowPath: MatrixMemberPathSegment[];
701
+ depth: number;
702
+ label: string;
703
+ role: 'value' | 'rowSubtotal' | 'rowGrandTotal';
704
+ isExpanded?: boolean;
705
+ hasChildren?: boolean;
706
+ cells: MatrixGridCell[];
707
+ };
708
+
709
+ declare type MatrixGridRowHeaderLevel = {
710
+ id: string;
711
+ label: string;
712
+ fieldInstanceId: string;
713
+ };
714
+
715
+ declare type MatrixMeasureDescriptor = {
716
+ instanceId: string;
717
+ fieldKey: string;
718
+ label: string;
719
+ field: SemaphorFieldRef;
720
+ aggregate?: SemaphorAggregateFunction;
721
+ totalBehavior?: SemaphorMatrixTotalCalculation;
722
+ };
723
+
724
+ declare type MatrixMeasureSemantics = {
725
+ kind: 'additive';
726
+ aggregate?: SemaphorAggregateFunction;
727
+ } | {
728
+ kind: 'semiAdditive';
729
+ aggregate?: SemaphorAggregateFunction;
730
+ grain?: SemaphorTimeGrain;
731
+ } | {
732
+ kind: 'nonAdditive';
733
+ aggregate?: SemaphorAggregateFunction;
734
+ } | {
735
+ kind: 'ratio';
736
+ numeratorMeasureInstanceId?: string;
737
+ denominatorMeasureInstanceId?: string;
738
+ } | {
739
+ kind: 'custom';
740
+ expressionId?: string;
741
+ };
742
+
743
+ declare type MatrixMemberPathSegment = {
744
+ instanceId: string;
745
+ fieldKey: string;
746
+ value: unknown;
747
+ label: string;
748
+ };
749
+
750
+ declare type MatrixNode = {
751
+ id: string;
752
+ axis: 'row' | 'column';
753
+ path: MatrixMemberPathSegment[];
754
+ level: number;
755
+ label: string;
756
+ value: unknown;
757
+ parentId?: string;
758
+ hasChildren: boolean;
759
+ isExpanded?: boolean;
760
+ isSubtotal?: boolean;
761
+ isGrandTotal?: boolean;
762
+ subtotalFunction?: SemaphorAggregateFunction;
763
+ childCount?: number;
764
+ actions?: MatrixNodeAction[];
765
+ };
766
+
767
+ declare type MatrixNodeAction = {
768
+ kind: 'expand' | 'collapse' | 'requestSubgoal' | 'filter' | 'drillThrough' | 'openRelatedRecords' | (string & {});
769
+ label?: string;
770
+ payload?: Record<string, unknown>;
771
+ };
772
+
773
+ declare type MatrixPageInfo = {
774
+ rowOffset?: number;
775
+ rowLimit?: number;
776
+ columnOffset?: number;
777
+ columnLimit?: number;
778
+ hasMoreRows?: boolean;
779
+ hasMoreColumns?: boolean;
780
+ };
781
+
782
+ declare type MatrixPayload = {
783
+ kind: 'matrixPayload';
784
+ schemaVersion: 1;
785
+ shape: MatrixShape;
786
+ capabilities: MatrixCapability[];
787
+ executionMetadata: MatrixExecutionMetadata;
788
+ axes: {
789
+ rows: MatrixAxisPayload;
790
+ columns: MatrixAxisPayload;
791
+ };
792
+ measures: MatrixMeasureDescriptor[];
793
+ measureSemantics: Record<string, MatrixMeasureSemantics>;
794
+ fieldDirectory: MatrixFieldDirectory;
795
+ rowNodes: MatrixNode[];
796
+ columnNodes: MatrixNode[];
797
+ cells: MatrixCell[];
798
+ totals: MatrixTotals;
799
+ sort: MatrixResolvedSort[];
800
+ formattingContext: MatrixFormattingContext;
801
+ pageInfo?: MatrixPageInfo;
802
+ warnings?: MatrixWarning[];
803
+ };
804
+
805
+ declare type MatrixQueryStrategy = 'tall' | 'wide' | 'lazy' | 'export';
806
+
807
+ declare type MatrixResolvedSort = {
808
+ id: string;
809
+ axis: 'row' | 'column';
810
+ targetInstanceId?: string;
811
+ direction: 'asc' | 'desc';
812
+ nulls?: 'warehouseDefault' | 'first' | 'last';
813
+ scope?: 'global' | 'withinParent';
814
+ by: SemaphorMatrixSortRule['by'];
815
+ };
816
+
817
+ declare type MatrixShape = 'hierarchical' | 'pivot';
818
+
819
+ declare type MatrixTotals = {
820
+ rows?: boolean;
821
+ columns?: boolean;
822
+ grandTotal?: boolean | {
823
+ rows?: boolean;
824
+ columns?: boolean;
825
+ };
826
+ };
827
+
828
+ declare type MatrixWarning = {
829
+ code: string;
830
+ message: string;
831
+ path?: string;
832
+ severity?: 'info' | 'warning' | 'error';
833
+ };
834
+
537
835
  declare interface MetricField extends Field {
538
836
  role: 'metric';
539
837
  aggregate?: AggregateFunction;
@@ -648,7 +946,7 @@ declare type SemaphorAnalyticsFilterBase = {
648
946
 
649
947
  declare type SemaphorAnalyticsFilterOperator = SemaphorInputOperator | 'not_contains' | 'is_null' | 'is_not_null';
650
948
 
651
- declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
949
+ declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent | SemaphorMatrixIntent;
652
950
 
653
951
  declare type SemaphorAnalyticsNullFilter = SemaphorAnalyticsFilterBase & {
654
952
  operator: SemaphorAnalyticsNullFilterOperator;
@@ -673,7 +971,7 @@ declare type SemaphorAnalyticsRepairHint = {
673
971
  recommendedNextStep: string;
674
972
  };
675
973
 
676
- declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult;
974
+ declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult | SemaphorMatrixResult;
677
975
 
678
976
  declare type SemaphorAnalyticsResultBase = {
679
977
  intentId?: string;
@@ -734,14 +1032,61 @@ declare type SemaphorCompiledQuery = {
734
1032
  analyticsIntent?: SemaphorAnalyticsIntent;
735
1033
  };
736
1034
 
1035
+ declare type SemaphorDerivedFieldAggregationBehavior = 'additive' | 'non_additive' | 'ratio_of_sums' | 'weighted' | 'pre_aggregated' | 'snapshot';
1036
+
1037
+ declare type SemaphorDerivedFieldAggregationStrategy = 'default' | 'symmetric_aggregate' | 'aggregate_then_join' | 'weighted';
1038
+
1039
+ declare type SemaphorDerivedFieldComputeStage = 'row' | 'aggregate';
1040
+
1041
+ declare type SemaphorDerivedFieldDefinition = {
1042
+ kind: 'derived_field';
1043
+ name: string;
1044
+ label: string;
1045
+ description?: string;
1046
+ resultRole: SemaphorDerivedFieldResultRole;
1047
+ dataType: NonNullable<SemaphorFieldRef['dataType']>;
1048
+ computeStage: SemaphorDerivedFieldComputeStage;
1049
+ expression: string;
1050
+ expressionLanguage?: 'semaphor_sql_template';
1051
+ inputs: Record<string, SemaphorDerivedFieldInput>;
1052
+ defaultAggregate?: SemaphorAggregateFunction;
1053
+ aggregationBehavior?: SemaphorDerivedFieldAggregationBehavior;
1054
+ aggregationStrategy?: SemaphorDerivedFieldAggregationStrategy;
1055
+ format?: unknown;
1056
+ tags?: string[];
1057
+ };
1058
+
1059
+ declare type SemaphorDerivedFieldInput = {
1060
+ kind: 'field';
1061
+ field: SemaphorFieldRef;
1062
+ aggregate?: SemaphorAggregateFunction;
1063
+ } | {
1064
+ kind: 'metric';
1065
+ metric: SemaphorFieldRef;
1066
+ } | {
1067
+ kind: 'dimension';
1068
+ dimension: SemaphorFieldRef;
1069
+ };
1070
+
1071
+ declare type SemaphorDerivedFieldResultRole = 'measure' | 'group' | 'date' | 'id' | 'filter';
1072
+
737
1073
  declare type SemaphorDialect = 'postgres' | 'mysql' | 'mssql' | 'snowflake' | 'clickhouse' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
738
1074
 
739
1075
  declare type SemaphorExecutionFieldRef = SemaphorFieldRef & {
740
1076
  semanticAggregate?: SemaphorAggregateFunction;
741
1077
  effectiveAggregate?: SemaphorAggregateFunction;
742
1078
  aggregateSource?: SemaphorMetricAggregateSource;
1079
+ derivedField?: SemaphorDerivedFieldDefinition;
743
1080
  };
744
1081
 
1082
+ /**
1083
+ * Explorer-backed table source. This is intentionally distinct from raw SQL:
1084
+ * matrix planning needs stable source metadata, fields, and dialect context.
1085
+ */
1086
+ declare type SemaphorExplorerSourceRef = Extract<SemaphorSourceRef, {
1087
+ kind: 'physical';
1088
+ }>;
1089
+
745
1090
  declare type SemaphorFieldRef = {
746
1091
  name: string;
747
1092
  label?: string;
@@ -770,6 +1115,7 @@ declare type SemaphorInputOptionsIntent = {
770
1115
  field: SemaphorFieldRef;
771
1116
  search?: string;
772
1117
  limit?: number;
1118
+ derivedFields?: SemaphorDerivedFieldDefinition[];
773
1119
  };
774
1120
 
775
1121
  declare type SemaphorInputOptionsResult = SemaphorAnalyticsResultBase & {
@@ -781,6 +1127,157 @@ declare type SemaphorInputOptionsResult = SemaphorAnalyticsResultBase & {
781
1127
  }>;
782
1128
  };
783
1129
 
1130
+ declare type SemaphorMatrixAxisExpansionOptions = {
1131
+ defaultDepth?: number;
1132
+ lazy?: boolean;
1133
+ expandedPaths?: SemaphorMatrixMemberPathSegment[][];
1134
+ };
1135
+
1136
+ declare type SemaphorMatrixAxisLevel = {
1137
+ id?: string;
1138
+ field: SemaphorFieldRef;
1139
+ grain?: SemaphorTimeGrain;
1140
+ label?: string;
1141
+ subtotal?: boolean | SemaphorMatrixSubtotalOptions;
1142
+ sortBy?: SemaphorMatrixAxisSortRule;
1143
+ };
1144
+
1145
+ declare type SemaphorMatrixAxisSortRule = {
1146
+ direction: 'asc' | 'desc';
1147
+ by: {
1148
+ kind: 'label';
1149
+ } | {
1150
+ kind: 'field';
1151
+ field: SemaphorFieldRef;
1152
+ aggregate?: SemaphorAggregateFunction;
1153
+ };
1154
+ nulls?: 'warehouseDefault' | 'first' | 'last';
1155
+ scope?: 'global' | 'withinParent';
1156
+ };
1157
+
1158
+ declare type SemaphorMatrixDisplayLimitOptions = {
1159
+ rows?: SemaphorMatrixDisplayLimitRule;
1160
+ columns?: SemaphorMatrixDisplayLimitRule;
1161
+ };
1162
+
1163
+ declare type SemaphorMatrixDisplayLimitRule = {
1164
+ limit: number;
1165
+ by?: 'label' | 'value';
1166
+ direction?: 'top' | 'bottom';
1167
+ others?: boolean | {
1168
+ label?: string;
1169
+ };
1170
+ };
1171
+
1172
+ declare type SemaphorMatrixExpansionOptions = {
1173
+ rows?: SemaphorMatrixAxisExpansionOptions;
1174
+ columns?: SemaphorMatrixAxisExpansionOptions;
1175
+ };
1176
+
1177
+ declare type SemaphorMatrixIntent = {
1178
+ kind: 'matrix';
1179
+ version?: SemaphorProtocolVersion;
1180
+ id?: string;
1181
+ label?: string;
1182
+ source: SemaphorMatrixSourceRef;
1183
+ rows: SemaphorMatrixAxisLevel[];
1184
+ columns?: SemaphorMatrixAxisLevel[];
1185
+ values: SemaphorMatrixValueField[];
1186
+ filters?: SemaphorAnalyticsFilter[];
1187
+ inputs?: SemaphorInputBinding[];
1188
+ totals?: SemaphorMatrixTotalOptions;
1189
+ sort?: SemaphorMatrixSortRule[];
1190
+ expansion?: SemaphorMatrixExpansionOptions;
1191
+ layout?: SemaphorMatrixLayoutOptions;
1192
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
1193
+ };
1194
+
1195
+ declare type SemaphorMatrixLayoutOptions = {
1196
+ hierarchy?: 'compact' | 'tabular' | 'outline';
1197
+ valuesPlacement?: 'columns' | 'rows';
1198
+ stickyRowHeaders?: boolean;
1199
+ stickyColumnHeaders?: boolean;
1200
+ };
1201
+
1202
+ declare type SemaphorMatrixMemberPathSegment = {
1203
+ levelId: string;
1204
+ value: unknown;
1205
+ };
1206
+
1207
+ declare type SemaphorMatrixResult = SemaphorAnalyticsResultBase & {
1208
+ kind: 'matrix';
1209
+ intent: SemaphorMatrixIntent;
1210
+ payload: MatrixPayload;
1211
+ grid: MatrixGridProjection;
1212
+ expansion?: MatrixExpansionResponseHints;
1213
+ };
1214
+
1215
+ declare type SemaphorMatrixSortRule = {
1216
+ axis: 'row' | 'column';
1217
+ targetId?: string;
1218
+ direction: 'asc' | 'desc';
1219
+ by: {
1220
+ kind: 'label';
1221
+ } | {
1222
+ kind: 'field';
1223
+ field: SemaphorFieldRef;
1224
+ aggregate?: SemaphorAggregateFunction;
1225
+ } | {
1226
+ kind: 'value';
1227
+ valueId: string;
1228
+ rowPath?: SemaphorMatrixMemberPathSegment[];
1229
+ columnPath?: SemaphorMatrixMemberPathSegment[];
1230
+ };
1231
+ nulls?: 'warehouseDefault' | 'first' | 'last';
1232
+ scope?: 'global' | 'withinParent';
1233
+ };
1234
+
1235
+ declare type SemaphorMatrixSourceRef = SemaphorSemanticSourceRef | SemaphorExplorerSourceRef;
1236
+
1237
+ declare type SemaphorMatrixSubtotalOptions = {
1238
+ enabled?: boolean;
1239
+ position?: 'before' | 'after';
1240
+ label?: string;
1241
+ };
1242
+
1243
+ declare type SemaphorMatrixTotalCalculation = {
1244
+ kind: 'defaultAggregate';
1245
+ } | {
1246
+ kind: 'blank';
1247
+ } | {
1248
+ kind: 'labelOnly';
1249
+ label?: string;
1250
+ } | {
1251
+ kind: 'customAggregate';
1252
+ aggregate: SemaphorAggregateFunction;
1253
+ } | {
1254
+ kind: 'percentOfParent';
1255
+ } | {
1256
+ kind: 'percentOfGrandTotal';
1257
+ } | {
1258
+ kind: 'customExpression';
1259
+ expressionId: string;
1260
+ };
1261
+
1262
+ declare type SemaphorMatrixTotalOptions = {
1263
+ rows?: boolean | 'perLevel';
1264
+ columns?: boolean | 'perLevel';
1265
+ grandTotal?: boolean | {
1266
+ rows?: boolean;
1267
+ columns?: boolean;
1268
+ };
1269
+ rowPosition?: 'top' | 'bottom';
1270
+ columnPosition?: 'left' | 'right';
1271
+ };
1272
+
1273
+ declare type SemaphorMatrixValueField = {
1274
+ id?: string;
1275
+ field: SemaphorFieldRef;
1276
+ aggregate?: SemaphorAggregateFunction;
1277
+ label?: string;
1278
+ totalBehavior?: SemaphorMatrixTotalCalculation;
1279
+ };
1280
+
784
1281
  declare type SemaphorMetricAggregateSource = 'semantic_model' | 'caller_override' | 'default_sum';
785
1282
 
786
1283
  declare type SemaphorMetricAnalysis = {
@@ -814,6 +1311,7 @@ declare type SemaphorMetricIntent = {
814
1311
  };
815
1312
  inputs?: SemaphorInputBinding[];
816
1313
  limit?: number;
1314
+ derivedFields?: SemaphorDerivedFieldDefinition[];
817
1315
  };
818
1316
 
819
1317
  declare type SemaphorMetricResult = SemaphorAnalyticsResultBase & {
@@ -869,6 +1367,7 @@ declare type SemaphorRecordsIntent = {
869
1367
  direction: 'asc' | 'desc';
870
1368
  };
871
1369
  inputs?: SemaphorInputBinding[];
1370
+ derivedFields?: SemaphorDerivedFieldDefinition[];
872
1371
  };
873
1372
 
874
1373
  declare type SemaphorRecordsResult = SemaphorAnalyticsResultBase & {
@@ -924,8 +1423,13 @@ declare type SemaphorResultColumn = {
924
1423
  dataType?: SemaphorFieldRef['dataType'];
925
1424
  aggregate?: SemaphorFieldRef['aggregate'];
926
1425
  source?: SemaphorFieldRef['source'];
1426
+ derivedField?: SemaphorDerivedFieldDefinition;
927
1427
  };
928
1428
 
1429
+ declare type SemaphorSemanticSourceRef = Extract<SemaphorSourceRef, {
1430
+ kind: 'semantic';
1431
+ }>;
1432
+
929
1433
  declare type SemaphorSourceRef = {
930
1434
  kind: 'semantic';
931
1435
  domainId: string;