react-semaphor 0.0.490 → 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.
@@ -3,7 +3,7 @@ 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';
6
+ declare type AggregateFunction = 'COUNT' | 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'MEDIAN' | 'DISTINCT';
7
7
 
8
8
  export declare type AIScopeTable = {
9
9
  connectionId: string;
@@ -50,6 +50,15 @@ export declare type CacheConfig = {
50
50
  status: 'on' | 'on-refresh' | 'off';
51
51
  };
52
52
 
53
+ declare interface CardConfig {
54
+ groupByColumns?: GroupByField[];
55
+ metricColumns?: MetricField[];
56
+ pivotByColumns?: PivotByField[];
57
+ sortByColumns?: SortByField[];
58
+ filters?: FilterGroup;
59
+ joinPlan?: JoinPlan;
60
+ }
61
+
53
62
  declare type CardWithContent = BaseCustomCard & {
54
63
  content: React.FC<{
55
64
  card: TCard;
@@ -116,6 +125,8 @@ export declare type ConnectionPolicy = {
116
125
  params: Params;
117
126
  };
118
127
 
128
+ declare type ConnectionType = 'GoogleSheets' | 'MySQL' | 'MSSQL' | 'PostgreSQL' | 'BigQuery' | 'Redshift' | 'Snowflake' | 'S3' | 'clickhouse' | 'S3Tables' | 'API' | 'none';
129
+
119
130
  export declare type CustomCard = CardWithContent | CardWithFooter;
120
131
 
121
132
  export declare function Dashboard(props: DashboardProps): JSX_2.Element;
@@ -159,12 +170,50 @@ export declare type DashboardProps = {
159
170
  selectedSheetId?: string;
160
171
  };
161
172
 
173
+ declare interface DatabaseEntityReference {
174
+ connectionId: string;
175
+ connectionType: ConnectionType;
176
+ type: EntityType;
177
+ dialect?: Dialect;
178
+ database?: string;
179
+ schema?: string;
180
+ name: string;
181
+ }
182
+
183
+ declare type DatabaseEntityType = 'table' | 'view';
184
+
185
+ declare interface DataModelEntityReference extends DatabaseEntityReference {
186
+ type: 'model';
187
+ id: string;
188
+ label: string;
189
+ description: string;
190
+ }
191
+
192
+ declare interface DataSource {
193
+ connectionId: string;
194
+ semanticModelId?: string;
195
+ connectionType: string;
196
+ mode: 'database' | 'upload' | 'url' | 'semanticModel';
197
+ dbSelection?: {
198
+ database: string;
199
+ schema: string;
200
+ entityType: DatabaseEntityType;
201
+ };
202
+ selectedEntities?: SelectedEntities;
203
+ }
204
+
205
+ 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"];
206
+
207
+ declare type DateFormatValue = (typeof DATE_FORMAT_VALUES)[number];
208
+
162
209
  export declare type DateOptions = {
163
210
  locale: string;
164
211
  format: string;
165
212
  options: Intl.DateTimeFormatOptions;
166
213
  };
167
214
 
215
+ declare type Dialect = 'mysql' | 'postgresql' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
216
+
168
217
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
169
218
 
170
219
  export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
@@ -178,6 +227,8 @@ export declare type EmailSettings = {
178
227
 
179
228
  export declare const EMPTY_SELECTION: SelectionState;
180
229
 
230
+ declare type EntityType = 'table' | 'view' | 'model' | 'file' | 'dataset' | 'url' | 'upload';
231
+
181
232
  export declare type ErrorProps = {
182
233
  message?: string;
183
234
  };
@@ -189,6 +240,32 @@ export declare type ExportDataPayload = {
189
240
  sql: string;
190
241
  };
191
242
 
243
+ declare interface Field {
244
+ id: string;
245
+ name: string;
246
+ dataType: string;
247
+ label: string;
248
+ description?: string;
249
+ qualifiedEntityName?: string;
250
+ dateFormat?: DateFormatValue;
251
+ customFormat?: string;
252
+ granularity?: TimeGranularity;
253
+ entityId: string;
254
+ entityName: string;
255
+ entityType: EntityType;
256
+ role?: 'groupby' | 'metric' | 'sortby' | 'pivotby';
257
+ }
258
+
259
+ declare interface FileEntityReference extends DatabaseEntityReference {
260
+ id: string;
261
+ type: 'file' | 'url' | 'upload';
262
+ label: string;
263
+ description: string;
264
+ originalName: string;
265
+ file?: File;
266
+ url?: string;
267
+ }
268
+
192
269
  declare interface FilterByColumn extends BaseColumn {
193
270
  role: 'filter';
194
271
  operators?: string[];
@@ -200,6 +277,13 @@ declare interface FilterByColumn extends BaseColumn {
200
277
  staticValues?: string[];
201
278
  }
202
279
 
280
+ declare interface FilterCondition {
281
+ id: string;
282
+ field: Field;
283
+ operator: Operator;
284
+ value: FilterValue;
285
+ }
286
+
203
287
  declare type FilterForBetween = BaseFilter & {
204
288
  operation: 'between' | 'not between';
205
289
  values: [number, number];
@@ -230,6 +314,14 @@ declare type FilterForString = BaseFilter & {
230
314
  values: [string];
231
315
  };
232
316
 
317
+ declare interface FilterGroup {
318
+ id: string;
319
+ logicalOperator: LogicalOperator;
320
+ negate: boolean;
321
+ conditions: FilterCondition[];
322
+ groups: FilterGroup[];
323
+ }
324
+
233
325
  declare type FilterLocation = 'dashboard' | 'frame' | undefined;
234
326
 
235
327
  declare type FilterOnClick = {
@@ -237,7 +329,7 @@ declare type FilterOnClick = {
237
329
  columnIndex: number;
238
330
  };
239
331
 
240
- declare type FilterValue = string | number | null | (string | number)[] | RangeValue;
332
+ declare type FilterValue = string | number | boolean | Date | [number, number] | [string, string] | string[] | number[];
241
333
 
242
334
  export declare type GetDashboardResponse = {
243
335
  dashboard: TDashboard;
@@ -261,10 +353,42 @@ declare interface GroupByColumn extends BaseColumn {
261
353
  format?: string;
262
354
  }
263
355
 
356
+ declare interface GroupByField extends Field {
357
+ role: 'groupby';
358
+ granularity?: 'day' | 'week' | 'month' | 'quarter' | 'year';
359
+ }
360
+
264
361
  export declare type HtmlOptions = {
265
362
  html: string;
266
363
  };
267
364
 
365
+ declare interface Join {
366
+ id: string;
367
+ source: DatabaseEntityReference;
368
+ target: DatabaseEntityReference;
369
+ joinType: 'INNER' | 'LEFT' | 'RIGHT' | 'FULL';
370
+ joinKeyGroups: JoinKeyGroup[];
371
+ sequence: number;
372
+ }
373
+
374
+ declare interface JoinKey {
375
+ id?: string;
376
+ source: Field;
377
+ target: Field;
378
+ operator: string;
379
+ }
380
+
381
+ declare interface JoinKeyGroup {
382
+ id: string;
383
+ operator: string;
384
+ keys: JoinKey[];
385
+ }
386
+
387
+ declare interface JoinPlan {
388
+ baseEntity: DatabaseEntityReference;
389
+ joins: Join[];
390
+ }
391
+
268
392
  export declare type KPICardProps = {
269
393
  card: TCard;
270
394
  isLoading?: boolean;
@@ -277,12 +401,21 @@ export declare type LoadingProps = {
277
401
  message?: string;
278
402
  };
279
403
 
404
+ declare type LogicalOperator = 'AND' | 'OR';
405
+
280
406
  declare interface MetricColumn extends BaseColumn {
281
407
  role: 'metric';
282
408
  aggregate: AggregateFunction;
283
409
  aliasTemplate?: string;
284
410
  }
285
411
 
412
+ declare interface MetricField extends Field {
413
+ role: 'metric';
414
+ aggregate: AggregateFunction;
415
+ aliasTemplate?: string;
416
+ valueAliases?: Record<string, string>;
417
+ }
418
+
286
419
  declare type NoneOptions = {};
287
420
 
288
421
  export declare type NumberAxisFormat = {
@@ -299,8 +432,12 @@ export declare type NumberOptions = {
299
432
  colorRanges?: ColorRange[];
300
433
  };
301
434
 
435
+ declare type OldFilterValue = string | number | null | (string | number)[] | RangeValue;
436
+
302
437
  declare type Operation = '=' | '>' | '<' | '>=' | '<=' | '!=' | 'in' | 'not in' | 'like' | 'not like' | 'between' | 'not between' | 'is null' | 'is not null';
303
438
 
439
+ declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in';
440
+
304
441
  declare type OptionsMap = {
305
442
  number: NumberOptions;
306
443
  string: StringOptions;
@@ -318,6 +455,10 @@ declare type Params = {
318
455
  [key: string]: string | number | string[] | number[];
319
456
  };
320
457
 
458
+ declare interface PivotByField extends Field {
459
+ role: 'pivotby';
460
+ }
461
+
321
462
  export declare type Placeholders = {
322
463
  /**
323
464
  * Placeholder for the card when there are no records to display.
@@ -341,7 +482,7 @@ declare interface QueryConfig {
341
482
 
342
483
  declare type QueryFilter = {
343
484
  filterColumnName: string;
344
- filterValue: FilterValue;
485
+ filterValue: OldFilterValue;
345
486
  };
346
487
 
347
488
  declare type RangeValue = {
@@ -351,8 +492,15 @@ declare type RangeValue = {
351
492
  gt?: string | number;
352
493
  };
353
494
 
495
+ declare type SelectedEntities = DatabaseEntityReference[] | DataModelEntityReference[] | FileEntityReference[];
496
+
354
497
  export declare type SelectionState = Record<Level, string | null>;
355
498
 
499
+ declare interface SortByField extends Field {
500
+ role: 'sortby';
501
+ direction: 'asc' | 'desc';
502
+ }
503
+
356
504
  export declare type SqlGen = {
357
505
  measures?: {
358
506
  name: string;
@@ -434,6 +582,8 @@ export declare type TCard = {
434
582
  type: TChartType;
435
583
  sql?: string;
436
584
  python?: string;
585
+ dataSource?: DataSource;
586
+ config?: CardConfig;
437
587
  queryConfig?: QueryConfig;
438
588
  customCfg?: any;
439
589
  preferences?: TCardPreferences;
@@ -575,6 +725,8 @@ export declare type TDataColumn = {
575
725
  column_name: string;
576
726
  data_type: string;
577
727
  is_nullable?: string;
728
+ label?: string;
729
+ description?: string;
578
730
  };
579
731
 
580
732
  export declare type TDatasetOptions = {
@@ -628,6 +780,8 @@ export declare type TFrame = {
628
780
 
629
781
  export declare type Theme = 'dark' | 'light' | 'system';
630
782
 
783
+ declare type TimeGranularity = 'day' | 'week' | 'month' | 'quarter' | 'year';
784
+
631
785
  export declare type TLegendOptions = {
632
786
  display?: boolean;
633
787
  position?: 'top' | 'left' | 'bottom' | 'right';