semaphor 0.0.94 → 0.0.96

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.
@@ -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;
@@ -118,10 +132,22 @@ export declare type EmailSettings = {
118
132
  senderTitle: string;
119
133
  };
120
134
 
135
+ export declare const EMPTY_SELECTION: SelectionState;
136
+
121
137
  export declare type ErrorProps = {
122
138
  message?: string;
123
139
  };
124
140
 
141
+ declare interface FilterByColumn extends BaseColumn {
142
+ role: 'filter';
143
+ operators?: string[];
144
+ sql?: string;
145
+ fetchValues?: boolean;
146
+ fetchLimit?: number;
147
+ valueSource?: 'distinct' | 'static' | 'range';
148
+ staticValues?: string[];
149
+ }
150
+
125
151
  declare type FilterForBetween = BaseFilter & {
126
152
  operation: 'between' | 'not between';
127
153
  values: [number, number];
@@ -159,6 +185,8 @@ declare type FilterOnClick = {
159
185
  columnIndex: number;
160
186
  };
161
187
 
188
+ declare type FilterValue = string | number | null | (string | number)[] | RangeValue;
189
+
162
190
  export declare type GetDashboardResponse = {
163
191
  dashboard: TDashboard;
164
192
  lenses: TLens[];
@@ -173,6 +201,14 @@ export declare type GetPluginsResponse = {
173
201
  }[];
174
202
  };
175
203
 
204
+ declare type Granularity = 'day' | 'week' | 'month' | 'year';
205
+
206
+ declare interface GroupByColumn extends BaseColumn {
207
+ role: 'groupby';
208
+ granularity?: Granularity;
209
+ format?: string;
210
+ }
211
+
176
212
  export declare type HtmlOptions = {
177
213
  html: string;
178
214
  };
@@ -183,10 +219,18 @@ export declare type KPICardProps = {
183
219
  renderFilterInfo?: () => JSX.Element | null;
184
220
  };
185
221
 
222
+ export declare type Level = 'database' | 'schema' | 'table';
223
+
186
224
  export declare type LoadingProps = {
187
225
  message?: string;
188
226
  };
189
227
 
228
+ declare interface MetricColumn extends BaseColumn {
229
+ role: 'metric';
230
+ aggregate: AggregateFunction;
231
+ aliasTemplate?: string;
232
+ }
233
+
190
234
  declare type NoneOptions = {};
191
235
 
192
236
  export declare type NumberAxisFormat = {
@@ -213,6 +257,11 @@ declare type OptionsMap = {
213
257
  none: NoneOptions;
214
258
  };
215
259
 
260
+ declare interface OrderBy {
261
+ columnId: string;
262
+ direction: 'asc' | 'desc';
263
+ }
264
+
216
265
  declare type Params = {
217
266
  [key: string]: string | number | string[] | number[];
218
267
  };
@@ -228,6 +277,29 @@ export declare type Placeholders = {
228
277
  SessionExpired?: React.ReactNode;
229
278
  };
230
279
 
280
+ declare interface QueryConfig {
281
+ groupByColumns?: GroupByColumn[];
282
+ pivotColumns?: GroupByColumn[];
283
+ metricColumns?: MetricColumn[];
284
+ filterColumns?: FilterByColumn[];
285
+ filters?: {
286
+ filterColumnName: string;
287
+ filterValue: FilterValue;
288
+ exclude?: boolean;
289
+ }[];
290
+ limit?: number;
291
+ orderBy?: OrderBy[];
292
+ }
293
+
294
+ declare type RangeValue = {
295
+ gte?: string | number;
296
+ lte?: string | number;
297
+ lt?: string | number;
298
+ gt?: string | number;
299
+ };
300
+
301
+ export declare type SelectionState = Record<Level, string | null>;
302
+
231
303
  export declare type SqlGen = {
232
304
  measures?: {
233
305
  name: string;
@@ -302,6 +374,7 @@ export declare type TCard = {
302
374
  type: TChartType;
303
375
  sql?: string;
304
376
  python?: string;
377
+ queryConfig?: QueryConfig;
305
378
  customCfg?: any;
306
379
  preferences?: TCardPreferences;
307
380
  customCardPreferences?: TCustomCardPreferences;
@@ -352,6 +425,9 @@ export declare type TCardPreferences = {
352
425
  projectionOffset?: [number, number];
353
426
  colorScale?: string;
354
427
  };
428
+ kpiVisualOptions?: {
429
+ lowerIsBetter?: boolean;
430
+ };
355
431
  };
356
432
 
357
433
  export declare type TChartOptions = {
@@ -389,7 +465,7 @@ export declare type TChartOptions = {
389
465
  };
390
466
  };
391
467
 
392
- declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'stackedLine' | 'table' | 'kpi' | 'pyramid' | 'range' | 'text' | 'map' | 'custom';
468
+ declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'stackedLine' | 'table' | 'kpi' | 'pyramid' | 'range' | 'text' | 'map' | 'funnel' | 'custom';
393
469
 
394
470
  export declare type TColumnSetting<T extends DisplayDataType> = {
395
471
  columnIdx: number;
@@ -431,6 +507,7 @@ export declare type TDashboard = {
431
507
  globalStyle?: TStyle;
432
508
  globalCacheConfig?: CacheConfig;
433
509
  emailSettings?: EmailSettings;
510
+ defaultFilterValues?: TFilterValue[];
434
511
  };
435
512
 
436
513
  export declare type TDataColumn = {
@@ -452,6 +529,11 @@ export declare type TDatasetOptions = {
452
529
  };
453
530
  };
454
531
 
532
+ export declare type TDbCapabilities = {
533
+ path: Level[];
534
+ labels?: Partial<Record<Level, string>>;
535
+ };
536
+
455
537
  export declare type TEvent = {
456
538
  type: 'success' | 'error' | 'info' | 'warning';
457
539
  message: any;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.94",
8
+ "version": "0.0.96",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -15,7 +15,8 @@
15
15
  ],
16
16
  "type": "module",
17
17
  "files": [
18
- "dist"
18
+ "dist",
19
+ "CHANGELOG.md"
19
20
  ],
20
21
  "main": "dist/index.cjs",
21
22
  "module": "dist/index.js",
@@ -46,6 +47,9 @@
46
47
  },
47
48
  "dependencies": {
48
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",
49
53
  "@headlessui/react": "^2.2.0",
50
54
  "@monaco-editor/react": "^4.7.0-rc.0",
51
55
  "@r2wc/react-to-web-component": "^2.0.4",
@@ -73,6 +77,7 @@
73
77
  "@tanstack/react-table": "^8.11.7",
74
78
  "ai": "^4.1.46",
75
79
  "chart.js": "^4.4.1",
80
+ "chartjs-chart-funnel": "^4.2.4",
76
81
  "chartjs-chart-geo": "^4.3.4",
77
82
  "chartjs-plugin-datalabels": "^2.2.0",
78
83
  "class-variance-authority": "^0.7.0",
@@ -104,7 +109,7 @@
104
109
  "react-dom": "^18.0.0 || ^19.0.0"
105
110
  },
106
111
  "devDependencies": {
107
- "@microsoft/api-extractor": "^7.49.1",
112
+ "@microsoft/api-extractor": "^7.52.1",
108
113
  "@tanstack/react-query-devtools": "^5.62.15",
109
114
  "@types/chart.js": "^2.9.41",
110
115
  "@types/dompurify": "^3.0.5",