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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/validators-oc8qtP4q.js");require("../chunks/source-identity-C-xaeE_I.js");const e=require("../chunks/validation-Dsf7PydY.js");exports.normalizeSemaphorAnalysisQueryOptions=e.normalizeSemaphorAnalysisQueryOptions;exports.validateSemaphorDataAppQuerySpecs=e.validateSemaphorDataAppQuerySpecs;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/validators-CgxWT8UX.js");require("../chunks/source-identity-C-xaeE_I.js");const e=require("../chunks/validation-DYL3ArlL.js");exports.normalizeSemaphorAnalysisQueryOptions=e.normalizeSemaphorAnalysisQueryOptions;exports.validateSemaphorDataAppQuerySpecs=e.validateSemaphorDataAppQuerySpecs;
@@ -1,7 +1,7 @@
1
- import "../chunks/validators-CVuWOHYv.js";
1
+ import "../chunks/validators-DBNa-eb1.js";
2
2
  import "../chunks/source-identity-Dj3dryN9.js";
3
- import { l as o, v as i } from "../chunks/validation-nOPr0mTk.js";
3
+ import { m as o, v as m } from "../chunks/validation-PPSpYtVf.js";
4
4
  export {
5
5
  o as normalizeSemaphorAnalysisQueryOptions,
6
- i as validateSemaphorDataAppQuerySpecs
6
+ m as validateSemaphorDataAppQuerySpecs
7
7
  };
