react-semaphor 0.0.489 → 0.0.491

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.
@@ -101,12 +101,12 @@ declare type Actions = {
101
101
  setBaseQueries: (baseQueries: TBaseQuery[]) => void;
102
102
  };
103
103
 
104
- declare type Actions_2 = TableActions & {
104
+ declare type Actions_2 = TableActions & ExplorerActions & {
105
105
  setEditorFilterMode: (filterColumnName: string, filterMode: 'include' | 'exclude') => void;
106
106
  setLowerIsBetter: (lowerIsBetter: boolean) => void;
107
107
  clearEditorFilter: (filterColumn: FilterByColumn) => void;
108
108
  removeEditorFilter: (filterColumn: FilterByColumn) => void;
109
- updateEditorFilterValue: (filterColumnName: string, filterValue: FilterValue, clearFilter?: boolean) => void;
109
+ updateEditorFilterValue: (filterColumnName: string, filterValue: OldFilterValue, clearFilter?: boolean) => void;
110
110
  setTempQueryData: (tempQueryData: {
111
111
  queryKey: string[];
112
112
  queryData: any;
@@ -129,9 +129,9 @@ declare type Actions_2 = TableActions & {
129
129
  setFilterColumns: (filterColumns: FilterByColumn[]) => void;
130
130
  addColumnToFilterColumns: (column: FilterByColumn) => void;
131
131
  removeColumnFromFilterColumns: (columnId: string) => void;
132
- updateMetricColumn: (columnId: string, column: MetricColumn) => void;
133
- updateGroupByColumn: (columnId: string, column: GroupByColumn) => void;
134
- updatePivotByColumn: (columnId: string, column: GroupByColumn) => void;
132
+ updateMetricColumnOld: (columnId: string, column: MetricColumn) => void;
133
+ updateGroupByColumnOld: (columnId: string, column: GroupByColumn) => void;
134
+ updatePivotByColumnOld: (columnId: string, column: GroupByColumn) => void;
135
135
  updateFilterColumn: (columnId: string, column: FilterByColumn) => void;
136
136
  setCurrentAssitantScope: (currentAssitantScope: AIScopeTable[]) => void;
137
137
  setChartGrid: (chartGrid: 'xy' | 'x' | 'y' | 'none') => void;
@@ -168,6 +168,7 @@ declare type Actions_2 = TableActions & {
168
168
  setCardPython: (python: string | undefined) => void;
169
169
  setPythonStdOut: (pythonStdOut: string) => void;
170
170
  setCardCustomCfg: (cfg: any) => void;
171
+ setCardConfig: (config: CardConfig | undefined) => void;
171
172
  setShowFilters: (showFilters: boolean) => void;
172
173
  setApplyFilters: (applyFilters: boolean) => void;
173
174
  setFilterValues: (filterValues: TFilterValue[]) => void;
@@ -186,7 +187,7 @@ declare type Actions_2 = TableActions & {
186
187
 
187
188
  export declare type AggregateCalc = 'AVG' | 'MIN' | 'MAX' | 'SUM' | 'COUNT' | 'COUNT_DISTINCT';
188
189
 
189
- export declare type AggregateFunction = 'SUM' | 'AVG' | 'COUNT' | 'MAX' | 'MIN' | 'DISTINCT';
190
+ export declare type AggregateFunction = 'COUNT' | 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'MEDIAN' | 'DISTINCT';
190
191
 
191
192
  export declare type AIScopeTable = {
192
193
  connectionId: string;
@@ -233,6 +234,15 @@ export declare type CacheConfig = {
233
234
  status: 'on' | 'on-refresh' | 'off';
234
235
  };
235
236
 
237
+ export declare interface CardConfig {
238
+ groupByColumns?: GroupByField[];
239
+ metricColumns?: MetricField[];
240
+ pivotByColumns?: PivotByField[];
241
+ sortByColumns?: SortByField[];
242
+ filters?: FilterGroup;
243
+ joinPlan?: JoinPlan;
244
+ }
245
+
236
246
  declare type CardWithContent = BaseCustomCard & {
237
247
  content: React.FC<{
238
248
  card: TCard;
@@ -313,6 +323,10 @@ export declare type ConnectionPolicy = {
313
323
  params: Params;
314
324
  };
315
325
 
326
+ export declare type ConnectionType = 'GoogleSheets' | 'MySQL' | 'MSSQL' | 'PostgreSQL' | 'BigQuery' | 'Redshift' | 'Snowflake' | 'S3' | 'clickhouse' | 'S3Tables' | 'API' | 'none';
327
+
328
+ export declare type ContainerId = 'groupBy' | 'metrics' | 'pivotBy' | 'sortBy' | 'source';
329
+
316
330
  export declare function createSqlGenConfig(column: TDataColumn, preSqlGen: SqlGen, calc?: AggregateCalc): SqlGen;
317
331
 
318
332
  export declare type CustomCard = CardWithContent | CardWithFooter;
@@ -396,8 +410,58 @@ export declare type DashboardStore = {
396
410
 
397
411
  export declare const DashboardWC: CustomElementConstructor;
398
412
 
413
+ export declare interface DatabaseEntityReference {
414
+ connectionId: string;
415
+ connectionType: ConnectionType;
416
+ type: EntityType;
417
+ dialect?: Dialect;
418
+ database?: string;
419
+ schema?: string;
420
+ name: string;
421
+ }
422
+
423
+ export declare type DatabaseEntityType = 'table' | 'view';
424
+
399
425
  export declare type DatabaseItem = DropdownItem;
400
426
 
427
+ export declare interface DataModelEntityReference extends DatabaseEntityReference {
428
+ type: 'model';
429
+ id: string;
430
+ label: string;
431
+ description: string;
432
+ }
433
+
434
+ export declare interface DatasetEntityReference extends DatabaseEntityReference {
435
+ type: 'dataset';
436
+ id: string;
437
+ label: string;
438
+ description: string;
439
+ }
440
+
441
+ export declare interface DataSource {
442
+ connectionId: string;
443
+ semanticModelId?: string;
444
+ connectionType: string;
445
+ mode: 'database' | 'upload' | 'url' | 'semanticModel';
446
+ dbSelection?: {
447
+ database: string;
448
+ schema: string;
449
+ entityType: DatabaseEntityType;
450
+ };
451
+ selectedEntities?: SelectedEntities;
452
+ }
453
+
454
+ export declare type DataType = 'string' | 'number' | 'date' | 'datetime' | 'boolean' | 'json' | 'geo';
455
+
456
+ export declare const DATE_FORMAT_VALUES: readonly ["YYYY-MM-DD", "MM/DD/YYYY", "DD/MM/YYYY", "MMMM DD, YYYY", "MMM DD, YYYY", "DD MMM YYYY", "YYYY-MM", "MMMM YYYY", "custom"];
457
+
458
+ export declare type DateFormatOption = {
459
+ value: DateFormatValue;
460
+ label: string;
461
+ };
462
+
463
+ export declare type DateFormatValue = (typeof DATE_FORMAT_VALUES)[number];
464
+
401
465
  export declare type DateOptions = {
402
466
  locale: string;
403
467
  format: string;
@@ -406,6 +470,8 @@ export declare type DateOptions = {
406
470
 
407
471
  export { DateRange }
408
472
 
473
+ export declare type Dialect = 'mysql' | 'postgresql' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
474
+
409
475
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
410
476
 
411
477
  export declare function downloadPdf(): Promise<void>;
@@ -464,10 +530,62 @@ export declare type EmailSettings = {
464
530
 
465
531
  export declare const EMPTY_SELECTION: SelectionState;
466
532
 
533
+ export declare type EntityColumnGroup = {
534
+ entityId: string;
535
+ entityType: EntityType;
536
+ entityName: string;
537
+ qualifiedEntityName: string;
538
+ label?: string;
539
+ description?: string;
540
+ columns: Field[];
541
+ };
542
+
543
+ export declare type EntityType = 'table' | 'view' | 'model' | 'file' | 'dataset' | 'url' | 'upload';
544
+
467
545
  export declare type ErrorProps = {
468
546
  message?: string;
469
547
  };
470
548
 
549
+ declare interface ExplorerActions {
550
+ updateFrame: (updates: Partial<TFrame>) => void;
551
+ setActiveCardInFrame: (cardId: string) => void;
552
+ addCard: () => void;
553
+ removeCard: (cardId: string) => void;
554
+ updateCard: (cardId: string, updates: Partial<TCard>) => void;
555
+ setActiveCard: (cardId: string) => void;
556
+ setActiveTabCard: (cardId: string | null) => void;
557
+ updateDataSource: (dataSource: DataSource) => void;
558
+ updateSemanticModel: (semanticModelId: string) => void;
559
+ updateDirectSource: (updates: Partial<DataSource>) => void;
560
+ getAvailableFields: () => Array<{
561
+ id: string;
562
+ name: string;
563
+ label: string;
564
+ dataType: string;
565
+ icon: any;
566
+ qualifiedEntityName?: string;
567
+ }>;
568
+ updateCardConfig: (cardId: string, config: Partial<CardConfig>) => void;
569
+ addGroupByColumn: (cardId: string, column: GroupByField) => void;
570
+ removeGroupByColumn: (cardId: string, columnId: string) => void;
571
+ updateGroupByColumn: (cardId: string, columnId: string, updates: Partial<GroupByField>) => void;
572
+ addMetricColumn: (cardId: string, column: MetricField) => void;
573
+ removeMetricColumn: (cardId: string, columnId: string) => void;
574
+ updateMetricColumn: (cardId: string, columnId: string, updates: Partial<MetricField>) => void;
575
+ addPivotByColumn: (cardId: string, column: PivotByField) => void;
576
+ removePivotByColumn: (cardId: string, columnId: string) => void;
577
+ updatePivotByColumn: (cardId: string, columnId: string, updates: Partial<PivotByField>) => void;
578
+ addSortByColumn: (cardId: string, column: SortByField) => void;
579
+ removeSortByColumn: (cardId: string, columnId: string) => void;
580
+ updateSortByColumn: (cardId: string, columnId: string, updates: Partial<SortByField>) => void;
581
+ updateFilters: (cardId: string, filters: FilterGroup) => void;
582
+ clearFilters: (cardId: string) => void;
583
+ addJoin: (cardId: string, join: Join) => void;
584
+ removeJoin: (cardId: string, joinId: string) => void;
585
+ updateJoin: (cardId: string, joinId: string, updates: Partial<Join>) => void;
586
+ reorderJoins: (cardId: string, joinIds: string[]) => void;
587
+ }
588
+
471
589
  export declare type ExportDataPayload = {
472
590
  cardId: string;
473
591
  title: string;
@@ -475,6 +593,32 @@ export declare type ExportDataPayload = {
475
593
  sql: string;
476
594
  };
477
595
 
596
+ export declare interface Field {
597
+ id: string;
598
+ name: string;
599
+ dataType: string;
600
+ label: string;
601
+ description?: string;
602
+ qualifiedEntityName?: string;
603
+ dateFormat?: DateFormatValue;
604
+ customFormat?: string;
605
+ granularity?: TimeGranularity;
606
+ entityId: string;
607
+ entityName: string;
608
+ entityType: EntityType;
609
+ role?: 'groupby' | 'metric' | 'sortby' | 'pivotby';
610
+ }
611
+
612
+ export declare interface FileEntityReference extends DatabaseEntityReference {
613
+ id: string;
614
+ type: 'file' | 'url' | 'upload';
615
+ label: string;
616
+ description: string;
617
+ originalName: string;
618
+ file?: File;
619
+ url?: string;
620
+ }
621
+
478
622
  export declare interface FilterByColumn extends BaseColumn {
479
623
  role: 'filter';
480
624
  operators?: string[];
@@ -486,6 +630,13 @@ export declare interface FilterByColumn extends BaseColumn {
486
630
  staticValues?: string[];
487
631
  }
488
632
 
633
+ export declare interface FilterCondition {
634
+ id: string;
635
+ field: Field;
636
+ operator: Operator;
637
+ value: FilterValue;
638
+ }
639
+
489
640
  declare type FilterForBetween = BaseFilter & {
490
641
  operation: 'between' | 'not between';
491
642
  values: [number, number];
@@ -516,6 +667,14 @@ declare type FilterForString = BaseFilter & {
516
667
  values: [string];
517
668
  };
518
669
 
670
+ export declare interface FilterGroup {
671
+ id: string;
672
+ logicalOperator: LogicalOperator;
673
+ negate: boolean;
674
+ conditions: FilterCondition[];
675
+ groups: FilterGroup[];
676
+ }
677
+
519
678
  declare type FilterLocation = 'dashboard' | 'frame' | undefined;
520
679
 
521
680
  declare type FilterOnClick = {
@@ -523,7 +682,7 @@ declare type FilterOnClick = {
523
682
  columnIndex: number;
524
683
  };
525
684
 
526
- export declare type FilterValue = string | number | null | (string | number)[] | RangeValue;
685
+ export declare type FilterValue = string | number | boolean | Date | [number, number] | [string, string] | string[] | number[];
527
686
 
528
687
  export declare function fmt(str: string): string;
529
688
 
@@ -599,6 +758,11 @@ export declare interface GroupByColumn extends BaseColumn {
599
758
  format?: string;
600
759
  }
601
760
 
761
+ export declare interface GroupByField extends Field {
762
+ role: 'groupby';
763
+ granularity?: 'day' | 'week' | 'month' | 'quarter' | 'year';
764
+ }
765
+
602
766
  export declare type HtmlOptions = {
603
767
  html: string;
604
768
  };
@@ -615,6 +779,33 @@ export declare function isNumberDataType(dataType: string): boolean;
615
779
 
616
780
  export declare function isTextDataType(dataType: string): boolean;
617
781
 
782
+ export declare interface Join {
783
+ id: string;
784
+ source: DatabaseEntityReference;
785
+ target: DatabaseEntityReference;
786
+ joinType: 'INNER' | 'LEFT' | 'RIGHT' | 'FULL';
787
+ joinKeyGroups: JoinKeyGroup[];
788
+ sequence: number;
789
+ }
790
+
791
+ export declare interface JoinKey {
792
+ id?: string;
793
+ source: Field;
794
+ target: Field;
795
+ operator: string;
796
+ }
797
+
798
+ export declare interface JoinKeyGroup {
799
+ id: string;
800
+ operator: string;
801
+ keys: JoinKey[];
802
+ }
803
+
804
+ export declare interface JoinPlan {
805
+ baseEntity: DatabaseEntityReference;
806
+ joins: Join[];
807
+ }
808
+
618
809
  export declare type KPICardProps = {
619
810
  card: TCard;
620
811
  isLoading?: boolean;
@@ -627,12 +818,21 @@ export declare type LoadingProps = {
627
818
  message?: string;
628
819
  };
629
820
 
821
+ export declare type LogicalOperator = 'AND' | 'OR';
822
+
630
823
  export declare interface MetricColumn extends BaseColumn {
631
824
  role: 'metric';
632
825
  aggregate: AggregateFunction;
633
826
  aliasTemplate?: string;
634
827
  }
635
828
 
829
+ export declare interface MetricField extends Field {
830
+ role: 'metric';
831
+ aggregate: AggregateFunction;
832
+ aliasTemplate?: string;
833
+ valueAliases?: Record<string, string>;
834
+ }
835
+
636
836
  export declare type ModelItem = DropdownItem;
637
837
 
638
838
  declare type NoneOptions = {};
@@ -651,8 +851,12 @@ export declare type NumberOptions = {
651
851
  colorRanges?: ColorRange[];
652
852
  };
653
853
 
854
+ export declare type OldFilterValue = string | number | null | (string | number)[] | RangeValue;
855
+
654
856
  declare type Operation = '=' | '>' | '<' | '>=' | '<=' | '!=' | 'in' | 'not in' | 'like' | 'not like' | 'between' | 'not between' | 'is null' | 'is not null';
655
857
 
858
+ export declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in';
859
+
656
860
  declare type OptionsMap = {
657
861
  number: NumberOptions;
658
862
  string: StringOptions;
@@ -670,6 +874,10 @@ declare type Params = {
670
874
  [key: string]: string | number | string[] | number[];
671
875
  };
672
876
 
877
+ export declare interface PivotByField extends Field {
878
+ role: 'pivotby';
879
+ }
880
+
673
881
  export declare type Placeholders = {
674
882
  /**
675
883
  * Placeholder for the card when there are no records to display.
@@ -695,7 +903,7 @@ export declare interface QueryConfig {
695
903
 
696
904
  export declare type QueryFilter = {
697
905
  filterColumnName: string;
698
- filterValue: FilterValue;
906
+ filterValue: OldFilterValue;
699
907
  };
700
908
 
701
909
  export declare type RangeValue = {
@@ -717,6 +925,8 @@ export declare type SchemaItem = DropdownItem;
717
925
 
718
926
  export declare function SelectComponent({ title, items, value, isLoading, isError, refetch, onChange, showNone, className, disabled, type, }: SelectProps): JSX_2.Element;
719
927
 
928
+ export declare type SelectedEntities = DatabaseEntityReference[] | DataModelEntityReference[] | FileEntityReference[];
929
+
720
930
  export declare type SelectionState = Record<Level, string | null>;
721
931
 
722
932
  declare type SelectProps = {
@@ -744,6 +954,13 @@ declare function SemaphorQueryClient({ children, }: {
744
954
  export { SemaphorQueryClient as SemaphorDataProvider }
745
955
  export { SemaphorQueryClient }
746
956
 
957
+ export declare interface SortByField extends Field {
958
+ role: 'sortby';
959
+ direction: 'asc' | 'desc';
960
+ }
961
+
962
+ export declare type SortDirection = 'asc' | 'desc';
963
+
747
964
  export declare type SqlGen = {
748
965
  measures?: {
749
966
  name: string;
@@ -847,6 +1064,8 @@ export declare type TCard = {
847
1064
  type: TChartType;
848
1065
  sql?: string;
849
1066
  python?: string;
1067
+ dataSource?: DataSource;
1068
+ config?: CardConfig;
850
1069
  queryConfig?: QueryConfig;
851
1070
  customCfg?: any;
852
1071
  preferences?: TCardPreferences;
@@ -990,6 +1209,8 @@ export declare type TDataColumn = {
990
1209
  column_name: string;
991
1210
  data_type: string;
992
1211
  is_nullable?: string;
1212
+ label?: string;
1213
+ description?: string;
993
1214
  };
994
1215
 
995
1216
  export declare type TDatasetOptions = {
@@ -1043,6 +1264,8 @@ export declare type TFrame = {
1043
1264
 
1044
1265
  export declare type Theme = 'dark' | 'light' | 'system';
1045
1266
 
1267
+ export declare type TimeGranularity = 'day' | 'week' | 'month' | 'quarter' | 'year';
1268
+
1046
1269
  export declare type TLegendOptions = {
1047
1270
  display?: boolean;
1048
1271
  position?: 'top' | 'left' | 'bottom' | 'right';
@@ -1097,6 +1320,14 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
1097
1320
  setState(nextStateOrUpdater: DashboardStore | Partial<DashboardStore> | ((state: WritableDraft<DashboardStore>) => void), shouldReplace?: boolean | undefined): void;
1098
1321
  }>;
1099
1322
 
1323
+ export declare function useDataColumns(token?: AuthToken): {
1324
+ columns: TDataColumn[];
1325
+ isColumnsLoading: boolean;
1326
+ isColumnsFetching: boolean;
1327
+ isColumnsError: boolean;
1328
+ refetchColumns: (options?: RefetchOptions) => Promise<QueryObserverResult<any, Error>>;
1329
+ };
1330
+
1100
1331
  export declare function useDateFilterHook(filterId: string): {
1101
1332
  records: any;
1102
1333
  isLoading: boolean;