react-semaphor 0.1.368 → 0.1.369

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 (64) 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-Dsf7PydY.js +1 -0
  34. package/dist/chunks/validation-nOPr0mTk.js +803 -0
  35. package/dist/chunks/{validators-L0xEXtjf.js → validators-CVuWOHYv.js} +225 -158
  36. package/dist/chunks/validators-oc8qtP4q.js +1 -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 +589 -388
  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 +21 -1
  52. package/dist/types/dashboard-assistant.d.ts +21 -1
  53. package/dist/types/dashboard-authoring.d.ts +11 -1
  54. package/dist/types/data-app-builder.d.ts +11 -1
  55. package/dist/types/data-app-sdk-validation.d.ts +107 -23
  56. package/dist/types/data-app-sdk.d.ts +168 -35
  57. package/dist/types/main.d.ts +11 -1
  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
@@ -33,6 +33,10 @@ declare type CalendarContext = {
33
33
 
34
34
  export declare function createSemaphorQueryExecutor(): SemaphorQueryExecutor;
35
35
 
36
+ export declare function defineSemaphorDataApp<TDefinition extends SemaphorDataAppDefinition>(definition: TDefinition): TDefinition;
37
+
38
+ export declare function defineSemaphorInput<TValue extends SemaphorInputValue = SemaphorInputValue>(spec: SemaphorInputSpec<TValue>): SemaphorInputSpec<TValue>;
39
+
36
40
  export declare function hasSemaphorInputValue(value: unknown): boolean;
37
41
 
38
42
  export declare function normalizeSemaphorAnalysisPayload(payload: SemaphorAnalysisPayload | undefined | null): SemaphorAnalysisPayload;
@@ -52,6 +56,17 @@ export declare function normalizeSemaphorInputOptions(options?: Array<{
52
56
 
53
57
  export declare function readWindowRuntime(): SemaphorDataAppWindowRuntime | undefined;
54
58
 
59
+ export declare const semaphor: {
60
+ filter<TValue extends SemaphorInputValue = SemaphorInputValue>(spec: Omit<SemaphorFilterInputSpec<TValue>, "kind">): SemaphorFilterInputSpec<TValue>;
61
+ control<TValue extends SemaphorInputValue = SemaphorInputValue>(spec: SemaphorControlBuilderSpec<TValue>): SemaphorControlInputSpec<TValue>;
62
+ sqlParam<TValue extends SemaphorSqlParameterValue = SemaphorSqlParameterValue>(spec: SemaphorSqlParamInputSpec<TValue>): SemaphorControlInputSpec<TValue>;
63
+ metric(spec: SemaphorMetricQuerySpec): SemaphorMetricQueryDefinition;
64
+ analysis(spec: SemaphorAnalysisQuerySpec): SemaphorAnalysisQueryDefinition;
65
+ records(spec: SemaphorRecordsQuerySpec): SemaphorRecordsQueryDefinition;
66
+ inputOptions(spec: SemaphorInputOptionsQuerySpec): SemaphorInputOptionsQueryDefinition;
67
+ sql(spec: SemaphorSqlQuerySpec): SemaphorSqlQueryDefinition;
68
+ };
69
+
55
70
  declare type SemaphorAbsoluteTimeWindow = {
56
71
  kind: 'absolute';
57
72
  start: string;
@@ -94,6 +109,10 @@ export declare type SemaphorAnalysisPayload = {
94
109
  [key: string]: unknown;
95
110
  };
96
111
 
112
+ export declare type SemaphorAnalysisQueryDefinition = SemaphorAnalysisQuerySpec & {
113
+ queryKind: 'analysis';
114
+ };
115
+
97
116
  export declare type SemaphorAnalysisQueryOptions = {
98
117
  chartTitle?: string;
99
118
  chartType?: string;
@@ -212,6 +231,7 @@ declare type SemaphorAnalyticsResultBase = {
212
231
  rowCount?: number;
213
232
  rowLimitExceeded?: boolean;
214
233
  limit?: number;
234
+ pagination?: SemaphorPaginationMetadata;
215
235
  };
216
236
 
217
237
  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';
@@ -236,6 +256,8 @@ declare type SemaphorAnalyticsValueFilter = SemaphorAnalyticsFilterBase & {
236
256
 
237
257
  declare type SemaphorAnalyticsValueFilterOperator = Exclude<SemaphorAnalyticsFilterOperator, 'is_null' | 'is_not_null'>;
238
258
 
259
+ export declare type SemaphorAnyQueryResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorQueryResult<TRecord>;
260
+
239
261
  declare type SemaphorCompiledQuery = {
240
262
  kind: 'config';
241
263
  queryId: string;
@@ -263,6 +285,10 @@ declare type SemaphorCompiledQuery = {
263
285
  analyticsIntent?: SemaphorAnalyticsIntent;
264
286
  };
265
287
 
288
+ export declare type SemaphorControlBuilderSpec<TValue extends SemaphorInputValue = SemaphorInputValue> = Omit<SemaphorControlInputSpec<TValue>, 'kind'> & {
289
+ role: SemaphorControlRole;
290
+ };
291
+
266
292
  export declare type SemaphorControlInputSpec<TValue extends SemaphorInputValue = SemaphorInputValue> = SemaphorInputBase<TValue> & {
267
293
  kind: 'control';
268
294
  role: SemaphorControlRole;
@@ -272,34 +298,21 @@ export declare type SemaphorControlRole = 'grain' | 'metric' | 'dimension' | 'ag
272
298
 
273
299
  export declare const SemaphorDataAppContext: Context<SemaphorDataAppRuntime>;
274
300
 
301
+ export declare type SemaphorDataAppDefinition = {
302
+ id?: string;
303
+ title?: string;
304
+ description?: string;
305
+ inputs?: Record<string, SemaphorInputSpec> | SemaphorInputSpec[];
306
+ queries?: Record<string, SemaphorQueryDefinition>;
307
+ views: SemaphorDataAppViewDefinition[];
308
+ };
309
+
275
310
  export declare type SemaphorDataAppFieldCatalog = {
276
311
  source: SemaphorSourceRef;
277
312
  sourceAliases?: SemaphorSourceRef[];
278
313
  fields: SemaphorFieldRef[];
279
314
  };
280
315
 
281
- export declare type SemaphorDataAppHookSpec = {
282
- hook: 'useSemaphorAnalysis';
283
- spec: SemaphorAnalysisQuerySpec;
284
- } | {
285
- hook: 'useSemaphorMetric';
286
- spec: SemaphorMetricQuerySpec;
287
- } | {
288
- hook: 'useSemaphorRecords';
289
- spec: SemaphorRecordsQuerySpec;
290
- } | {
291
- hook: 'useSemaphorInputOptions';
292
- spec: SemaphorInputOptionsQuerySpec;
293
- };
294
-
295
- export declare type SemaphorDataAppHookValidation = {
296
- hook: SemaphorDataAppHookSpec['hook'];
297
- hookId?: string;
298
- intent?: SemaphorAnalyticsIntent;
299
- diagnostics: SemaphorDataAppValidationDiagnostic[];
300
- executionResult: SemaphorAnalyticsExecutionResult;
301
- };
302
-
303
316
  export declare function SemaphorDataAppProvider({ token, apiBaseUrl, executor, children, }: SemaphorDataAppProviderProps): JSX.Element;
304
317
 
305
318
  export declare type SemaphorDataAppProviderProps = SemaphorQueryExecutorContext & {
@@ -307,17 +320,30 @@ export declare type SemaphorDataAppProviderProps = SemaphorQueryExecutorContext
307
320
  children: ReactNode;
308
321
  };
309
322
 
323
+ export declare type SemaphorDataAppQuerySpecEnvelope = {
324
+ queryHook: 'useSemaphorQuery';
325
+ spec: SemaphorQueryDefinition;
326
+ };
327
+
328
+ export declare type SemaphorDataAppQueryValidation = {
329
+ queryHook: SemaphorDataAppQuerySpecEnvelope['queryHook'];
330
+ queryId?: string;
331
+ intent?: SemaphorAnalyticsIntent;
332
+ diagnostics: SemaphorDataAppValidationDiagnostic[];
333
+ executionResult: SemaphorAnalyticsExecutionResult;
334
+ };
335
+
310
336
  export declare type SemaphorDataAppRuntime = SemaphorQueryExecutorContext & {
311
337
  executor?: SemaphorQueryExecutor;
312
338
  };
313
339
 
314
340
  export declare type SemaphorDataAppValidationDiagnostic = {
315
341
  severity: 'error' | 'warning';
316
- code: 'invalid_hook_spec' | 'invalid_analytics_intent' | 'invalid_source_ref' | 'missing_field' | 'unsupported_input_filter_composition' | string;
342
+ code: 'invalid_query_spec' | 'invalid_analytics_intent' | 'invalid_source_ref' | 'missing_field' | 'unsupported_input_filter_composition' | string;
317
343
  message: string;
318
344
  path?: string;
319
- hook?: SemaphorDataAppHookSpec['hook'];
320
- hookId?: string;
345
+ queryHook?: SemaphorDataAppQuerySpecEnvelope['queryHook'];
346
+ queryId?: string;
321
347
  intentId?: string;
322
348
  source?: SemaphorSourceRef;
323
349
  field?: SemaphorFieldRef;
@@ -326,11 +352,19 @@ export declare type SemaphorDataAppValidationDiagnostic = {
326
352
  export declare type SemaphorDataAppValidationResult = {
327
353
  ok: boolean;
328
354
  diagnostics: SemaphorDataAppValidationDiagnostic[];
329
- hooks: SemaphorDataAppHookValidation[];
355
+ queries: SemaphorDataAppQueryValidation[];
330
356
  intents: SemaphorAnalyticsIntent[];
331
357
  executionResults: SemaphorAnalyticsExecutionResult[];
332
358
  };
333
359
 
360
+ export declare type SemaphorDataAppViewDefinition<TQuery extends SemaphorQueryDefinition = SemaphorQueryDefinition> = {
361
+ id: string;
362
+ title?: string;
363
+ description?: string;
364
+ query: TQuery;
365
+ inputs?: SemaphorInputReference[];
366
+ };
367
+
334
368
  declare type SemaphorDataAppWindowRuntime = {
335
369
  apiBaseUrl?: string;
336
370
  dataApiBaseUrl?: string;
@@ -368,12 +402,17 @@ declare type SemaphorInputBase<TValue extends SemaphorInputValue> = {
368
402
  label?: string;
369
403
  value?: TValue;
370
404
  defaultValue?: TValue;
371
- onValueChange?: (value: TValue | undefined) => void;
405
+ onValueChange?: {
406
+ bivarianceHack(value: TValue | undefined): void;
407
+ }['bivarianceHack'];
372
408
  options?: Array<SemaphorInputOption | SemaphorOptionValue>;
373
409
  };
374
410
 
375
411
  declare type SemaphorInputBinding = {
376
412
  inputId: string;
413
+ kind?: 'filter' | 'control';
414
+ controlRole?: 'grain' | 'metric' | 'dimension' | 'aggregation' | 'sqlParam';
415
+ operator?: SemaphorInputOperator;
377
416
  field?: SemaphorFieldRef;
378
417
  };
379
418
 
@@ -420,6 +459,10 @@ export declare type SemaphorInputOptionsPayload = {
420
459
  executionResult?: SemaphorAnalyticsExecutionResult;
421
460
  };
422
461
 
462
+ export declare type SemaphorInputOptionsQueryDefinition = SemaphorInputOptionsQuerySpec & {
463
+ queryKind: 'inputOptions';
464
+ };
465
+
423
466
  export declare type SemaphorInputOptionsQueryResult = SemaphorQueryState & SemaphorInputOptionsPayload & {
424
467
  id?: string;
425
468
  intent?: Extract<SemaphorAnalyticsIntent, {
@@ -444,7 +487,7 @@ declare type SemaphorInputOptionsResult = SemaphorAnalyticsResultBase & {
444
487
  }>;
445
488
  };
446
489
 
447
- export declare type SemaphorInputReference = SemaphorInputBinding | SemaphorActiveInput | SemaphorInputHandle;
490
+ export declare type SemaphorInputReference = SemaphorInputSpec | SemaphorInputBinding | SemaphorActiveInput | SemaphorInputHandle;
448
491
 
449
492
  export declare type SemaphorInputSpec<TValue extends SemaphorInputValue = SemaphorInputValue> = SemaphorFilterInputSpec<TValue> | SemaphorControlInputSpec<TValue>;
450
493
 
@@ -500,6 +543,10 @@ export declare type SemaphorMetricPayload = {
500
543
  executionResult?: SemaphorAnalyticsExecutionResult;
501
544
  };
502
545
 
546
+ export declare type SemaphorMetricQueryDefinition = SemaphorMetricQuerySpec & {
547
+ queryKind: 'metric';
548
+ };
549
+
503
550
  export declare type SemaphorMetricQueryResult = SemaphorQueryState & SemaphorMetricPayload & {
504
551
  id?: string;
505
552
  intent?: SemaphorMetricIntent;
@@ -534,6 +581,20 @@ export declare type SemaphorNonEmptyArray<T> = [T, ...T[]];
534
581
 
535
582
  export declare type SemaphorOptionValue = string | number | boolean;
536
583
 
584
+ export declare type SemaphorPaginationMetadata = {
585
+ page: number;
586
+ pageSize: number;
587
+ pageCount: number;
588
+ totalCount: number;
589
+ hasNextPage: boolean;
590
+ hasPrevPage: boolean;
591
+ };
592
+
593
+ export declare type SemaphorPaginationRequest = {
594
+ page: number;
595
+ pageSize: number;
596
+ };
597
+
537
598
  declare type SemaphorProtocolIssue = {
538
599
  code: string;
539
600
  message: string;
@@ -542,6 +603,8 @@ declare type SemaphorProtocolIssue = {
542
603
 
543
604
  declare type SemaphorProtocolVersion = 1;
544
605
 
606
+ export declare type SemaphorQueryDefinition = SemaphorMetricQueryDefinition | SemaphorAnalysisQueryDefinition | SemaphorRecordsQueryDefinition | SemaphorInputOptionsQueryDefinition | SemaphorSqlQueryDefinition;
607
+
545
608
  export declare type SemaphorQueryExecutor = {
546
609
  executeAnalysis?(intent: SemaphorMetricIntent, context: SemaphorQueryExecutorContext, options?: SemaphorAnalysisQueryOptions): Promise<SemaphorAnalysisPayload>;
547
610
  executeMetric(intent: SemaphorMetricIntent, context: SemaphorQueryExecutorContext): Promise<SemaphorMetricPayload>;
@@ -549,6 +612,7 @@ export declare type SemaphorQueryExecutor = {
549
612
  executeInputOptions(intent: Extract<SemaphorAnalyticsIntent, {
550
613
  kind: 'inputOptions';
551
614
  }>, context: SemaphorQueryExecutorContext): Promise<SemaphorInputOptionsPayload>;
615
+ executeSql?<TRecord extends Record<string, unknown> = Record<string, unknown>>(intent: SemaphorSqlIntent, context: SemaphorQueryExecutorContext): Promise<SemaphorSqlPayload<TRecord>>;
552
616
  };
553
617
 
554
618
  export declare type SemaphorQueryExecutorContext = {
@@ -566,6 +630,14 @@ export declare type SemaphorQueryOrderBy = {
566
630
 
567
631
  declare type SemaphorQueryPath = 'query_spec' | 'sql' | 'sql_python';
568
632
 
633
+ export declare type SemaphorQueryResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorMetricQueryResult | SemaphorAnalysisQueryResult | SemaphorRowsQueryResult<TRecord> | SemaphorInputOptionsQueryResult;
634
+
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;
636
+
637
+ export declare type SemaphorQueryRuntimeOptions = {
638
+ inputs?: SemaphorInputReference[];
639
+ };
640
+
569
641
  export declare type SemaphorQuerySourceSpec = {
570
642
  source: SemaphorSourceRef;
571
643
  };
@@ -588,6 +660,7 @@ declare type SemaphorRecordsBaseQuerySpec = SemaphorQuerySourceSpec & {
588
660
  orderBy?: SemaphorRecordsOrderBy;
589
661
  inputs?: SemaphorInputReference[];
590
662
  limit?: number;
663
+ pagination?: SemaphorPaginationRequest;
591
664
  };
592
665
 
593
666
  export declare type SemaphorRecordsField = SemaphorFieldRef & {
@@ -606,6 +679,7 @@ declare type SemaphorRecordsIntent = {
606
679
  timeWindow?: SemaphorTimeWindow;
607
680
  filters?: SemaphorAnalyticsFilter[];
608
681
  limit?: number;
682
+ pagination?: SemaphorPaginationRequest;
609
683
  orderBy?: {
610
684
  field: SemaphorFieldRef;
611
685
  direction: 'asc' | 'desc';
@@ -619,9 +693,14 @@ export declare type SemaphorRecordsPayload<TRecord extends Record<string, unknow
619
693
  records: TRecord[];
620
694
  columns?: SemaphorResultColumn[];
621
695
  rowCount?: number;
696
+ pagination?: SemaphorPaginationMetadata;
622
697
  executionResult?: SemaphorAnalyticsExecutionResult;
623
698
  };
624
699
 
700
+ export declare type SemaphorRecordsQueryDefinition = SemaphorRecordsQuerySpec & {
701
+ queryKind: 'records';
702
+ };
703
+
625
704
  export declare type SemaphorRecordsQueryResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorQueryState & SemaphorRecordsPayload<TRecord> & {
626
705
  id?: string;
627
706
  intent?: SemaphorRecordsIntent;
@@ -688,6 +767,8 @@ export declare type SemaphorResultColumn = {
688
767
  source?: SemaphorFieldRef['source'];
689
768
  };
690
769
 
770
+ export declare type SemaphorRowsQueryResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorRecordsQueryResult<TRecord> | SemaphorSqlQueryResult<TRecord>;
771
+
691
772
  export declare type SemaphorScalar = string | number | boolean | null;
692
773
 
693
774
  export declare type SemaphorSourceRef = {
@@ -722,14 +803,53 @@ declare type SemaphorSqlIntent = {
722
803
  kind: 'sql';
723
804
  }>;
724
805
  sql: string;
725
- parameters?: Record<string, unknown>;
806
+ defaultParameters?: Record<string, unknown>;
726
807
  pythonCode?: string;
727
808
  limit?: number;
809
+ pagination?: SemaphorPaginationRequest;
728
810
  rationale?: string;
729
811
  fields?: SemaphorFieldRef[];
730
812
  inputs?: SemaphorInputBinding[];
731
813
  };
732
814
 
815
+ export declare type SemaphorSqlParameterValue = SemaphorScalar | SemaphorScalar[];
816
+
817
+ export declare type SemaphorSqlParamInputSpec<TValue extends SemaphorInputValue = SemaphorInputValue> = Omit<SemaphorControlInputSpec<TValue>, 'kind' | 'role'> & {
818
+ defaultValue?: TValue;
819
+ };
820
+
821
+ export declare type SemaphorSqlPayload<TRecord extends Record<string, unknown> = Record<string, unknown>> = {
822
+ records: TRecord[];
823
+ columns?: SemaphorResultColumn[];
824
+ rowCount?: number;
825
+ pagination?: SemaphorPaginationMetadata;
826
+ output?: string;
827
+ rowLimitExceeded?: boolean;
828
+ executionResult?: SemaphorAnalyticsExecutionResult;
829
+ };
830
+
831
+ export declare type SemaphorSqlQueryDefinition = SemaphorSqlQuerySpec & {
832
+ queryKind: 'sql';
833
+ };
834
+
835
+ export declare type SemaphorSqlQueryResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorQueryState & SemaphorSqlPayload<TRecord> & {
836
+ id?: string;
837
+ intent?: SemaphorSqlIntent;
838
+ };
839
+
840
+ export declare type SemaphorSqlQuerySpec = SemaphorSqlSourceSpec & {
841
+ id?: string;
842
+ label?: string;
843
+ sql: string;
844
+ defaultParameters?: Record<string, SemaphorSqlParameterValue>;
845
+ pythonCode?: string;
846
+ fields?: SemaphorFieldRef[];
847
+ inputs?: SemaphorInputReference[];
848
+ limit?: number;
849
+ pagination?: SemaphorPaginationRequest;
850
+ rationale?: string;
851
+ };
852
+
733
853
  declare type SemaphorSqlResult = SemaphorAnalyticsResultBase & {
734
854
  kind: 'sql';
735
855
  columns: SemaphorRecordsResult['columns'];
@@ -741,6 +861,12 @@ declare type SemaphorSqlResult = SemaphorAnalyticsResultBase & {
741
861
  };
742
862
  };
743
863
 
864
+ export declare type SemaphorSqlSourceSpec = {
865
+ source: Extract<SemaphorSourceRef, {
866
+ kind: 'sql';
867
+ }>;
868
+ };
869
+
744
870
  declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
745
871
 
746
872
  export declare type SemaphorTimeWindow = SemaphorRelativeTimeWindow | SemaphorAbsoluteTimeWindow;
@@ -766,26 +892,33 @@ export declare function toSemaphorInputSpec<TValue extends SemaphorInputValue =
766
892
  label?: string;
767
893
  field?: SemaphorFieldRef;
768
894
  operator?: SemaphorInputOperator;
895
+ controlRole?: SemaphorControlRole;
769
896
  };
770
897
 
771
898
  export declare function toSemaphorMetricIntent(spec: SemaphorMetricQuerySpec): SemaphorMetricIntent;
772
899
 
773
900
  export declare function toSemaphorRecordsIntent(spec: SemaphorRecordsQuerySpec): SemaphorRecordsIntent;
774
901
 
775
- export declare function useSemaphorAnalysis(spec: SemaphorAnalysisQuerySpec): SemaphorAnalysisQueryResult;
902
+ export declare function toSemaphorSqlIntent(spec: SemaphorSqlQuerySpec): SemaphorSqlIntent;
776
903
 
777
904
  export declare function useSemaphorDataAppRuntime(): SemaphorDataAppRuntime;
778
905
 
779
906
  export declare function useSemaphorInput<TValue extends SemaphorInputValue = SemaphorInputValue>(spec: SemaphorInputSpec<TValue>): SemaphorInputHandle;
780
907
 
781
- export declare function useSemaphorInputOptions(spec: SemaphorInputOptionsQuerySpec): SemaphorInputOptionsQueryResult;
908
+ export declare function useSemaphorInputs(specs: readonly SemaphorInputSpec[]): SemaphorInputHandle[];
909
+
910
+ export declare function useSemaphorQuery(spec: SemaphorMetricQueryDefinition, options?: SemaphorQueryRuntimeOptions): SemaphorMetricQueryResult;
911
+
912
+ export declare function useSemaphorQuery(spec: SemaphorAnalysisQueryDefinition, options?: SemaphorQueryRuntimeOptions): SemaphorAnalysisQueryResult;
913
+
914
+ export declare function useSemaphorQuery<TRecord extends Record<string, unknown> = Record<string, unknown>>(spec: SemaphorRecordsQueryDefinition, options?: SemaphorQueryRuntimeOptions): SemaphorRecordsQueryResult<TRecord>;
782
915
 
783
- export declare function useSemaphorMetric(spec: SemaphorMetricQuerySpec): SemaphorMetricQueryResult;
916
+ export declare function useSemaphorQuery(spec: SemaphorInputOptionsQueryDefinition, options?: SemaphorQueryRuntimeOptions): SemaphorInputOptionsQueryResult;
784
917
 
785
- export declare function useSemaphorRecords<TRecord extends Record<string, unknown> = Record<string, unknown>>(spec: SemaphorRecordsQuerySpec): SemaphorRecordsQueryResult<TRecord>;
918
+ export declare function useSemaphorQuery<TRecord extends Record<string, unknown> = Record<string, unknown>>(spec: SemaphorSqlQueryDefinition, options?: SemaphorQueryRuntimeOptions): SemaphorSqlQueryResult<TRecord>;
786
919
 
787
- export declare function validateSemaphorDataAppHookSpecs(input: {
788
- hooks: SemaphorDataAppHookSpec[];
920
+ export declare function validateSemaphorDataAppQuerySpecs(input: {
921
+ queries: SemaphorDataAppQuerySpecEnvelope[];
789
922
  fieldCatalogs?: SemaphorDataAppFieldCatalog[];
790
923
  requireFieldCatalog?: boolean;
791
924
  validateTimezone?: SemaphorAnalysisTimezoneValidator;
@@ -4454,6 +4454,9 @@ declare type SemaphorFieldRef = {
4454
4454
 
4455
4455
  declare type SemaphorInputBinding = {
4456
4456
  inputId: string;
4457
+ kind?: 'filter' | 'control';
4458
+ controlRole?: 'grain' | 'metric' | 'dimension' | 'aggregation' | 'sqlParam';
4459
+ operator?: SemaphorInputOperator;
4457
4460
  field?: SemaphorFieldRef;
4458
4461
  };
4459
4462
 
@@ -4503,6 +4506,11 @@ declare type SemaphorMetricIntent = {
4503
4506
  limit?: number;
4504
4507
  };
4505
4508
 
4509
+ declare type SemaphorPaginationRequest = {
4510
+ page: number;
4511
+ pageSize: number;
4512
+ };
4513
+
4506
4514
  declare type SemaphorProtocolVersion = 1;
4507
4515
 
4508
4516
  declare function SemaphorQueryClient({ children, }: {
@@ -4523,6 +4531,7 @@ declare type SemaphorRecordsIntent = {
4523
4531
  timeWindow?: SemaphorTimeWindow;
4524
4532
  filters?: SemaphorAnalyticsFilter[];
4525
4533
  limit?: number;
4534
+ pagination?: SemaphorPaginationRequest;
4526
4535
  orderBy?: {
4527
4536
  field: SemaphorFieldRef;
4528
4537
  direction: 'asc' | 'desc';
@@ -4570,9 +4579,10 @@ declare type SemaphorSqlIntent = {
4570
4579
  kind: 'sql';
4571
4580
  }>;
4572
4581
  sql: string;
4573
- parameters?: Record<string, unknown>;
4582
+ defaultParameters?: Record<string, unknown>;
4574
4583
  pythonCode?: string;
4575
4584
  limit?: number;
4585
+ pagination?: SemaphorPaginationRequest;
4576
4586
  rationale?: string;
4577
4587
  fields?: SemaphorFieldRef[];
4578
4588
  inputs?: SemaphorInputBinding[];
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.368",
8
+ "version": "0.1.369",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react");require("./index-BxM99sFL.js");const s=require("./switch-C0S63HAv.js");require("./index-HjDeEytV.js");require("./index-DRlMUglg.js");require("react-dom/client");require("react-dom");function b(){const t=s.useDashboardStore(e=>e.dashboard),c=s.useDashboardStore(e=>e.actions.setDashboard),u=s.useDashboardStore(e=>e.showDashboardJSON),h=s.useDashboardStore(e=>e.actions.setShowDashboardJSON),r=o.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,i]=o.useState(r),n=o.useRef(r);return o.useEffect(()=>{r!==n.current&&(i(r),n.current=r)},[r]),a.jsxs("div",{className:s.cn("relative p-2",{hidden:!u}),children:[a.jsxs(s.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>h(!1),children:[a.jsx(s.X,{className:"mr-2 h-4 w-4"}),"Close"]}),a.jsx("div",{className:"h-[550px] overflow-hidden",children:a.jsx(s.CodeEditor,{value:l,onValueChange:e=>{i(e);try{const d=JSON.parse(e);n.current=JSON.stringify(d,null,2),c(d)}catch{}},language:"json"})})]})}exports.default=b;