semaphor 0.0.38 → 0.0.40

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.
@@ -12,6 +12,7 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
12
12
  import { Layout } from 'react-grid-layout';
13
13
  import { Layouts } from 'react-grid-layout';
14
14
  import { Point } from 'chart.js';
15
+ import { default as React_2 } from 'react';
15
16
  import { default as ReactGridLayout_2 } from 'react-grid-layout';
16
17
  import { StoreApi } from 'zustand';
17
18
  import { UseBoundStore } from 'zustand';
@@ -35,6 +36,7 @@ declare type Actions = {
35
36
  setCardTitle: (sheetId: string, cardId: string, title: string) => void;
36
37
  setCardInfo: (cardId: string, info: string) => void;
37
38
  setCardSql: (sheetId: string, cardId: string, sql: string) => void;
39
+ setCardPython: (cardId: string, pythonCode: string) => void;
38
40
  setCardDescription: (sheetId: string, cardId: string, description: string) => void;
39
41
  setFrameCardData: (sheetId: string, cardId: string, data: any[]) => void;
40
42
  addFrame: (sheetId: string, frame: TFrame) => void;
@@ -80,6 +82,7 @@ declare type Actions_2 = {
80
82
  setNumberFormat: (format: string, currency: string, locale: string, suffix: string) => void;
81
83
  setIsShowingVisual: (isShowingVisual: boolean) => void;
82
84
  setQueryResultColumns: (columns: string[]) => void;
85
+ setQueryError: (error: string) => void;
83
86
  setRunSql: (runSql: boolean) => void;
84
87
  setCardPreferences: (preferences: TCardPreferences) => void;
85
88
  setFilterOnClickField: (field: string) => void;
@@ -92,6 +95,8 @@ declare type Actions_2 = {
92
95
  setSqlGenDimension: (dimension: string) => void;
93
96
  setCardType: (type: TChartType) => void;
94
97
  setCardSql: (sql: string) => void;
98
+ setCardPython: (python: string) => void;
99
+ setPythonStdOut: (pythonStdOut: string) => void;
95
100
  setCardData: (data: any[]) => void;
96
101
  setCardCustomCfg: (cfg: any) => void;
97
102
  setCardCfg: (cfg: any) => void;
@@ -174,6 +179,15 @@ export declare type CustomCard = CardWithContent | CardWithFooter;
174
179
 
175
180
  export declare function Dashboard(props: DashboardProps): JSX_2.Element;
176
181
 
182
+ export declare function DashboardCard({ card, footer, className, ...props }: DashboardCardProps): JSX_2.Element | null;
183
+
184
+ declare type DashboardCardProps = {
185
+ card: TCard;
186
+ footer?: React_2.ReactNode;
187
+ showControls?: boolean;
188
+ fetchCardData?: boolean;
189
+ } & React_2.HTMLAttributes<HTMLDivElement>;
190
+
177
191
  export declare function DashboardPlus({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX_2.Element;
178
192
 
179
193
  declare type DashboardPlusProps = {
@@ -196,7 +210,7 @@ export declare type DashboardProps = {
196
210
  };
197
211
 
198
212
  export declare function DashboardProvider({ children }: {
199
- children: React.ReactNode;
213
+ children: React_2.ReactNode;
200
214
  }): JSX_2.Element;
201
215
 
202
216
  export declare type DashboardStore = {
@@ -241,6 +255,8 @@ declare type EditorStore = {
241
255
  applyFilters: boolean;
242
256
  filterValues?: TFilterValue[];
243
257
  queryResultColumns: string[];
258
+ queryError?: string;
259
+ pythonStdOut?: string;
244
260
  selectedConnectionId?: string;
245
261
  selectedDatabaseName?: string;
246
262
  selectedSchemaName?: string;
@@ -336,13 +352,17 @@ export declare type LoadingProps = {
336
352
 
337
353
  export declare const NUMBER_DATA_TYPES: string[];
338
354
 
355
+ declare type Operation = '=' | '>' | '<' | '>=' | '<=' | '!=' | 'in' | 'not in' | 'like' | 'not like' | 'between' | 'not between' | 'is null' | 'is not null';
356
+
339
357
  declare type Params = {
340
358
  [key: string]: string | number | string[] | number[];
341
359
  };
342
360
 
361
+ export declare const PYTHON_DEFAULT_CODE = "import pandas as pd\ndf = pd.DataFrame(data) # 'data' contains the query result\nresult = df.to_dict('records') # must return 'result' as [dict] type\n";
362
+
343
363
  export declare const resolveDataType: (value: any) => string;
344
364
 
345
- export declare function SelectComponent({ title, items, value, isLoading, isError, onChange, className, showIcon, }: SelectProps): JSX_2.Element;
365
+ export declare function SelectComponent({ title, items, value, isLoading, isError, connectionTooltip, onChange, className, showIcon, }: SelectProps): JSX_2.Element;
346
366
 
347
367
  declare type SelectProps = {
348
368
  title: string;
@@ -356,6 +376,7 @@ declare type SelectProps = {
356
376
  onChange?: (value: string) => void;
357
377
  className?: string;
358
378
  showIcon?: boolean;
379
+ connectionTooltip?: string;
359
380
  };
360
381
 
361
382
  export declare function SemaphorQueryClient({ children, }: {
@@ -413,6 +434,7 @@ export declare type TCard = {
413
434
  connectionId?: string;
414
435
  type: TChartType;
415
436
  sql?: string;
437
+ python?: string;
416
438
  data?: any[];
417
439
  cfg?: any;
418
440
  customCfg?: any;
@@ -442,10 +464,35 @@ export declare type TCardPreferences = {
442
464
  suffix?: string;
443
465
  enabled?: boolean | string;
444
466
  };
467
+ datasetOptions?: TDatasetOptions[];
468
+ chartOptions?: TChartOptions;
445
469
  };
446
470
 
447
471
  declare type TChartConfiguration = ChartConfiguration;
448
472
 
473
+ export declare type TChartOptions = {
474
+ type?: TChartType;
475
+ scales?: {
476
+ y?: {
477
+ type: 'linear' | 'logarithmic';
478
+ min: number;
479
+ max: number;
480
+ ticks: {
481
+ stepSize: number;
482
+ };
483
+ };
484
+ x?: {
485
+ type: 'linear' | 'logarithmic';
486
+ min: number;
487
+ max: number;
488
+ ticks: {
489
+ stepSize: number;
490
+ };
491
+ };
492
+ };
493
+ indexAxis?: 'x' | 'y' | undefined;
494
+ };
495
+
449
496
  declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'table' | 'kpi' | 'custom';
450
497
 
451
498
  export declare type TDashboard = {
@@ -465,6 +512,19 @@ export declare type TDataColumn = {
465
512
  is_nullable?: string;
466
513
  };
467
514
 
515
+ export declare type TDatasetOptions = {
516
+ idx: number;
517
+ type?: 'bar' | 'line';
518
+ fill?: string | number;
519
+ datalabels?: {
520
+ display?: boolean;
521
+ align?: string;
522
+ anchor?: string;
523
+ clamp?: boolean;
524
+ color?: string;
525
+ };
526
+ };
527
+
468
528
  export declare type TEvent = {
469
529
  type: 'success' | 'error' | 'info' | 'warning';
470
530
  message: any;
@@ -481,6 +541,7 @@ declare type TFilter = {
481
541
  table: string;
482
542
  database: string;
483
543
  sql: string;
544
+ operation: Operation;
484
545
  };
485
546
 
486
547
  declare type TFilterValue = FilterForString | FilterForEqual | FilterForCompare | FilterForBetween | FilterForIn | FilterForDate;
@@ -584,6 +645,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
584
645
  connectionId?: string | undefined;
585
646
  type: TChartType;
586
647
  sql?: string | undefined;
648
+ python?: string | undefined;
587
649
  data?: any[] | undefined;
588
650
  cfg?: any;
589
651
  customCfg?: any;
@@ -602,6 +664,40 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
602
664
  suffix?: string | undefined;
603
665
  enabled?: string | boolean | undefined;
604
666
  } | undefined;
667
+ datasetOptions?: {
668
+ idx: number;
669
+ type?: "bar" | "line" | undefined;
670
+ fill?: string | number | undefined;
671
+ datalabels?: {
672
+ display?: boolean | undefined;
673
+ align?: string | undefined;
674
+ anchor?: string | undefined;
675
+ clamp?: boolean | undefined;
676
+ color?: string | undefined;
677
+ } | undefined;
678
+ }[] | undefined;
679
+ chartOptions?: {
680
+ type?: TChartType | undefined;
681
+ scales?: {
682
+ y?: {
683
+ type: "linear" | "logarithmic";
684
+ min: number;
685
+ max: number;
686
+ ticks: {
687
+ stepSize: number;
688
+ };
689
+ } | undefined;
690
+ x?: {
691
+ type: "linear" | "logarithmic";
692
+ min: number;
693
+ max: number;
694
+ ticks: {
695
+ stepSize: number;
696
+ };
697
+ } | undefined;
698
+ } | undefined;
699
+ indexAxis?: "x" | "y" | undefined;
700
+ } | undefined;
605
701
  } | undefined;
606
702
  lastSelectedDatabase?: string | undefined;
607
703
  lastSelectedSchema?: string | undefined;
@@ -661,6 +757,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
661
757
  connectionId?: string | undefined;
662
758
  type: TChartType;
663
759
  sql?: string | undefined;
760
+ python?: string | undefined;
664
761
  data?: any[] | undefined;
665
762
  cfg?: any;
666
763
  customCfg?: any;
@@ -679,6 +776,40 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
679
776
  suffix?: string | undefined;
680
777
  enabled?: string | boolean | undefined;
681
778
  } | undefined;
779
+ datasetOptions?: {
780
+ idx: number;
781
+ type?: "bar" | "line" | undefined;
782
+ fill?: string | number | undefined;
783
+ datalabels?: {
784
+ display?: boolean | undefined;
785
+ align?: string | undefined;
786
+ anchor?: string | undefined;
787
+ clamp?: boolean | undefined;
788
+ color?: string | undefined;
789
+ } | undefined;
790
+ }[] | undefined;
791
+ chartOptions?: {
792
+ type?: TChartType | undefined;
793
+ scales?: {
794
+ y?: {
795
+ type: "linear" | "logarithmic";
796
+ min: number;
797
+ max: number;
798
+ ticks: {
799
+ stepSize: number;
800
+ };
801
+ } | undefined;
802
+ x?: {
803
+ type: "linear" | "logarithmic";
804
+ min: number;
805
+ max: number;
806
+ ticks: {
807
+ stepSize: number;
808
+ };
809
+ } | undefined;
810
+ } | undefined;
811
+ indexAxis?: "x" | "y" | undefined;
812
+ } | undefined;
682
813
  } | undefined;
683
814
  lastSelectedDatabase?: string | undefined;
684
815
  lastSelectedSchema?: string | undefined;
@@ -695,6 +826,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
695
826
  connectionId?: string | undefined;
696
827
  type: TChartType;
697
828
  sql?: string | undefined;
829
+ python?: string | undefined;
698
830
  data?: any[] | undefined;
699
831
  cfg?: any;
700
832
  customCfg?: any;
@@ -713,6 +845,40 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
713
845
  suffix?: string | undefined;
714
846
  enabled?: string | boolean | undefined;
715
847
  } | undefined;
848
+ datasetOptions?: {
849
+ idx: number;
850
+ type?: "bar" | "line" | undefined;
851
+ fill?: string | number | undefined;
852
+ datalabels?: {
853
+ display?: boolean | undefined;
854
+ align?: string | undefined;
855
+ anchor?: string | undefined;
856
+ clamp?: boolean | undefined;
857
+ color?: string | undefined;
858
+ } | undefined;
859
+ }[] | undefined;
860
+ chartOptions?: {
861
+ type?: TChartType | undefined;
862
+ scales?: {
863
+ y?: {
864
+ type: "linear" | "logarithmic";
865
+ min: number;
866
+ max: number;
867
+ ticks: {
868
+ stepSize: number;
869
+ };
870
+ } | undefined;
871
+ x?: {
872
+ type: "linear" | "logarithmic";
873
+ min: number;
874
+ max: number;
875
+ ticks: {
876
+ stepSize: number;
877
+ };
878
+ } | undefined;
879
+ } | undefined;
880
+ indexAxis?: "x" | "y" | undefined;
881
+ } | undefined;
716
882
  } | undefined;
717
883
  lastSelectedDatabase?: string | undefined;
718
884
  lastSelectedSchema?: string | undefined;
@@ -775,6 +941,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
775
941
  table: string;
776
942
  database: string;
777
943
  sql: string;
944
+ operation: Operation;
778
945
  }[] | undefined;
779
946
  customCards?: ({
780
947
  cardId: string;
@@ -813,6 +980,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
813
980
  connectionId?: string | undefined;
814
981
  type: TChartType;
815
982
  sql?: string | undefined;
983
+ python?: string | undefined;
816
984
  data?: any[] | undefined;
817
985
  cfg?: any;
818
986
  customCfg?: any;
@@ -831,6 +999,40 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
831
999
  suffix?: string | undefined;
832
1000
  enabled?: string | boolean | undefined;
833
1001
  } | undefined;
1002
+ datasetOptions?: {
1003
+ idx: number;
1004
+ type?: "bar" | "line" | undefined;
1005
+ fill?: string | number | undefined;
1006
+ datalabels?: {
1007
+ display?: boolean | undefined;
1008
+ align?: string | undefined;
1009
+ anchor?: string | undefined;
1010
+ clamp?: boolean | undefined;
1011
+ color?: string | undefined;
1012
+ } | undefined;
1013
+ }[] | undefined;
1014
+ chartOptions?: {
1015
+ type?: TChartType | undefined;
1016
+ scales?: {
1017
+ y?: {
1018
+ type: "linear" | "logarithmic";
1019
+ min: number;
1020
+ max: number;
1021
+ ticks: {
1022
+ stepSize: number;
1023
+ };
1024
+ } | undefined;
1025
+ x?: {
1026
+ type: "linear" | "logarithmic";
1027
+ min: number;
1028
+ max: number;
1029
+ ticks: {
1030
+ stepSize: number;
1031
+ };
1032
+ } | undefined;
1033
+ } | undefined;
1034
+ indexAxis?: "x" | "y" | undefined;
1035
+ } | undefined;
834
1036
  } | undefined;
835
1037
  lastSelectedDatabase?: string | undefined;
836
1038
  lastSelectedSchema?: string | undefined;
@@ -915,6 +1117,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
915
1117
  setCardTitle: (sheetId: string, cardId: string, title: string) => void;
916
1118
  setCardInfo: (cardId: string, info: string) => void;
917
1119
  setCardSql: (sheetId: string, cardId: string, sql: string) => void;
1120
+ setCardPython: (cardId: string, pythonCode: string) => void;
918
1121
  setCardDescription: (sheetId: string, cardId: string, description: string) => void;
919
1122
  setFrameCardData: (sheetId: string, cardId: string, data: any[]) => void;
920
1123
  addFrame: (sheetId: string, frame: TFrame) => void;
@@ -959,7 +1162,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
959
1162
 
960
1163
  export declare const useEditorActions: () => Actions_2;
961
1164
 
962
- export declare function useEditorAside(token?: AuthToken, connectionQueryKey?: string): {
1165
+ export declare function useEditorAside(token?: AuthToken, _connectionQueryKey?: string): {
963
1166
  connectionItems: any;
964
1167
  isConnectionsLoading: boolean;
965
1168
  isConnectionsError: boolean;
@@ -993,6 +1196,7 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
993
1196
  setNumberFormat: (format: string, currency: string, locale: string, suffix: string) => void;
994
1197
  setIsShowingVisual: (isShowingVisual: boolean) => void;
995
1198
  setQueryResultColumns: (columns: string[]) => void;
1199
+ setQueryError: (error: string) => void;
996
1200
  setRunSql: (runSql: boolean) => void;
997
1201
  setCardPreferences: (preferences: TCardPreferences) => void;
998
1202
  setFilterOnClickField: (field: string) => void;
@@ -1005,6 +1209,8 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
1005
1209
  setSqlGenDimension: (dimension: string) => void;
1006
1210
  setCardType: (type: TChartType) => void;
1007
1211
  setCardSql: (sql: string) => void;
1212
+ setCardPython: (python: string) => void;
1213
+ setPythonStdOut: (pythonStdOut: string) => void;
1008
1214
  setCardData: (data: any[]) => void;
1009
1215
  setCardCustomCfg: (cfg: any) => void;
1010
1216
  setCardCfg: (cfg: any) => void;
@@ -1040,6 +1246,7 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
1040
1246
  connectionId?: string | undefined;
1041
1247
  type: TChartType;
1042
1248
  sql?: string | undefined;
1249
+ python?: string | undefined;
1043
1250
  data?: any[] | undefined;
1044
1251
  cfg?: any;
1045
1252
  customCfg?: any;
@@ -1058,6 +1265,40 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
1058
1265
  suffix?: string | undefined;
1059
1266
  enabled?: string | boolean | undefined;
1060
1267
  } | undefined;
1268
+ datasetOptions?: {
1269
+ idx: number;
1270
+ type?: "bar" | "line" | undefined;
1271
+ fill?: string | number | undefined;
1272
+ datalabels?: {
1273
+ display?: boolean | undefined;
1274
+ align?: string | undefined;
1275
+ anchor?: string | undefined;
1276
+ clamp?: boolean | undefined;
1277
+ color?: string | undefined;
1278
+ } | undefined;
1279
+ }[] | undefined;
1280
+ chartOptions?: {
1281
+ type?: TChartType | undefined;
1282
+ scales?: {
1283
+ y?: {
1284
+ type: "linear" | "logarithmic";
1285
+ min: number;
1286
+ max: number;
1287
+ ticks: {
1288
+ stepSize: number;
1289
+ };
1290
+ } | undefined;
1291
+ x?: {
1292
+ type: "linear" | "logarithmic";
1293
+ min: number;
1294
+ max: number;
1295
+ ticks: {
1296
+ stepSize: number;
1297
+ };
1298
+ } | undefined;
1299
+ } | undefined;
1300
+ indexAxis?: "x" | "y" | undefined;
1301
+ } | undefined;
1061
1302
  } | undefined;
1062
1303
  lastSelectedDatabase?: string | undefined;
1063
1304
  lastSelectedSchema?: string | undefined;
@@ -1074,6 +1315,7 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
1074
1315
  connectionId?: string | undefined;
1075
1316
  type: TChartType;
1076
1317
  sql?: string | undefined;
1318
+ python?: string | undefined;
1077
1319
  data?: any[] | undefined;
1078
1320
  cfg?: any;
1079
1321
  customCfg?: any;
@@ -1092,6 +1334,40 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
1092
1334
  suffix?: string | undefined;
1093
1335
  enabled?: string | boolean | undefined;
1094
1336
  } | undefined;
1337
+ datasetOptions?: {
1338
+ idx: number;
1339
+ type?: "bar" | "line" | undefined;
1340
+ fill?: string | number | undefined;
1341
+ datalabels?: {
1342
+ display?: boolean | undefined;
1343
+ align?: string | undefined;
1344
+ anchor?: string | undefined;
1345
+ clamp?: boolean | undefined;
1346
+ color?: string | undefined;
1347
+ } | undefined;
1348
+ }[] | undefined;
1349
+ chartOptions?: {
1350
+ type?: TChartType | undefined;
1351
+ scales?: {
1352
+ y?: {
1353
+ type: "linear" | "logarithmic";
1354
+ min: number;
1355
+ max: number;
1356
+ ticks: {
1357
+ stepSize: number;
1358
+ };
1359
+ } | undefined;
1360
+ x?: {
1361
+ type: "linear" | "logarithmic";
1362
+ min: number;
1363
+ max: number;
1364
+ ticks: {
1365
+ stepSize: number;
1366
+ };
1367
+ } | undefined;
1368
+ } | undefined;
1369
+ indexAxis?: "x" | "y" | undefined;
1370
+ } | undefined;
1095
1371
  } | undefined;
1096
1372
  lastSelectedDatabase?: string | undefined;
1097
1373
  lastSelectedSchema?: string | undefined;
@@ -1150,6 +1426,8 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
1150
1426
  values: (string | number)[];
1151
1427
  })[] | undefined;
1152
1428
  queryResultColumns: string[];
1429
+ queryError?: string | undefined;
1430
+ pythonStdOut?: string | undefined;
1153
1431
  selectedConnectionId?: string | undefined;
1154
1432
  selectedDatabaseName?: string | undefined;
1155
1433
  selectedSchemaName?: string | undefined;