react-semaphor 0.1.368 → 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.
Files changed (65) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +1 -1
  3. package/dist/brand-studio/index.cjs +5 -5
  4. package/dist/brand-studio/index.js +24 -23
  5. package/dist/chunks/{braces-Cc86y9Ov.js → braces-C3-w6xDL.js} +1 -1
  6. package/dist/chunks/{braces-CXvY9MwQ.js → braces-C8QqW4wu.js} +1 -1
  7. package/dist/chunks/{calendar-preferences-dialog-BOFlzOJg.js → calendar-preferences-dialog-6q51A6XC.js} +3 -3
  8. package/dist/chunks/{calendar-preferences-dialog-ZzwfJv2J.js → calendar-preferences-dialog-CUGzkNcE.js} +1 -1
  9. package/dist/chunks/{chevrons-up-down-CUZL1zaU.js → chevrons-up-down-CnCSGY02.js} +1 -1
  10. package/dist/chunks/{chevrons-up-down-qQMadOWA.js → chevrons-up-down-DSvLu4Ye.js} +1 -1
  11. package/dist/chunks/{dashboard-briefing-launcher-9-PCYMjR.js → dashboard-briefing-launcher-BEZnvIla.js} +1 -1
  12. package/dist/chunks/{dashboard-briefing-launcher-D2lBFqAd.js → dashboard-briefing-launcher-ptERmNJr.js} +176 -177
  13. package/dist/chunks/{dashboard-controls-D4bUHAjX.js → dashboard-controls-CGt6_hMf.js} +11 -11
  14. package/dist/chunks/{dashboard-controls-BIk094Ah.js → dashboard-controls-CqKC5oEk.js} +77 -77
  15. package/dist/chunks/{dashboard-json-DImOf512.js → dashboard-json-6SgPm_QW.js} +13 -14
  16. package/dist/chunks/dashboard-json-CYSbOdmE.js +1 -0
  17. package/dist/chunks/{edit-dashboard-visual-DTxkV6Fl.js → edit-dashboard-visual-ByQx_M2i.js} +8 -9
  18. package/dist/chunks/{edit-dashboard-visual-BHKlcqQR.js → edit-dashboard-visual-w6hKbjlw.js} +1 -1
  19. package/dist/chunks/index-BtqYNH_S.js +1361 -0
  20. package/dist/chunks/{index-BVEIk-rB.js → index-CPyEi9gS.js} +72498 -76193
  21. package/dist/chunks/{palette-DPuAc82h.js → palette-D-f4-82S.js} +1 -1
  22. package/dist/chunks/{palette-C1k347Tb.js → palette-DUGktM-M.js} +1 -1
  23. package/dist/chunks/{resource-management-panel-BeHceP2D.js → resource-management-panel-Bf8-3eUf.js} +1 -1
  24. package/dist/chunks/{resource-management-panel-BOfbSf48.js → resource-management-panel-mJ84NxzC.js} +152 -152
  25. package/dist/chunks/save-D3YYinDz.js +6 -0
  26. package/dist/chunks/save-kkBEBeLg.js +21 -0
  27. package/dist/chunks/{switch-xcWLtWs0.js → switch-Dkx2qEOr.js} +758 -776
  28. package/dist/chunks/{switch-C0S63HAv.js → switch-fIkmwzUt.js} +27 -32
  29. package/dist/chunks/{use-create-flow-overlay-state-B5FygfQL.js → use-create-flow-overlay-state-BfoXDDrd.js} +190 -189
  30. package/dist/chunks/use-create-flow-overlay-state-c6rCm36x.js +26 -0
  31. package/dist/chunks/{use-visual-utils-DxDE8S8M.js → use-visual-utils-C_c-aiqi.js} +1 -1
  32. package/dist/chunks/{use-visual-utils-CszWnFBW.js → use-visual-utils-NN0e3fBP.js} +13 -13
  33. package/dist/chunks/validation-DYL3ArlL.js +1 -0
  34. package/dist/chunks/validation-PPSpYtVf.js +900 -0
  35. package/dist/chunks/validators-CgxWT8UX.js +1 -0
  36. package/dist/chunks/validators-DBNa-eb1.js +1799 -0
  37. package/dist/dashboard/index.cjs +1 -1
  38. package/dist/dashboard/index.js +1 -1
  39. package/dist/dashboard-authoring/index.cjs +1 -1
  40. package/dist/dashboard-authoring/index.js +1 -1
  41. package/dist/data-app-builder/index.cjs +51 -1
  42. package/dist/data-app-builder/index.js +3666 -2
  43. package/dist/data-app-sdk/index.cjs +1 -1
  44. package/dist/data-app-sdk/index.js +661 -389
  45. package/dist/data-app-sdk-validation/index.cjs +1 -1
  46. package/dist/data-app-sdk-validation/index.js +4 -4
  47. package/dist/index.cjs +1 -1
  48. package/dist/index.js +14 -14
  49. package/dist/surfboard/index.cjs +1 -1
  50. package/dist/surfboard/index.js +2 -2
  51. package/dist/types/analytics-protocol.d.ts +472 -3
  52. package/dist/types/dashboard-assistant.d.ts +469 -3
  53. package/dist/types/dashboard-authoring.d.ts +170 -2
  54. package/dist/types/data-app-builder.d.ts +167 -2
  55. package/dist/types/data-app-sdk-validation.d.ts +576 -25
  56. package/dist/types/data-app-sdk.d.ts +655 -37
  57. package/dist/types/main.d.ts +167 -2
  58. package/package.json +1 -1
  59. package/dist/chunks/dashboard-json-Bo1kX6W1.js +0 -1
  60. package/dist/chunks/index-HjDeEytV.js +0 -1411
  61. package/dist/chunks/use-create-flow-overlay-state-DOXTbTcQ.js +0 -26
  62. package/dist/chunks/validation-CrUjNWby.js +0 -689
  63. package/dist/chunks/validation-DGl8wnTt.js +0 -1
  64. package/dist/chunks/validators-Dq5X4mp0.js +0 -1
  65. package/dist/chunks/validators-L0xEXtjf.js +0 -965
