react-semaphor 0.0.417 → 0.0.419

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.
@@ -96,6 +96,28 @@ declare type Actions = {
96
96
  };
97
97
 
98
98
  declare type Actions_2 = {
99
+ setTempQueryData: (tempQueryData: {
100
+ queryKey: string[];
101
+ queryData: any;
102
+ }) => void;
103
+ clearQueryConfig: () => void;
104
+ setIsDevMode: (isDevMode: boolean) => void;
105
+ setGroupByColumns: (groupByColumns: GroupByColumn[]) => void;
106
+ setMetricColumns: (metricColumns: MetricColumn[]) => void;
107
+ removeColumnFromGroupBy: (columnId: string) => void;
108
+ removeColumnFromMetricColumns: (columnId: string) => void;
109
+ addColumnToGroupBy: (column: GroupByColumn) => void;
110
+ addColumnToMetricColumns: (column: MetricColumn) => void;
111
+ setTrendByColumns: (trendByColumns: TrendByColumn[]) => void;
112
+ addColumnToTrendByColumns: (column: TrendByColumn) => void;
113
+ removeColumnFromTrendByColumns: (columnId: string) => void;
114
+ setFilterColumns: (filterColumns: FilterByColumn[]) => void;
115
+ addColumnToFilterColumns: (column: FilterByColumn) => void;
116
+ removeColumnFromFilterColumns: (columnId: string) => void;
117
+ updateMetricColumn: (columnId: string, column: MetricColumn) => void;
118
+ updateGroupByColumn: (columnId: string, column: GroupByColumn) => void;
119
+ updateTrendByColumn: (columnId: string, column: TrendByColumn) => void;
120
+ updateFilterColumn: (columnId: string, column: FilterByColumn) => void;
99
121
  setCurrentAssitantScope: (currentAssitantScope: AIScopeTable[]) => void;
100
122
  setChartGrid: (chartGrid: 'xy' | 'x' | 'y' | 'none') => void;
101
123
  setLegendOptions: (legendOptions: TLegendOptions) => void;
@@ -139,7 +161,6 @@ declare type Actions_2 = {
139
161
  setSelectedDatabaseName: (databaseName: string) => void;
140
162
  setSelectedSchemaName: (schemaName: string) => void;
141
163
  setSelectedTableName: (tableName: string) => void;
142
- setCurrentColumns: (columns: TDataColumn[]) => void;
143
164
  setOnConnectionChange: (onConnectionChange: (connectionId: string) => void) => void;
144
165
  setOnDatabaseChange: (onDatabaseChange: (databaseName: string) => void) => void;
145
166
  setOnSchemaChange: (onSchemaChange: (schemaName: string) => void) => void;
@@ -150,6 +171,8 @@ declare type Actions_2 = {
150
171
 
151
172
  export declare type AggregateCalc = 'AVG' | 'MIN' | 'MAX' | 'SUM' | 'COUNT' | 'COUNT_DISTINCT';
152
173
 
174
+ export declare type AggregateFunction = 'SUM' | 'AVG' | 'COUNT' | 'MAX' | 'MIN' | 'DISTINCT';
175
+
153
176
  export declare type AIScopeTable = {
154
177
  connectionId: string;
155
178
  connectionType: string;
@@ -165,6 +188,14 @@ export declare type AuthToken = {
165
188
  refreshToken?: string;
166
189
  };
167
190
 
191
+ export declare interface BaseColumn {
192
+ id: string;
193
+ name: string;
194
+ label?: string;
195
+ type: ColumnType;
196
+ table?: string;
197
+ }
198
+
168
199
  declare type BaseCustomCard = {
169
200
  cardId: string;
170
201
  replaceDefault?: boolean;
@@ -211,6 +242,10 @@ export declare type ColorRange = {
211
242
  color: string;
212
243
  };
213
244
 
245
+ export declare type ColumnRole = 'groupby' | 'trendby' | 'metric' | 'filter';
246
+
247
+ export declare type ColumnType = 'string' | 'number' | 'date';
248
+
214
249
  export declare type ConnectionPolicy = {
215
250
  connectionId?: string;
216
251
  name: string;
@@ -306,7 +341,14 @@ export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'n
306
341
 
307
342
  export declare function downloadPdf(): Promise<void>;
308
343
 
344
+ export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
345
+
309
346
  declare type EditorStore = {
347
+ tempQueryData?: {
348
+ queryKey: string[];
349
+ queryData: any;
350
+ };
351
+ isDevMode: boolean;
310
352
  isShowingVisual: boolean;
311
353
  showAIDialog: boolean;
312
354
  userInputForAI: string;
@@ -329,7 +371,6 @@ declare type EditorStore = {
329
371
  selectedDatabaseName?: string;
330
372
  selectedSchemaName?: string;
331
373
  selectedTableName?: string;
332
- currentColumns?: TDataColumn[];
333
374
  currentAssitantScope?: AIScopeTable[];
334
375
  onConnectionChange?: (connectionId: string) => void;
335
376
  onDatamodelChange?: (datamodelId: string) => void;
@@ -351,6 +392,11 @@ export declare type ErrorProps = {
351
392
  message?: string;
352
393
  };
353
394
 
395
+ export declare interface FilterByColumn extends BaseColumn {
396
+ role: 'filter';
397
+ operators?: string[];
398
+ }
399
+
354
400
  declare type FilterForBetween = BaseFilter & {
355
401
  operation: 'between' | 'not between';
356
402
  values: [number, number];
@@ -388,6 +434,11 @@ declare type FilterOnClick = {
388
434
  columnIndex: number;
389
435
  };
390
436
 
437
+ export declare type FilterValue = SimpleFilterValue | {
438
+ value: SimpleFilterValue;
439
+ exclude?: boolean;
440
+ };
441
+
391
442
  export declare function fmt(str: string): string;
392
443
 
393
444
  export declare function getColumnDataType(column: TDataColumn): string;
@@ -453,6 +504,10 @@ export declare function getQualifiedTableName({ schemaName, tableName, connectio
453
504
 
454
505
  export declare function getSql(config: SqlGen, schemaName: string, tableName: string, modelName: string, connectionType: string, databaseName: string): string | undefined;
455
506
 
507
+ export declare interface GroupByColumn extends BaseColumn {
508
+ role: 'groupby';
509
+ }
510
+
456
511
  export declare type HtmlOptions = {
457
512
  html: string;
458
513
  };
@@ -479,6 +534,11 @@ export declare type LoadingProps = {
479
534
  message?: string;
480
535
  };
481
536
 
537
+ export declare interface MetricColumn extends BaseColumn {
538
+ role: 'metric';
539
+ aggregate: AggregateFunction;
540
+ }
541
+
482
542
  declare type NoneOptions = {};
483
543
 
484
544
  export declare type NumberAxisFormat = {
@@ -520,6 +580,18 @@ export declare type Placeholders = {
520
580
  SessionExpired?: React.ReactNode;
521
581
  };
522
582
 
583
+ export declare type QueryColumn = GroupByColumn | TrendByColumn | MetricColumn | FilterByColumn;
584
+
585
+ export declare interface QueryConfig {
586
+ groupByColumns?: GroupByColumn[];
587
+ trendByColumns?: TrendByColumn[];
588
+ metricColumns?: MetricColumn[];
589
+ filterColumns?: FilterByColumn[];
590
+ filters?: Record<string, FilterValue>;
591
+ limit?: number;
592
+ orderBy?: string[];
593
+ }
594
+
523
595
  export declare function resolveDatamodelName(datamodelName: string): string;
524
596
 
525
597
  export declare const resolveDataType: (value: any) => string;
@@ -528,7 +600,7 @@ export declare function ScheduleDashboard({ triggerButtonClassName, }: {
528
600
  triggerButtonClassName?: string;
529
601
  }): JSX_2.Element;
530
602
 
531
- export declare function SelectComponent({ title, items, value, isLoading, isError, refetch, connectionTooltip, onChange, showNone, className, disabled, type, }: SelectProps): JSX_2.Element;
603
+ export declare function SelectComponent({ title, items, value, isLoading, isError, refetch, onChange, showNone, className, disabled, type, }: SelectProps): JSX_2.Element;
532
604
 
533
605
  declare type SelectProps = {
534
606
  title: string;
@@ -555,6 +627,13 @@ declare function SemaphorQueryClient({ children, }: {
555
627
  export { SemaphorQueryClient as SemaphorDataProvider }
556
628
  export { SemaphorQueryClient }
557
629
 
630
+ declare type SimpleFilterValue = string | number | null | (string | number)[] | {
631
+ gte?: string | number;
632
+ lte?: string | number;
633
+ lt?: string | number;
634
+ gt?: string | number;
635
+ };
636
+
558
637
  export declare type SqlGen = {
559
638
  measures?: {
560
639
  name: string;
@@ -610,6 +689,13 @@ export declare type StyleProps = {
610
689
 
611
690
  export declare function Surfboard({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX_2.Element;
612
691
 
692
+ export declare type TableConfig = {
693
+ databaseName: string;
694
+ schemaName: string;
695
+ tableName: string;
696
+ datamodelId: string;
697
+ };
698
+
613
699
  export declare type TBaseQuery = {
614
700
  id: string;
615
701
  name: string;
@@ -631,6 +717,7 @@ export declare type TCard = {
631
717
  type: TChartType;
632
718
  sql?: string;
633
719
  python?: string;
720
+ queryConfig?: QueryConfig;
634
721
  customCfg?: any;
635
722
  preferences?: TCardPreferences;
636
723
  customCardPreferences?: TCustomCardPreferences;
@@ -831,6 +918,10 @@ export declare type TLens = {
831
918
  shared?: boolean;
832
919
  };
833
920
 
921
+ export declare interface TrendByColumn extends BaseColumn {
922
+ role: 'trendby';
923
+ }
924
+
834
925
  export declare type TSelectedRecord = {
835
926
  id: number | string;
836
927
  value: string;
@@ -3,6 +3,8 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
3
3
 
4
4
  export declare type AggregateCalc = 'AVG' | 'MIN' | 'MAX' | 'SUM' | 'COUNT' | 'COUNT_DISTINCT';
5
5
 
6
+ declare type AggregateFunction = 'SUM' | 'AVG' | 'COUNT' | 'MAX' | 'MIN' | 'DISTINCT';
7
+
6
8
  export declare type AIScopeTable = {
7
9
  connectionId: string;
8
10
  connectionType: string;
@@ -18,6 +20,14 @@ export declare type AuthToken = {
18
20
  refreshToken?: string;
19
21
  };
20
22
 
23
+ declare interface BaseColumn {
24
+ id: string;
25
+ name: string;
26
+ label?: string;
27
+ type: ColumnType;
28
+ table?: string;
29
+ }
30
+
21
31
  declare type BaseCustomCard = {
22
32
  cardId: string;
23
33
  replaceDefault?: boolean;
@@ -62,6 +72,8 @@ export declare type ColorRange = {
62
72
  color: string;
63
73
  };
64
74
 
75
+ declare type ColumnType = 'string' | 'number' | 'date';
76
+
65
77
  export declare type ConnectionPolicy = {
66
78
  connectionId?: string;
67
79
  name: string;
@@ -117,6 +129,8 @@ export declare type DateOptions = {
117
129
 
118
130
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
119
131
 
132
+ export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
133
+
120
134
  export declare type EmailSettings = {
121
135
  companyName: string;
122
136
  dashboardUrl: string;
@@ -128,6 +142,11 @@ export declare type ErrorProps = {
128
142
  message?: string;
129
143
  };
130
144
 
145
+ declare interface FilterByColumn extends BaseColumn {
146
+ role: 'filter';
147
+ operators?: string[];
148
+ }
149
+
131
150
  declare type FilterForBetween = BaseFilter & {
132
151
  operation: 'between' | 'not between';
133
152
  values: [number, number];
@@ -165,6 +184,11 @@ declare type FilterOnClick = {
165
184
  columnIndex: number;
166
185
  };
167
186
 
187
+ declare type FilterValue = SimpleFilterValue | {
188
+ value: SimpleFilterValue;
189
+ exclude?: boolean;
190
+ };
191
+
168
192
  export declare type GetDashboardResponse = {
169
193
  dashboard: TDashboard;
170
194
  lenses: TLens[];
@@ -179,6 +203,10 @@ export declare type GetPluginsResponse = {
179
203
  }[];
180
204
  };
181
205
 
206
+ declare interface GroupByColumn extends BaseColumn {
207
+ role: 'groupby';
208
+ }
209
+
182
210
  export declare type HtmlOptions = {
183
211
  html: string;
184
212
  };
@@ -193,6 +221,11 @@ export declare type LoadingProps = {
193
221
  message?: string;
194
222
  };
195
223
 
224
+ declare interface MetricColumn extends BaseColumn {
225
+ role: 'metric';
226
+ aggregate: AggregateFunction;
227
+ }
228
+
196
229
  declare type NoneOptions = {};
197
230
 
198
231
  export declare type NumberAxisFormat = {
@@ -234,6 +267,23 @@ export declare type Placeholders = {
234
267
  SessionExpired?: React.ReactNode;
235
268
  };
236
269
 
270
+ declare interface QueryConfig {
271
+ groupByColumns?: GroupByColumn[];
272
+ trendByColumns?: TrendByColumn[];
273
+ metricColumns?: MetricColumn[];
274
+ filterColumns?: FilterByColumn[];
275
+ filters?: Record<string, FilterValue>;
276
+ limit?: number;
277
+ orderBy?: string[];
278
+ }
279
+
280
+ declare type SimpleFilterValue = string | number | null | (string | number)[] | {
281
+ gte?: string | number;
282
+ lte?: string | number;
283
+ lt?: string | number;
284
+ gt?: string | number;
285
+ };
286
+
237
287
  export declare type SqlGen = {
238
288
  measures?: {
239
289
  name: string;
@@ -310,6 +360,7 @@ export declare type TCard = {
310
360
  type: TChartType;
311
361
  sql?: string;
312
362
  python?: string;
363
+ queryConfig?: QueryConfig;
313
364
  customCfg?: any;
314
365
  preferences?: TCardPreferences;
315
366
  customCardPreferences?: TCustomCardPreferences;
@@ -508,6 +559,10 @@ export declare type TLens = {
508
559
  shared?: boolean;
509
560
  };
510
561
 
562
+ declare interface TrendByColumn extends BaseColumn {
563
+ role: 'trendby';
564
+ }
565
+
511
566
  export declare type TSheet = {
512
567
  id: string;
513
568
  title?: string;
@@ -2,6 +2,8 @@ import { FontSpec } from 'chart.js';
2
2
 
3
3
  export declare type AggregateCalc = 'AVG' | 'MIN' | 'MAX' | 'SUM' | 'COUNT' | 'COUNT_DISTINCT';
4
4
 
5
+ declare type AggregateFunction = 'SUM' | 'AVG' | 'COUNT' | 'MAX' | 'MIN' | 'DISTINCT';
6
+
5
7
  export declare type AIScopeTable = {
6
8
  connectionId: string;
7
9
  connectionType: string;
@@ -17,6 +19,14 @@ export declare type AuthToken = {
17
19
  refreshToken?: string;
18
20
  };
19
21
 
22
+ declare interface BaseColumn {
23
+ id: string;
24
+ name: string;
25
+ label?: string;
26
+ type: ColumnType;
27
+ table?: string;
28
+ }
29
+
20
30
  declare type BaseCustomCard = {
21
31
  cardId: string;
22
32
  replaceDefault?: boolean;
@@ -61,6 +71,8 @@ export declare type ColorRange = {
61
71
  color: string;
62
72
  };
63
73
 
74
+ declare type ColumnType = 'string' | 'number' | 'date';
75
+
64
76
  export declare type ConnectionPolicy = {
65
77
  connectionId?: string;
66
78
  name: string;
@@ -111,6 +123,8 @@ export declare type DateOptions = {
111
123
 
112
124
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
113
125
 
126
+ export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
127
+
114
128
  export declare type EmailSettings = {
115
129
  companyName: string;
116
130
  dashboardUrl: string;
@@ -122,6 +136,11 @@ export declare type ErrorProps = {
122
136
  message?: string;
123
137
  };
124
138
 
139
+ declare interface FilterByColumn extends BaseColumn {
140
+ role: 'filter';
141
+ operators?: string[];
142
+ }
143
+
125
144
  declare type FilterForBetween = BaseFilter & {
126
145
  operation: 'between' | 'not between';
127
146
  values: [number, number];
@@ -159,6 +178,11 @@ declare type FilterOnClick = {
159
178
  columnIndex: number;
160
179
  };
161
180
 
181
+ declare type FilterValue = SimpleFilterValue | {
182
+ value: SimpleFilterValue;
183
+ exclude?: boolean;
184
+ };
185
+
162
186
  export declare type GetDashboardResponse = {
163
187
  dashboard: TDashboard;
164
188
  lenses: TLens[];
@@ -173,6 +197,10 @@ export declare type GetPluginsResponse = {
173
197
  }[];
174
198
  };
175
199
 
200
+ declare interface GroupByColumn extends BaseColumn {
201
+ role: 'groupby';
202
+ }
203
+
176
204
  export declare type HtmlOptions = {
177
205
  html: string;
178
206
  };
@@ -187,6 +215,11 @@ export declare type LoadingProps = {
187
215
  message?: string;
188
216
  };
189
217
 
218
+ declare interface MetricColumn extends BaseColumn {
219
+ role: 'metric';
220
+ aggregate: AggregateFunction;
221
+ }
222
+
190
223
  declare type NoneOptions = {};
191
224
 
192
225
  export declare type NumberAxisFormat = {
@@ -228,6 +261,23 @@ export declare type Placeholders = {
228
261
  SessionExpired?: React.ReactNode;
229
262
  };
230
263
 
264
+ declare interface QueryConfig {
265
+ groupByColumns?: GroupByColumn[];
266
+ trendByColumns?: TrendByColumn[];
267
+ metricColumns?: MetricColumn[];
268
+ filterColumns?: FilterByColumn[];
269
+ filters?: Record<string, FilterValue>;
270
+ limit?: number;
271
+ orderBy?: string[];
272
+ }
273
+
274
+ declare type SimpleFilterValue = string | number | null | (string | number)[] | {
275
+ gte?: string | number;
276
+ lte?: string | number;
277
+ lt?: string | number;
278
+ gt?: string | number;
279
+ };
280
+
231
281
  export declare type SqlGen = {
232
282
  measures?: {
233
283
  name: string;
@@ -302,6 +352,7 @@ export declare type TCard = {
302
352
  type: TChartType;
303
353
  sql?: string;
304
354
  python?: string;
355
+ queryConfig?: QueryConfig;
305
356
  customCfg?: any;
306
357
  preferences?: TCardPreferences;
307
358
  customCardPreferences?: TCustomCardPreferences;
@@ -500,6 +551,10 @@ export declare type TLens = {
500
551
  shared?: boolean;
501
552
  };
502
553
 
554
+ declare interface TrendByColumn extends BaseColumn {
555
+ role: 'trendby';
556
+ }
557
+
503
558
  export declare type TSheet = {
504
559
  id: string;
505
560
  title?: string;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.417",
8
+ "version": "0.0.419",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -47,6 +47,9 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@ai-sdk/react": "^1.1.18",
50
+ "@dnd-kit/core": "^6.3.1",
51
+ "@dnd-kit/sortable": "^10.0.0",
52
+ "@dnd-kit/utilities": "^3.2.2",
50
53
  "@headlessui/react": "^2.2.0",
51
54
  "@monaco-editor/react": "^4.7.0-rc.0",
52
55
  "@r2wc/react-to-web-component": "^2.0.4",