semaphor 0.0.23 → 0.0.25

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.
@@ -103,13 +103,18 @@ declare type Actions_2 = {
103
103
  setOnClose: (onClose: () => void) => void;
104
104
  };
105
105
 
106
- declare type AggregateCalc = 'AVG' | 'MIN' | 'MAX' | 'SUM' | 'COUNT' | 'COUNT_DISTINCT';
106
+ export declare type AggregateCalc = 'AVG' | 'MIN' | 'MAX' | 'SUM' | 'COUNT' | 'COUNT_DISTINCT';
107
107
 
108
108
  export declare type AuthToken = {
109
109
  accessToken: string;
110
110
  refreshToken: string;
111
111
  };
112
112
 
113
+ declare type BaseCustomCard = {
114
+ cardId: string;
115
+ replaceDefault?: boolean;
116
+ };
117
+
113
118
  declare type BaseFilter = {
114
119
  filterId: TFilter['id'];
115
120
  expression?: string;
@@ -125,19 +130,32 @@ export declare type Bookmark = {
125
130
  filterValues?: TFilterValue[];
126
131
  };
127
132
 
128
- export declare function cleanCard(card: TCard): TCard;
133
+ export declare const BOOLEAN_DATA_TYPES: string[];
129
134
 
130
- export declare type CustomCard = {
131
- cardId: string;
135
+ declare type CardWithContent = BaseCustomCard & {
132
136
  content: React.FC<{
133
137
  card: TCard;
134
138
  }>;
135
139
  footer?: React.FC<{
136
140
  card: TCard;
137
141
  }>;
138
- replaceDefault?: boolean;
139
142
  };
140
143
 
144
+ declare type CardWithFooter = BaseCustomCard & {
145
+ content?: React.FC<{
146
+ card: TCard;
147
+ }>;
148
+ footer: React.FC<{
149
+ card: TCard;
150
+ }>;
151
+ };
152
+
153
+ export declare function cleanCard(card: TCard): TCard;
154
+
155
+ export declare function createSqlGenConfig(column: TDataColumn, preSqlGen: SqlGen, calc?: AggregateCalc): SqlGen;
156
+
157
+ export declare type CustomCard = CardWithContent | CardWithFooter;
158
+
141
159
  export declare function Dashboard(props: DashboardProps): JSX_2.Element;
142
160
 
143
161
  export declare function DashboardCard({ card, footer, className, ...props }: DashboardCardProps): JSX_2.Element | null;
@@ -163,6 +181,7 @@ export declare type DashboardProps = {
163
181
  currentTheme?: 'light' | 'dark' | 'system';
164
182
  version?: string;
165
183
  customCards?: CustomCard[];
184
+ onChartElementClicked?: (card: TCard, fieldValues: any) => void;
166
185
  onEvent?: (event: TEvent) => void;
167
186
  onSave?: (dashboard: TDashboard) => void;
168
187
  LoadingComponent?: (props: LoadingProps) => React.ReactNode;
@@ -200,6 +219,8 @@ export declare type DashboardStore = {
200
219
 
201
220
  export declare const DashboardWC: CustomElementConstructor;
202
221
 
222
+ export declare const DATE_DATA_TYPES: string[];
223
+
203
224
  declare type EditorStore = {
204
225
  isShowingVisual: boolean;
205
226
  runSql: boolean;
@@ -257,8 +278,12 @@ declare type FilterForString = BaseFilter & {
257
278
  values: [string];
258
279
  };
259
280
 
281
+ export declare function fmt(str: string): string;
282
+
260
283
  export declare function getBookmarkKey(dashboardId: string): string;
261
284
 
285
+ export declare function getColumnDataType(column: TDataColumn): string;
286
+
262
287
  export declare function getDashbaordStateWithoutData(dashboardState: TDashboard): {
263
288
  sheets: {
264
289
  cards: TCard[] | undefined;
@@ -275,11 +300,41 @@ export declare function getDashbaordStateWithoutData(dashboardState: TDashboard)
275
300
  customCards?: CustomCard[] | undefined;
276
301
  };
277
302
 
303
+ export declare function getFilterValueType(filter: TFilter): "string" | "number" | "date" | "boolean";
304
+
305
+ export declare function getQualifiedTableName(schemaName: string, tableName: string): string;
306
+
307
+ export declare function getSql(config: SqlGen, schemaName: string, tableName: string): string | undefined;
308
+
309
+ export declare function isColumnInSqlGen(column: TDataColumn, sqlGen: SqlGen): boolean | undefined;
310
+
278
311
  export declare type LoadingProps = {
279
312
  message?: string;
280
313
  };
281
314
 
282
- declare type SqlGen = {
315
+ export declare const NUMBER_DATA_TYPES: string[];
316
+
317
+ export declare const resolveDataType: (value: any) => string;
318
+
319
+ export declare function SelectComponent({ title, items, value, isLoading, isError, onChange, }: SelectProps): JSX_2.Element;
320
+
321
+ declare type SelectProps = {
322
+ title: string;
323
+ items: {
324
+ id: string;
325
+ name: string;
326
+ }[];
327
+ value: string;
328
+ isLoading: boolean;
329
+ isError: boolean;
330
+ onChange?: (value: string) => void;
331
+ };
332
+
333
+ export declare function SemaphorQueryClient({ children, }: {
334
+ children: React.ReactNode;
335
+ }): JSX_2.Element;
336
+
337
+ export declare type SqlGen = {
283
338
  measures?: {
284
339
  name: string;
285
340
  calc: AggregateCalc;
@@ -366,7 +421,7 @@ export declare type TDashboard = {
366
421
  customCards?: CustomCard[];
367
422
  };
368
423
 
369
- declare type TDataColumn = {
424
+ export declare type TDataColumn = {
370
425
  column_name: string;
371
426
  data_type: string;
372
427
  is_nullable?: string;
@@ -377,6 +432,8 @@ export declare type TEvent = {
377
432
  message: any;
378
433
  };
379
434
 
435
+ export declare const TEXT_DATA_TYPES: string[];
436
+
380
437
  declare type TFilter = {
381
438
  id: string;
382
439
  connectionId: string;
@@ -608,16 +665,25 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
608
665
  database: string;
609
666
  sql: string;
610
667
  }[] | undefined;
611
- customCards?: {
668
+ customCards?: ({
612
669
  cardId: string;
670
+ replaceDefault?: boolean | undefined;
613
671
  content: FC<{
614
672
  card: TCard;
615
673
  }>;
616
674
  footer?: FC<{
617
675
  card: TCard;
618
676
  }> | undefined;
677
+ } | {
678
+ cardId: string;
619
679
  replaceDefault?: boolean | undefined;
620
- }[] | undefined;
680
+ content?: FC<{
681
+ card: TCard;
682
+ }> | undefined;
683
+ footer: FC<{
684
+ card: TCard;
685
+ }>;
686
+ })[] | undefined;
621
687
  };
622
688
  selectedSheetId?: string | null | undefined;
623
689
  selectedCardId?: string | null | undefined;
@@ -767,6 +833,30 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
767
833
 
768
834
  export declare const useEditorActions: () => Actions_2;
769
835
 
836
+ export declare function useEditorAside(token?: AuthToken, connectionQueryKey?: string): {
837
+ connectionItems: any;
838
+ isConnectionsLoading: boolean;
839
+ isConnectionsError: boolean;
840
+ databaseItems: any;
841
+ isDatabasesLoadingOrFetching: boolean;
842
+ isDatabaseError: boolean;
843
+ schemaItems: any;
844
+ isSchemaLoadingOrFetching: boolean;
845
+ isSchemaError: boolean;
846
+ tableItems: any;
847
+ isTableLoadingOrFetching: boolean;
848
+ isTableError: boolean;
849
+ columns: TDataColumn[];
850
+ isColumnsLoadingOrFetching: boolean;
851
+ isColumnsError: boolean;
852
+ isAPIConnection: boolean;
853
+ tableName: string;
854
+ schemaName: string;
855
+ handleConnectionChange: (value: string) => void;
856
+ handleDatabaseChange: (value: string) => void;
857
+ handleSchemaChange: (value: string) => void;
858
+ };
859
+
770
860
  export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "setState"> & {
771
861
  setState(nextStateOrUpdater: EditorStore | Partial<EditorStore> | ((state: {
772
862
  isShowingVisual: boolean;