@@ -76,6 +76,289 @@ export declare function isAnalyticsMetricIdentifierField(field: AnalyticsCatalog
76
76
 
77
77
  export declare function isAnalyticsTechnicalIdentifierField(field: AnalyticsCatalogField): boolean;
78
78
 
79
+ export declare type MatrixAxisLevelDescriptor = {
80
+ instanceId: string;
81
+ fieldKey: string;
82
+ label: string;
83
+ field: SemaphorFieldRef;
84
+ grain?: SemaphorTimeGrain;
85
+ subtotal?: SemaphorMatrixSubtotalOptions;
86
+ };
87
+
88
+ export declare type MatrixAxisPayload = {
89
+ id: 'rows' | 'columns';
90
+ levels: MatrixAxisLevelDescriptor[];
91
+ nodes: MatrixNode[];
92
+ };
93
+
94
+ export declare type MatrixCapability = 'rowHierarchy' | 'columnHierarchy' | 'rowSubtotals' | 'columnSubtotals' | 'grandTotals' | 'lazyRows' | 'lazyColumns' | 'conditionalFormatting' | 'visualExport' | (string & {});
95
+
96
+ export declare type MatrixCell = {
97
+ id: string;
98
+ rowNodeId: string;
99
+ columnNodeId?: string;
100
+ measureInstanceId: string;
101
+ rowPath: MatrixMemberPathSegment[];
102
+ columnPath: MatrixMemberPathSegment[];
103
+ rawValue: unknown;
104
+ presence: MatrixCellPresence;
105
+ formattedValue?: string;
106
+ role: MatrixCellRole;
107
+ aggregateFunction?: SemaphorAggregateFunction;
108
+ formattingScope: MatrixCellFormattingScope;
109
+ actions?: MatrixCellAction[];
110
+ };
111
+
112
+ export declare type MatrixCellAction = {
113
+ kind: 'requestSubgoal' | 'filter' | 'copyValue' | 'explainCalculation' | 'inspectContributingRows' | 'drillThrough' | (string & {});
114
+ label?: string;
115
+ payload?: Record<string, unknown>;
116
+ };
117
+
118
+ export declare type MatrixCellFormattingScope = {
119
+ rowNodeId: string;
120
+ columnNodeId?: string;
121
+ measureInstanceId: string;
122
+ role: MatrixCellRole;
123
+ rowPath: MatrixMemberPathSegment[];
124
+ columnPath: MatrixMemberPathSegment[];
125
+ };
126
+
127
+ export declare type MatrixCellPresence = 'present' | 'presentNull' | 'missing' | 'densified';
128
+
129
+ export declare type MatrixCellRole = 'value' | 'rowSubtotal' | 'columnSubtotal' | 'subtotalIntersection' | 'rowGrandTotal' | 'columnGrandTotal' | 'matrixGrandTotal';
130
+
131
+ export declare type MatrixExecutionMetadata = {
132
+ strategy?: MatrixQueryStrategy;
133
+ dialect?: SemaphorDialect;
134
+ rowNodeCount?: number;
135
+ columnNodeCount?: number;
136
+ cellCount?: number;
137
+ groupingSetCount?: number;
138
+ queryDurationMs?: number;
139
+ budgetRejected?: boolean;
140
+ cacheStatus?: 'hit' | 'miss' | 'bypass';
141
+ [key: string]: unknown;
142
+ };
143
+
144
+ export declare type MatrixExpansionRequest = {
145
+ axis: 'row' | 'column';
146
+ path: MatrixMemberPathSegment[];
147
+ depth?: number;
148
+ };
149
+
150
+ export declare type MatrixExpansionResponseHints = {
151
+ rowLazyLoading?: boolean;
152
+ columnLazyLoading?: boolean;
153
+ expandableRowNodeIds?: string[];
154
+ expandableColumnNodeIds?: string[];
155
+ nextRequests?: MatrixExpansionRequest[];
156
+ };
157
+
158
+ export declare type MatrixFieldDescriptor = {
159
+ instanceId: string;
160
+ fieldKey: string;
161
+ field: SemaphorFieldRef;
162
+ role: 'row' | 'column' | 'measure' | 'sort' | 'filter';
163
+ label?: string;
164
+ };
165
+
166
+ export declare type MatrixFieldDirectory = {
167
+ fieldsByInstanceId: Record<string, MatrixFieldDescriptor>;
168
+ };
169
+
170
+ export declare type MatrixFormattingContext = {
171
+ domains?: Record<string, {
172
+ min?: number;
173
+ max?: number;
174
+ }>;
175
+ rules?: Array<Record<string, unknown>>;
176
+ };
177
+
178
+ export declare type MatrixGridCell = {
179
+ id: string;
180
+ columnId: string;
181
+ cellId?: string;
182
+ rawValue: unknown;
183
+ formattedValue?: string;
184
+ presence: MatrixCellPresence;
185
+ role: MatrixCellRole;
186
+ measureInstanceId: string;
187
+ rowPath: MatrixMemberPathSegment[];
188
+ columnPath: MatrixMemberPathSegment[];
189
+ };
190
+
191
+ export declare type MatrixGridColumn = {
192
+ id: string;
193
+ label: string;
194
+ columnNodeId?: string;
195
+ columnPath: MatrixMemberPathSegment[];
196
+ measureInstanceId: string;
197
+ role: 'value' | 'columnSubtotal' | 'columnGrandTotal';
198
+ };
199
+
200
+ export declare type MatrixGridHeaderCell = {
201
+ id: string;
202
+ label: string;
203
+ role: 'rowHeader' | 'columnHeader' | 'measureHeader' | 'subtotal' | 'grandTotal';
204
+ colSpan: number;
205
+ rowSpan: number;
206
+ columnPath: MatrixMemberPathSegment[];
207
+ measureInstanceId?: string;
208
+ };
209
+
210
+ export declare type MatrixGridHeaderRow = {
211
+ id: string;
212
+ cells: MatrixGridHeaderCell[];
213
+ };
214
+
215
+ export declare type MatrixGridProjection = {
216
+ schemaVersion: 1;
217
+ shape: MatrixShape;
218
+ rowHeaderLevels: MatrixGridRowHeaderLevel[];
219
+ columnHeaderRows: MatrixGridHeaderRow[];
220
+ columns: MatrixGridColumn[];
221
+ rows: MatrixGridRow[];
222
+ };
223
+
224
+ export declare type MatrixGridRow = {
225
+ id: string;
226
+ rowNodeId: string;
227
+ rowPath: MatrixMemberPathSegment[];
228
+ depth: number;
229
+ label: string;
230
+ role: 'value' | 'rowSubtotal' | 'rowGrandTotal';
231
+ isExpanded?: boolean;
232
+ hasChildren?: boolean;
233
+ cells: MatrixGridCell[];
234
+ };
235
+
236
+ export declare type MatrixGridRowHeaderLevel = {
237
+ id: string;
238
+ label: string;
239
+ fieldInstanceId: string;
240
+ };
241
+
242
+ export declare type MatrixMeasureDescriptor = {
243
+ instanceId: string;
244
+ fieldKey: string;
245
+ label: string;
246
+ field: SemaphorFieldRef;
247
+ aggregate?: SemaphorAggregateFunction;
248
+ totalBehavior?: SemaphorMatrixTotalCalculation;
249
+ };
250
+
251
+ export declare type MatrixMeasureSemantics = {
252
+ kind: 'additive';
253
+ aggregate?: SemaphorAggregateFunction;
254
+ } | {
255
+ kind: 'semiAdditive';
256
+ aggregate?: SemaphorAggregateFunction;
257
+ grain?: SemaphorTimeGrain;
258
+ } | {
259
+ kind: 'nonAdditive';
260
+ aggregate?: SemaphorAggregateFunction;
261
+ } | {
262
+ kind: 'ratio';
263
+ numeratorMeasureInstanceId?: string;
264
+ denominatorMeasureInstanceId?: string;
265
+ } | {
266
+ kind: 'custom';
267
+ expressionId?: string;
268
+ };
269
+
270
+ export declare type MatrixMemberPathSegment = {
271
+ instanceId: string;
272
+ fieldKey: string;
273
+ value: unknown;
274
+ label: string;
275
+ };
276
+
277
+ export declare type MatrixNode = {
278
+ id: string;
279
+ axis: 'row' | 'column';
280
+ path: MatrixMemberPathSegment[];
281
+ level: number;
282
+ label: string;
283
+ value: unknown;
284
+ parentId?: string;
285
+ hasChildren: boolean;
286
+ isExpanded?: boolean;
287
+ isSubtotal?: boolean;
288
+ isGrandTotal?: boolean;
289
+ subtotalFunction?: SemaphorAggregateFunction;
290
+ childCount?: number;
291
+ actions?: MatrixNodeAction[];
292
+ };
293
+
294
+ export declare type MatrixNodeAction = {
295
+ kind: 'expand' | 'collapse' | 'requestSubgoal' | 'filter' | 'drillThrough' | 'openRelatedRecords' | (string & {});
296
+ label?: string;
297
+ payload?: Record<string, unknown>;
298
+ };
299
+
300
+ export declare type MatrixPageInfo = {
301
+ rowOffset?: number;
302
+ rowLimit?: number;
303
+ columnOffset?: number;
304
+ columnLimit?: number;
305
+ hasMoreRows?: boolean;
306
+ hasMoreColumns?: boolean;
307
+ };
308
+
309
+ export declare type MatrixPayload = {
310
+ kind: 'matrixPayload';
311
+ schemaVersion: 1;
312
+ shape: MatrixShape;
313
+ capabilities: MatrixCapability[];
314
+ executionMetadata: MatrixExecutionMetadata;
315
+ axes: {
316
+ rows: MatrixAxisPayload;
317
+ columns: MatrixAxisPayload;
318
+ };
319
+ measures: MatrixMeasureDescriptor[];
320
+ measureSemantics: Record<string, MatrixMeasureSemantics>;
321
+ fieldDirectory: MatrixFieldDirectory;
322
+ rowNodes: MatrixNode[];
323
+ columnNodes: MatrixNode[];
324
+ cells: MatrixCell[];
325
+ totals: MatrixTotals;
326
+ sort: MatrixResolvedSort[];
327
+ formattingContext: MatrixFormattingContext;
328
+ pageInfo?: MatrixPageInfo;
329
+ warnings?: MatrixWarning[];
330
+ };
331
+
332
+ export declare type MatrixQueryStrategy = 'tall' | 'wide' | 'lazy' | 'export';
333
+
334
+ export declare type MatrixResolvedSort = {
335
+ id: string;
336
+ axis: 'row' | 'column';
337
+ targetInstanceId?: string;
338
+ direction: 'asc' | 'desc';
339
+ nulls?: 'warehouseDefault' | 'first' | 'last';
340
+ scope?: 'global' | 'withinParent';
341
+ by: SemaphorMatrixSortRule['by'];
342
+ };
343
+
344
+ export declare type MatrixShape = 'hierarchical' | 'pivot';
345
+
346
+ export declare type MatrixTotals = {
347
+ rows?: boolean;
348
+ columns?: boolean;
349
+ grandTotal?: boolean | {
350
+ rows?: boolean;
351
+ columns?: boolean;
352
+ };
353
+ };
354
+
355
+ export declare type MatrixWarning = {
356
+ code: string;
357
+ message: string;
358
+ path?: string;
359
+ severity?: 'info' | 'warning' | 'error';
360
+ };
361
+
79
362
  export declare function normalizeAnalyticsCatalogDataType(value: unknown): AnalyticsCatalogDataType;
80
363
 
81
364
  export declare function normalizeAnalyticsCatalogName(value: unknown): string;
@@ -351,7 +634,7 @@ export declare type SemaphorAnalyticsFilterBase = {
351
634
 
352
635
  export declare type SemaphorAnalyticsFilterOperator = SemaphorInputOperator | 'not_contains' | 'is_null' | 'is_not_null';
353
636
 
354
- export declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
637
+ export declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent | SemaphorMatrixIntent;
355
638
 
356
639
  export declare type SemaphorAnalyticsIntentFixtureName = keyof typeof SEMAPHOR_ANALYTICS_INTENT_FIXTURES;
357
640
 
@@ -410,7 +693,7 @@ export declare type SemaphorAnalyticsRepairHint = {
410
693
  recommendedNextStep: string;
411
694
  };
412
695
 
413
- export declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult;
696
+ export declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult | SemaphorMatrixResult;
414
697
 
415
698
  export declare type SemaphorAnalyticsResultBase = {
416
699
  intentId?: string;
@@ -516,6 +799,14 @@ export declare type SemaphorExecutionFieldRef = SemaphorFieldRef & {
516
799
 
517
800
  export declare type SemaphorExperienceIntent = SemaphorDashboardIntent;
518
801
 
802
+ /**
803
+ * Explorer-backed table source. This is intentionally distinct from raw SQL:
804
+ * matrix planning needs stable source metadata, fields, and dialect context.
805
+ */
806
+ export declare type SemaphorExplorerSourceRef = Extract<SemaphorSourceRef, {
807
+ kind: 'physical';
808
+ }>;
809
+
519
810
  export declare type SemaphorFieldRef = {
520
811
  name: string;
521
812
  label?: string;
@@ -584,6 +875,157 @@ export declare type SemaphorInputSpec = {
584
875
  scope?: SemaphorInputScope;
585
876
  };
586
877
 
878
+ export declare type SemaphorMatrixAxisExpansionOptions = {
879
+ defaultDepth?: number;
880
+ lazy?: boolean;
881
+ expandedPaths?: SemaphorMatrixMemberPathSegment[][];
882
+ };
883
+
884
+ export declare type SemaphorMatrixAxisLevel = {
885
+ id?: string;
886
+ field: SemaphorFieldRef;
887
+ grain?: SemaphorTimeGrain;
888
+ label?: string;
889
+ subtotal?: boolean | SemaphorMatrixSubtotalOptions;
890
+ sortBy?: SemaphorMatrixAxisSortRule;
891
+ };
892
+
893
+ export declare type SemaphorMatrixAxisSortRule = {
894
+ direction: 'asc' | 'desc';
895
+ by: {
896
+ kind: 'label';
897
+ } | {
898
+ kind: 'field';
899
+ field: SemaphorFieldRef;
900
+ aggregate?: SemaphorAggregateFunction;
901
+ };
902
+ nulls?: 'warehouseDefault' | 'first' | 'last';
903
+ scope?: 'global' | 'withinParent';
904
+ };
905
+
906
+ export declare type SemaphorMatrixDisplayLimitOptions = {
907
+ rows?: SemaphorMatrixDisplayLimitRule;
908
+ columns?: SemaphorMatrixDisplayLimitRule;
909
+ };
910
+
911
+ export declare type SemaphorMatrixDisplayLimitRule = {
912
+ limit: number;
913
+ by?: 'label' | 'value';
914
+ direction?: 'top' | 'bottom';
915
+ others?: boolean | {
916
+ label?: string;
917
+ };
918
+ };
919
+
920
+ export declare type SemaphorMatrixExpansionOptions = {
921
+ rows?: SemaphorMatrixAxisExpansionOptions;
922
+ columns?: SemaphorMatrixAxisExpansionOptions;
923
+ };
924
+
925
+ export declare type SemaphorMatrixIntent = {
926
+ kind: 'matrix';
927
+ version?: SemaphorProtocolVersion;
928
+ id?: string;
929
+ label?: string;
930
+ source: SemaphorMatrixSourceRef;
931
+ rows: SemaphorMatrixAxisLevel[];
932
+ columns?: SemaphorMatrixAxisLevel[];
933
+ values: SemaphorMatrixValueField[];
934
+ filters?: SemaphorAnalyticsFilter[];
935
+ inputs?: SemaphorInputBinding[];
936
+ totals?: SemaphorMatrixTotalOptions;
937
+ sort?: SemaphorMatrixSortRule[];
938
+ expansion?: SemaphorMatrixExpansionOptions;
939
+ layout?: SemaphorMatrixLayoutOptions;
940
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
941
+ };
942
+
943
+ export declare type SemaphorMatrixLayoutOptions = {
944
+ hierarchy?: 'compact' | 'tabular' | 'outline';
945
+ valuesPlacement?: 'columns' | 'rows';
946
+ stickyRowHeaders?: boolean;
947
+ stickyColumnHeaders?: boolean;
948
+ };
949
+
950
+ export declare type SemaphorMatrixMemberPathSegment = {
951
+ levelId: string;
952
+ value: unknown;
953
+ };
954
+
955
+ export declare type SemaphorMatrixResult = SemaphorAnalyticsResultBase & {
956
+ kind: 'matrix';
957
+ intent: SemaphorMatrixIntent;
958
+ payload: MatrixPayload;
959
+ grid: MatrixGridProjection;
960
+ expansion?: MatrixExpansionResponseHints;
961
+ };
962
+
963
+ export declare type SemaphorMatrixSortRule = {
964
+ axis: 'row' | 'column';
965
+ targetId?: string;
966
+ direction: 'asc' | 'desc';
967
+ by: {
968
+ kind: 'label';
969
+ } | {
970
+ kind: 'field';
971
+ field: SemaphorFieldRef;
972
+ aggregate?: SemaphorAggregateFunction;
973
+ } | {
974
+ kind: 'value';
975
+ valueId: string;
976
+ rowPath?: SemaphorMatrixMemberPathSegment[];
977
+ columnPath?: SemaphorMatrixMemberPathSegment[];
978
+ };
979
+ nulls?: 'warehouseDefault' | 'first' | 'last';
980
+ scope?: 'global' | 'withinParent';
981
+ };
982
+
983
+ export declare type SemaphorMatrixSourceRef = SemaphorSemanticSourceRef | SemaphorExplorerSourceRef;
984
+
985
+ export declare type SemaphorMatrixSubtotalOptions = {
986
+ enabled?: boolean;
987
+ position?: 'before' | 'after';
988
+ label?: string;
989
+ };
990
+
991
+ export declare type SemaphorMatrixTotalCalculation = {
992
+ kind: 'defaultAggregate';
993
+ } | {
994
+ kind: 'blank';
995
+ } | {
996
+ kind: 'labelOnly';
997
+ label?: string;
998
+ } | {
999
+ kind: 'customAggregate';
1000
+ aggregate: SemaphorAggregateFunction;
1001
+ } | {
1002
+ kind: 'percentOfParent';
1003
+ } | {
1004
+ kind: 'percentOfGrandTotal';
1005
+ } | {
1006
+ kind: 'customExpression';
1007
+ expressionId: string;
1008
+ };
1009
+
1010
+ export declare type SemaphorMatrixTotalOptions = {
1011
+ rows?: boolean | 'perLevel';
1012
+ columns?: boolean | 'perLevel';
1013
+ grandTotal?: boolean | {
1014
+ rows?: boolean;
1015
+ columns?: boolean;
1016
+ };
1017
+ rowPosition?: 'top' | 'bottom';
1018
+ columnPosition?: 'left' | 'right';
1019
+ };
1020
+
1021
+ export declare type SemaphorMatrixValueField = {
1022
+ id?: string;
1023
+ field: SemaphorFieldRef;
1024
+ aggregate?: SemaphorAggregateFunction;
1025
+ label?: string;
1026
+ totalBehavior?: SemaphorMatrixTotalCalculation;
1027
+ };
1028
+
587
1029
  export declare type SemaphorMetricAggregateSource = 'semantic_model' | 'caller_override' | 'default_sum';
588
1030
 
589
1031
  export declare type SemaphorMetricAnalysis = {
@@ -758,6 +1200,10 @@ export declare type SemaphorResultColumn = {
758
1200
  source?: SemaphorFieldRef['source'];
759
1201
  };
760
1202
 
1203
+ export declare type SemaphorSemanticSourceRef = Extract<SemaphorSourceRef, {
1204
+ kind: 'semantic';
1205
+ }>;
1206
+
761
1207
  export declare type SemaphorSourceCoordinateInput = {
762
1208
  databaseName?: string;
763
1209
  schemaName?: string;
@@ -847,6 +1293,9 @@ export declare type SemaphorViewPresentation = {
847
1293
  } | {
848
1294
  kind: 'table';
849
1295
  columns?: string[];
1296
+ } | {
1297
+ kind: 'matrixTable';
1298
+ mode?: 'auto' | 'pivot' | 'hierarchical';
850
1299
  } | {
851
1300
  kind: 'text';
852
1301
  };