@@ -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;
@@ -51,6 +334,10 @@ declare type SemaphorAggregateFunction = 'SUM' | 'COUNT' | 'AVG' | 'MIN' | 'MAX'
51
334
 
52
335
  declare type SemaphorAnalysisDriverMode = 'absolute_delta' | 'largest_negative' | 'largest_positive' | 'positive_and_negative' | 'all';
53
336
 
337
+ declare type SemaphorAnalysisQueryDefinition = SemaphorAnalysisQuerySpec & {
338
+ queryKind: 'analysis';
339
+ };
340
+
54
341
  export declare type SemaphorAnalysisQueryOptions = {
55
342
  chartTitle?: string;
56
343
  chartType?: string;
@@ -124,7 +411,7 @@ declare type SemaphorAnalyticsFilterBase = {
124
411
 
125
412
  declare type SemaphorAnalyticsFilterOperator = SemaphorInputOperator | 'not_contains' | 'is_null' | 'is_not_null';
126
413
 
127
- declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
414
+ declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent | SemaphorMatrixIntent;
128
415
 
129
416
  declare type SemaphorAnalyticsNullFilter = SemaphorAnalyticsFilterBase & {
130
417
  operator: SemaphorAnalyticsNullFilterOperator;
@@ -149,7 +436,7 @@ declare type SemaphorAnalyticsRepairHint = {
149
436
  recommendedNextStep: string;
150
437
  };
151
438
 
152
- declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult;
439
+ declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult | SemaphorMatrixResult;
153
440
 
154
441
  declare type SemaphorAnalyticsResultBase = {
155
442
  intentId?: string;
@@ -158,6 +445,7 @@ declare type SemaphorAnalyticsResultBase = {
158
445
  rowCount?: number;
159
446
  rowLimitExceeded?: boolean;
160
447
  limit?: number;
448
+ pagination?: SemaphorPaginationMetadata;
161
449
  };
162
450
 
163
451
  declare type SemaphorAnalyticsValidationCode = 'missing_source' | 'invalid_source_kind' | 'missing_semantic_domain' | 'missing_dataset_name' | 'missing_connection_id' | 'missing_table_name' | 'missing_sql' | 'missing_metric' | 'missing_record_fields' | 'missing_input_options_field' | 'invalid_metric' | 'invalid_metric_list' | 'invalid_date_field' | 'invalid_dimension' | 'invalid_metric_dimensions' | 'conflicting_sql' | 'sql_policy_violation' | 'unsupported_intent_for_adapter' | 'invalid_analytics_kind' | 'invalid_analytics_intent';
@@ -209,6 +497,11 @@ declare type SemaphorCompiledQuery = {
209
497
  analyticsIntent?: SemaphorAnalyticsIntent;
210
498
  };
211
499
 
500
+ declare type SemaphorControlInputSpec<TValue extends SemaphorInputValue = SemaphorInputValue> = SemaphorInputBase<TValue> & {
501
+ kind: 'control';
502
+ role: SemaphorControlRole;
503
+ };
504
+
212
505
  declare type SemaphorControlRole = 'grain' | 'metric' | 'dimension' | 'aggregation' | 'sqlParam';
213
506
 
214
507
  export declare type SemaphorDataAppFieldCatalog = {
@@ -217,23 +510,14 @@ export declare type SemaphorDataAppFieldCatalog = {
217
510
  fields: SemaphorFieldRef[];
218
511
  };
219
512
 
220
- export declare type SemaphorDataAppHookSpec = {
221
- hook: 'useSemaphorAnalysis';
222
- spec: SemaphorAnalysisQuerySpec;
223
- } | {
224
- hook: 'useSemaphorMetric';
225
- spec: SemaphorMetricQuerySpec;
226
- } | {
227
- hook: 'useSemaphorRecords';
228
- spec: SemaphorRecordsQuerySpec;
229
- } | {
230
- hook: 'useSemaphorInputOptions';
231
- spec: SemaphorInputOptionsQuerySpec;
513
+ export declare type SemaphorDataAppQuerySpecEnvelope = {
514
+ queryHook: 'useSemaphorQuery';
515
+ spec: SemaphorQueryDefinition;
232
516
  };
233
517
 
234
- export declare type SemaphorDataAppHookValidation = {
235
- hook: SemaphorDataAppHookSpec['hook'];
236
- hookId?: string;
518
+ export declare type SemaphorDataAppQueryValidation = {
519
+ queryHook: SemaphorDataAppQuerySpecEnvelope['queryHook'];
520
+ queryId?: string;
237
521
  intent?: SemaphorAnalyticsIntent;
238
522
  diagnostics: SemaphorDataAppValidationDiagnostic[];
239
523
  executionResult: SemaphorAnalyticsExecutionResult;
@@ -241,11 +525,11 @@ export declare type SemaphorDataAppHookValidation = {
241
525
 
242
526
  export declare type SemaphorDataAppValidationDiagnostic = {
243
527
  severity: 'error' | 'warning';
244
- code: 'invalid_hook_spec' | 'invalid_analytics_intent' | 'invalid_source_ref' | 'missing_field' | 'unsupported_input_filter_composition' | string;
528
+ code: 'invalid_query_spec' | 'invalid_analytics_intent' | 'invalid_source_ref' | 'missing_field' | 'unsupported_input_filter_composition' | string;
245
529
  message: string;
246
530
  path?: string;
247
- hook?: SemaphorDataAppHookSpec['hook'];
248
- hookId?: string;
531
+ queryHook?: SemaphorDataAppQuerySpecEnvelope['queryHook'];
532
+ queryId?: string;
249
533
  intentId?: string;
250
534
  source?: SemaphorSourceRef;
251
535
  field?: SemaphorFieldRef;
@@ -254,7 +538,7 @@ export declare type SemaphorDataAppValidationDiagnostic = {
254
538
  export declare type SemaphorDataAppValidationResult = {
255
539
  ok: boolean;
256
540
  diagnostics: SemaphorDataAppValidationDiagnostic[];
257
- hooks: SemaphorDataAppHookValidation[];
541
+ queries: SemaphorDataAppQueryValidation[];
258
542
  intents: SemaphorAnalyticsIntent[];
259
543
  executionResults: SemaphorAnalyticsExecutionResult[];
260
544
  };
@@ -267,6 +551,14 @@ declare type SemaphorExecutionFieldRef = SemaphorFieldRef & {
267
551
  aggregateSource?: SemaphorMetricAggregateSource;
268
552
  };
269
553
 
554
+ /**
555
+ * Explorer-backed table source. This is intentionally distinct from raw SQL:
556
+ * matrix planning needs stable source metadata, fields, and dialect context.
557
+ */
558
+ declare type SemaphorExplorerSourceRef = Extract<SemaphorSourceRef, {
559
+ kind: 'physical';
560
+ }>;
561
+
270
562
  declare type SemaphorFieldRef = {
271
563
  name: string;
272
564
  label?: string;
@@ -276,8 +568,29 @@ declare type SemaphorFieldRef = {
276
568
  aggregate?: SemaphorAggregateFunction;
277
569
  };
278
570
 
571
+ declare type SemaphorFilterInputSpec<TValue extends SemaphorInputValue = SemaphorInputValue> = SemaphorInputBase<TValue> & {
572
+ kind: 'filter';
573
+ field: SemaphorQueryField;
574
+ operator?: SemaphorInputOperatorInput;
575
+ multi?: boolean;
576
+ };
577
+
578
+ declare type SemaphorInputBase<TValue extends SemaphorInputValue> = {
579
+ id: string;
580
+ label?: string;
581
+ value?: TValue;
582
+ defaultValue?: TValue;
583
+ onValueChange?: {
584
+ bivarianceHack(value: TValue | undefined): void;
585
+ }['bivarianceHack'];
586
+ options?: Array<SemaphorInputOption | SemaphorOptionValue>;
587
+ };
588
+
279
589
  declare type SemaphorInputBinding = {
280
590
  inputId: string;
591
+ kind?: 'filter' | 'control';
592
+ controlRole?: 'grain' | 'metric' | 'dimension' | 'aggregation' | 'sqlParam';
593
+ operator?: SemaphorInputOperator;
281
594
  field?: SemaphorFieldRef;
282
595
  };
283
596
 
@@ -298,6 +611,10 @@ declare type SemaphorInputHandle<TValue extends SemaphorInputValue = SemaphorInp
298
611
 
299
612
  declare type SemaphorInputOperator = '=' | '!=' | 'in' | 'not_in' | 'contains' | 'not_contains' | 'between' | 'not_between' | '>' | '>=' | '<' | '<=';
300
613
 
614
+ declare type SemaphorInputOperatorAlias = 'eq' | 'equals' | 'not_equals' | 'neq' | 'not equal' | 'not equals' | 'not in' | 'like' | 'not_contains' | 'not contains' | 'not_like' | 'not like' | 'not_between' | 'not between';
615
+
616
+ declare type SemaphorInputOperatorInput = SemaphorInputOperator | SemaphorInputOperatorAlias;
617
+
301
618
  declare type SemaphorInputOption = {
302
619
  label: string;
303
620
  value: SemaphorOptionValue;
@@ -315,6 +632,10 @@ declare type SemaphorInputOptionsIntent = {
315
632
  limit?: number;
316
633
  };
317
634
 
635
+ declare type SemaphorInputOptionsQueryDefinition = SemaphorInputOptionsQuerySpec & {
636
+ queryKind: 'inputOptions';
637
+ };
638
+
318
639
  declare type SemaphorInputOptionsQuerySpec = SemaphorQuerySourceSpec & {
319
640
  id?: string;
320
641
  label?: string;
@@ -332,10 +653,184 @@ declare type SemaphorInputOptionsResult = SemaphorAnalyticsResultBase & {
332
653
  }>;
333
654
  };
334
655
 
335
- declare type SemaphorInputReference = SemaphorInputBinding | SemaphorActiveInput | SemaphorInputHandle;
656
+ declare type SemaphorInputReference = SemaphorInputSpec | SemaphorInputBinding | SemaphorActiveInput | SemaphorInputHandle;
657
+
658
+ declare type SemaphorInputSpec<TValue extends SemaphorInputValue = SemaphorInputValue> = SemaphorFilterInputSpec<TValue> | SemaphorControlInputSpec<TValue>;
336
659
 
337
660
  declare type SemaphorInputValue = SemaphorScalar | SemaphorScalar[];
338
661
 
662
+ declare type SemaphorMatrixAxisExpansionOptions = {
663
+ defaultDepth?: number;
664
+ lazy?: boolean;
665
+ expandedPaths?: SemaphorMatrixMemberPathSegment[][];
666
+ };
667
+
668
+ declare type SemaphorMatrixAxisLevel = {
669
+ id?: string;
670
+ field: SemaphorFieldRef;
671
+ grain?: SemaphorTimeGrain;
672
+ label?: string;
673
+ subtotal?: boolean | SemaphorMatrixSubtotalOptions;
674
+ sortBy?: SemaphorMatrixAxisSortRule;
675
+ };
676
+
677
+ declare type SemaphorMatrixAxisLevelInput = SemaphorQueryField | SemaphorMatrixAxisLevel;
678
+
679
+ declare type SemaphorMatrixAxisSortRule = {
680
+ direction: 'asc' | 'desc';
681
+ by: {
682
+ kind: 'label';
683
+ } | {
684
+ kind: 'field';
685
+ field: SemaphorFieldRef;
686
+ aggregate?: SemaphorAggregateFunction;
687
+ };
688
+ nulls?: 'warehouseDefault' | 'first' | 'last';
689
+ scope?: 'global' | 'withinParent';
690
+ };
691
+
692
+ declare type SemaphorMatrixDisplayLimitOptions = {
693
+ rows?: SemaphorMatrixDisplayLimitRule;
694
+ columns?: SemaphorMatrixDisplayLimitRule;
695
+ };
696
+
697
+ declare type SemaphorMatrixDisplayLimitRule = {
698
+ limit: number;
699
+ by?: 'label' | 'value';
700
+ direction?: 'top' | 'bottom';
701
+ others?: boolean | {
702
+ label?: string;
703
+ };
704
+ };
705
+
706
+ declare type SemaphorMatrixExpansionOptions = {
707
+ rows?: SemaphorMatrixAxisExpansionOptions;
708
+ columns?: SemaphorMatrixAxisExpansionOptions;
709
+ };
710
+
711
+ declare type SemaphorMatrixIntent = {
712
+ kind: 'matrix';
713
+ version?: SemaphorProtocolVersion;
714
+ id?: string;
715
+ label?: string;
716
+ source: SemaphorMatrixSourceRef;
717
+ rows: SemaphorMatrixAxisLevel[];
718
+ columns?: SemaphorMatrixAxisLevel[];
719
+ values: SemaphorMatrixValueField[];
720
+ filters?: SemaphorAnalyticsFilter[];
721
+ inputs?: SemaphorInputBinding[];
722
+ totals?: SemaphorMatrixTotalOptions;
723
+ sort?: SemaphorMatrixSortRule[];
724
+ expansion?: SemaphorMatrixExpansionOptions;
725
+ layout?: SemaphorMatrixLayoutOptions;
726
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
727
+ };
728
+
729
+ declare type SemaphorMatrixLayoutOptions = {
730
+ hierarchy?: 'compact' | 'tabular' | 'outline';
731
+ valuesPlacement?: 'columns' | 'rows';
732
+ stickyRowHeaders?: boolean;
733
+ stickyColumnHeaders?: boolean;
734
+ };
735
+
736
+ declare type SemaphorMatrixMemberPathSegment = {
737
+ levelId: string;
738
+ value: unknown;
739
+ };
740
+
741
+ declare type SemaphorMatrixQueryDefinition = SemaphorMatrixQuerySpec & {
742
+ queryKind: 'matrix';
743
+ };
744
+
745
+ declare type SemaphorMatrixQuerySpec = Omit<SemaphorMatrixIntent, 'kind' | 'version' | 'rows' | 'columns' | 'values' | 'source' | 'inputs'> & {
746
+ source: SemaphorMatrixSourceRef;
747
+ rows: SemaphorNonEmptyArray<SemaphorMatrixAxisLevelInput>;
748
+ columns?: SemaphorMatrixAxisLevelInput[];
749
+ values: SemaphorNonEmptyArray<SemaphorMatrixValueFieldInput>;
750
+ inputs?: SemaphorInputReference[];
751
+ totals?: SemaphorMatrixTotalOptions;
752
+ sort?: SemaphorMatrixSortRule[];
753
+ expansion?: SemaphorMatrixExpansionOptions;
754
+ layout?: SemaphorMatrixIntent['layout'];
755
+ displayLimits?: SemaphorMatrixDisplayLimitOptions;
756
+ };
757
+
758
+ declare type SemaphorMatrixResult = SemaphorAnalyticsResultBase & {
759
+ kind: 'matrix';
760
+ intent: SemaphorMatrixIntent;
761
+ payload: MatrixPayload;
762
+ grid: MatrixGridProjection;
763
+ expansion?: MatrixExpansionResponseHints;
764
+ };
765
+
766
+ declare type SemaphorMatrixSortRule = {
767
+ axis: 'row' | 'column';
768
+ targetId?: string;
769
+ direction: 'asc' | 'desc';
770
+ by: {
771
+ kind: 'label';
772
+ } | {
773
+ kind: 'field';
774
+ field: SemaphorFieldRef;
775
+ aggregate?: SemaphorAggregateFunction;
776
+ } | {
777
+ kind: 'value';
778
+ valueId: string;
779
+ rowPath?: SemaphorMatrixMemberPathSegment[];
780
+ columnPath?: SemaphorMatrixMemberPathSegment[];
781
+ };
782
+ nulls?: 'warehouseDefault' | 'first' | 'last';
783
+ scope?: 'global' | 'withinParent';
784
+ };
785
+
786
+ declare type SemaphorMatrixSourceRef = SemaphorSemanticSourceRef | SemaphorExplorerSourceRef;
787
+
788
+ declare type SemaphorMatrixSubtotalOptions = {
789
+ enabled?: boolean;
790
+ position?: 'before' | 'after';
791
+ label?: string;
792
+ };
793
+
794
+ declare type SemaphorMatrixTotalCalculation = {
795
+ kind: 'defaultAggregate';
796
+ } | {
797
+ kind: 'blank';
798
+ } | {
799
+ kind: 'labelOnly';
800
+ label?: string;
801
+ } | {
802
+ kind: 'customAggregate';
803
+ aggregate: SemaphorAggregateFunction;
804
+ } | {
805
+ kind: 'percentOfParent';
806
+ } | {
807
+ kind: 'percentOfGrandTotal';
808
+ } | {
809
+ kind: 'customExpression';
810
+ expressionId: string;
811
+ };
812
+
813
+ declare type SemaphorMatrixTotalOptions = {
814
+ rows?: boolean | 'perLevel';
815
+ columns?: boolean | 'perLevel';
816
+ grandTotal?: boolean | {
817
+ rows?: boolean;
818
+ columns?: boolean;
819
+ };
820
+ rowPosition?: 'top' | 'bottom';
821
+ columnPosition?: 'left' | 'right';
822
+ };
823
+
824
+ declare type SemaphorMatrixValueField = {
825
+ id?: string;
826
+ field: SemaphorFieldRef;
827
+ aggregate?: SemaphorAggregateFunction;
828
+ label?: string;
829
+ totalBehavior?: SemaphorMatrixTotalCalculation;
830
+ };
831
+
832
+ declare type SemaphorMatrixValueFieldInput = SemaphorQueryField | SemaphorMatrixValueField;
833
+
339
834
  declare type SemaphorMetricAggregateSource = 'semantic_model' | 'caller_override' | 'default_sum';
340
835
 
341
836
  declare type SemaphorMetricAnalysis = {
@@ -376,6 +871,10 @@ declare type SemaphorMetricIntent = {
376
871
  limit?: number;
377
872
  };
378
873
 
874
+ declare type SemaphorMetricQueryDefinition = SemaphorMetricQuerySpec & {
875
+ queryKind: 'metric';
876
+ };
877
+
379
878
  declare type SemaphorMetricQuerySpec = SemaphorQuerySourceSpec & {
380
879
  id?: string;
381
880
  label?: string;
@@ -405,6 +904,20 @@ declare type SemaphorNonEmptyArray<T> = [T, ...T[]];
405
904
 
406
905
  declare type SemaphorOptionValue = string | number | boolean;
407
906
 
907
+ declare type SemaphorPaginationMetadata = {
908
+ page: number;
909
+ pageSize: number;
910
+ pageCount: number;
911
+ totalCount: number;
912
+ hasNextPage: boolean;
913
+ hasPrevPage: boolean;
914
+ };
915
+
916
+ declare type SemaphorPaginationRequest = {
917
+ page: number;
918
+ pageSize: number;
919
+ };
920
+
408
921
  declare type SemaphorProtocolIssue = {
409
922
  code: string;
410
923
  message: string;
@@ -413,6 +926,8 @@ declare type SemaphorProtocolIssue = {
413
926
 
414
927
  declare type SemaphorProtocolVersion = 1;
415
928
 
929
+ declare type SemaphorQueryDefinition = SemaphorMetricQueryDefinition | SemaphorAnalysisQueryDefinition | SemaphorRecordsQueryDefinition | SemaphorInputOptionsQueryDefinition | SemaphorSqlQueryDefinition | SemaphorMatrixQueryDefinition;
930
+
416
931
  declare type SemaphorQueryField = SemaphorFieldRef;
417
932
 
418
933
  declare type SemaphorQueryOrderBy = {
@@ -436,6 +951,7 @@ declare type SemaphorRecordsBaseQuerySpec = SemaphorQuerySourceSpec & {
436
951
  orderBy?: SemaphorRecordsOrderBy;
437
952
  inputs?: SemaphorInputReference[];
438
953
  limit?: number;
954
+ pagination?: SemaphorPaginationRequest;
439
955
  };
440
956
 
441
957
  declare type SemaphorRecordsField = SemaphorFieldRef & {
@@ -454,6 +970,7 @@ declare type SemaphorRecordsIntent = {
454
970
  timeWindow?: SemaphorTimeWindow;
455
971
  filters?: SemaphorAnalyticsFilter[];
456
972
  limit?: number;
973
+ pagination?: SemaphorPaginationRequest;
457
974
  orderBy?: {
458
975
  field: SemaphorFieldRef;
459
976
  direction: 'asc' | 'desc';
@@ -463,6 +980,10 @@ declare type SemaphorRecordsIntent = {
463
980
 
464
981
  declare type SemaphorRecordsOrderBy = SemaphorQueryOrderBy;
465
982
 
983
+ declare type SemaphorRecordsQueryDefinition = SemaphorRecordsQuerySpec & {
984
+ queryKind: 'records';
985
+ };
986
+
466
987
  declare type SemaphorRecordsQuerySpec = SemaphorRecordsBaseQuerySpec & SemaphorRecordsSelectorSpec;
467
988
 
468
989
  declare type SemaphorRecordsResult = SemaphorAnalyticsResultBase & {
@@ -526,6 +1047,10 @@ declare type SemaphorResultColumn = {
526
1047
 
527
1048
  declare type SemaphorScalar = string | number | boolean | null;
528
1049
 
1050
+ declare type SemaphorSemanticSourceRef = Extract<SemaphorSourceRef, {
1051
+ kind: 'semantic';
1052
+ }>;
1053
+
529
1054
  declare type SemaphorSourceRef = {
530
1055
  kind: 'semantic';
531
1056
  domainId: string;
@@ -558,14 +1083,34 @@ declare type SemaphorSqlIntent = {
558
1083
  kind: 'sql';
559
1084
  }>;
560
1085
  sql: string;
561
- parameters?: Record<string, unknown>;
1086
+ defaultParameters?: Record<string, unknown>;
562
1087
  pythonCode?: string;
563
1088
  limit?: number;
1089
+ pagination?: SemaphorPaginationRequest;
564
1090
  rationale?: string;
565
1091
  fields?: SemaphorFieldRef[];
566
1092
  inputs?: SemaphorInputBinding[];
567
1093
  };
568
1094
 
1095
+ declare type SemaphorSqlParameterValue = SemaphorScalar | SemaphorScalar[];
1096
+
1097
+ declare type SemaphorSqlQueryDefinition = SemaphorSqlQuerySpec & {
1098
+ queryKind: 'sql';
1099
+ };
1100
+
1101
+ declare type SemaphorSqlQuerySpec = SemaphorSqlSourceSpec & {
1102
+ id?: string;
1103
+ label?: string;
1104
+ sql: string;
1105
+ defaultParameters?: Record<string, SemaphorSqlParameterValue>;
1106
+ pythonCode?: string;
1107
+ fields?: SemaphorFieldRef[];
1108
+ inputs?: SemaphorInputReference[];
1109
+ limit?: number;
1110
+ pagination?: SemaphorPaginationRequest;
1111
+ rationale?: string;
1112
+ };
1113
+
569
1114
  declare type SemaphorSqlResult = SemaphorAnalyticsResultBase & {
570
1115
  kind: 'sql';
571
1116
  columns: SemaphorRecordsResult['columns'];
@@ -577,12 +1122,18 @@ declare type SemaphorSqlResult = SemaphorAnalyticsResultBase & {
577
1122
  };
578
1123
  };
579
1124
 
1125
+ declare type SemaphorSqlSourceSpec = {
1126
+ source: Extract<SemaphorSourceRef, {
1127
+ kind: 'sql';
1128
+ }>;
1129
+ };
1130
+
580
1131
  declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
581
1132
 
582
1133
  declare type SemaphorTimeWindow = SemaphorRelativeTimeWindow | SemaphorAbsoluteTimeWindow;
583
1134
 
584
- export declare function validateSemaphorDataAppHookSpecs(input: {
585
- hooks: SemaphorDataAppHookSpec[];
1135
+ export declare function validateSemaphorDataAppQuerySpecs(input: {
1136
+ queries: SemaphorDataAppQuerySpecEnvelope[];
586
1137
  fieldCatalogs?: SemaphorDataAppFieldCatalog[];
587
1138
  requireFieldCatalog?: boolean;
588
1139
  validateTimezone?: SemaphorAnalysisTimezoneValidator;