react-semaphor 0.0.503 → 0.0.505

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.
@@ -246,10 +246,27 @@ export declare type ExportDataPayload = {
246
246
  };
247
247
 
248
248
  declare interface Field {
249
+ /**
250
+ * Unique identifier for this field instance (for joins, UI state, etc.).
251
+ * Should be unique within the context of the query or data model.
252
+ * Example: 'orders.customer_id', 'expr_12345', etc.
253
+ */
249
254
  id: string;
255
+ /**
256
+ * The physical/source column name in the database or data source.
257
+ * Used for mapping to the underlying data model and SQL generation (unless overridden by expression).
258
+ */
250
259
  name: string;
251
- dataType: string;
260
+ /**
261
+ * Human-friendly, localizable display name for the UI (table headers, chart axes, etc.).
262
+ */
252
263
  label: string;
264
+ /**
265
+ * Unique, stable, machine-friendly reference name for SQL (AS alias), exports, and scripting.
266
+ * If not provided, should be auto-generated from label or name.
267
+ */
268
+ alias?: string;
269
+ dataType: string;
253
270
  description?: string;
254
271
  qualifiedEntityName?: string;
255
272
  dateFormat?: DateFormatValue;
@@ -361,6 +378,11 @@ declare interface GroupByColumn extends BaseColumn {
361
378
  declare interface GroupByField extends Field {
362
379
  role: 'groupby';
363
380
  granularity?: 'day' | 'week' | 'month' | 'quarter' | 'year';
381
+ /**
382
+ * Optional SQL expression for grouping (e.g., DATE_TRUNC('month', order_date)).
383
+ * If present, used in SELECT and GROUP BY instead of just the column name.
384
+ */
385
+ expression?: string;
364
386
  }
365
387
 
366
388
  export declare type HtmlOptions = {
@@ -417,6 +439,31 @@ declare interface MetricColumn extends BaseColumn {
417
439
  declare interface MetricField extends Field {
418
440
  role: 'metric';
419
441
  aggregate: AggregateFunction;
442
+ /**
443
+ * Optional SQL expression for the metric (e.g., ship_date - order_date).
444
+ * If present, used as aggregate(expression) instead of aggregate(name).
445
+ */
446
+ expression?: string;
447
+ /**
448
+ * Optional parameters for future extensibility (e.g., window functions).
449
+ * * Example:
450
+ * {
451
+ aggregate: "SUM",
452
+ name: "sales",
453
+ parameters: {
454
+ window: "PARTITION BY region ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW"
455
+ }
456
+ }
457
+
458
+ {
459
+ aggregate: "COUNT",
460
+ name: "order_id",
461
+ parameters: {
462
+ filter: "status = 'Active'"
463
+ }
464
+ }
465
+ */
466
+ parameters?: Record<string, any>;
420
467
  aliasTemplate?: string;
421
468
  valueAliases?: Record<string, string>;
422
469
  }
@@ -7,6 +7,7 @@ import { ComboBoxOption as ComboBoxOption_2 } from '../../components/surfboard/f
7
7
  import { CustomCard as CustomCard_2 } from '..';
8
8
  import { DateRange } from 'react-day-picker';
9
9
  import { default as default_2 } from 'react-grid-layout';
10
+ import { Dialect as Dialect_2 } from '../types/explorer-types';
10
11
  import { DropdownItem as DropdownItem_2 } from '../types/dropdown-types';
11
12
  import { EmailSettings as EmailSettings_2 } from '..';
12
13
  import { FontSpec } from 'chart.js';
@@ -15,6 +16,7 @@ import { QueryObserverResult } from '@tanstack/query-core';
15
16
  import { RefetchOptions } from '@tanstack/query-core';
16
17
  import { StoreApi } from 'zustand';
17
18
  import { TBaseQuery as TBaseQuery_2 } from '..';
19
+ import { TDbCapabilities as TDbCapabilities_2 } from '../types';
18
20
  import { TFilter as TFilter_2 } from '../surfboard/filter/types';
19
21
  import { TFilterValue as TFilterValue_2 } from '..';
20
22
  import { TStyle as TStyle_2 } from '..';
@@ -603,10 +605,27 @@ export declare type ExportDataPayload = {
603
605
  };
604
606
 
605
607
  export declare interface Field {
608
+ /**
609
+ * Unique identifier for this field instance (for joins, UI state, etc.).
610
+ * Should be unique within the context of the query or data model.
611
+ * Example: 'orders.customer_id', 'expr_12345', etc.
612
+ */
606
613
  id: string;
614
+ /**
615
+ * The physical/source column name in the database or data source.
616
+ * Used for mapping to the underlying data model and SQL generation (unless overridden by expression).
617
+ */
607
618
  name: string;
608
- dataType: string;
619
+ /**
620
+ * Human-friendly, localizable display name for the UI (table headers, chart axes, etc.).
621
+ */
609
622
  label: string;
623
+ /**
624
+ * Unique, stable, machine-friendly reference name for SQL (AS alias), exports, and scripting.
625
+ * If not provided, should be auto-generated from label or name.
626
+ */
627
+ alias?: string;
628
+ dataType: string;
610
629
  description?: string;
611
630
  qualifiedEntityName?: string;
612
631
  dateFormat?: DateFormatValue;
@@ -771,6 +790,11 @@ export declare interface GroupByColumn extends BaseColumn {
771
790
  export declare interface GroupByField extends Field {
772
791
  role: 'groupby';
773
792
  granularity?: 'day' | 'week' | 'month' | 'quarter' | 'year';
793
+ /**
794
+ * Optional SQL expression for grouping (e.g., DATE_TRUNC('month', order_date)).
795
+ * If present, used in SELECT and GROUP BY instead of just the column name.
796
+ */
797
+ expression?: string;
774
798
  }
775
799
 
776
800
  export declare type HtmlOptions = {
@@ -839,6 +863,31 @@ export declare interface MetricColumn extends BaseColumn {
839
863
  export declare interface MetricField extends Field {
840
864
  role: 'metric';
841
865
  aggregate: AggregateFunction;
866
+ /**
867
+ * Optional SQL expression for the metric (e.g., ship_date - order_date).
868
+ * If present, used as aggregate(expression) instead of aggregate(name).
869
+ */
870
+ expression?: string;
871
+ /**
872
+ * Optional parameters for future extensibility (e.g., window functions).
873
+ * * Example:
874
+ * {
875
+ aggregate: "SUM",
876
+ name: "sales",
877
+ parameters: {
878
+ window: "PARTITION BY region ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW"
879
+ }
880
+ }
881
+
882
+ {
883
+ aggregate: "COUNT",
884
+ name: "order_id",
885
+ parameters: {
886
+ filter: "status = 'Active'"
887
+ }
888
+ }
889
+ */
890
+ parameters?: Record<string, any>;
842
891
  aliasTemplate?: string;
843
892
  valueAliases?: Record<string, string>;
844
893
  }
@@ -1356,6 +1405,14 @@ export declare const useEditorActions: () => Actions_2;
1356
1405
  export declare function useEditorAside(token?: AuthToken, _connectionQueryKey?: string): {
1357
1406
  connectionItems: ConnectionItem[];
1358
1407
  selectedConnectionId: string | undefined;
1408
+ selectedConnection: {
1409
+ id: string;
1410
+ name: string;
1411
+ type: string;
1412
+ dialect?: Dialect_2;
1413
+ uiType?: "database" | "api" | "s3";
1414
+ capabilities: TDbCapabilities_2;
1415
+ } | undefined;
1359
1416
  isConnectionsLoading: boolean;
1360
1417
  isConnectionsError: boolean;
1361
1418
  modelItems: DropdownItem_2[];
@@ -249,10 +249,27 @@ export declare type ExportDataPayload = {
249
249
  };
250
250
 
251
251
  declare interface Field {
252
+ /**
253
+ * Unique identifier for this field instance (for joins, UI state, etc.).
254
+ * Should be unique within the context of the query or data model.
255
+ * Example: 'orders.customer_id', 'expr_12345', etc.
256
+ */
252
257
  id: string;
258
+ /**
259
+ * The physical/source column name in the database or data source.
260
+ * Used for mapping to the underlying data model and SQL generation (unless overridden by expression).
261
+ */
253
262
  name: string;
254
- dataType: string;
263
+ /**
264
+ * Human-friendly, localizable display name for the UI (table headers, chart axes, etc.).
265
+ */
255
266
  label: string;
267
+ /**
268
+ * Unique, stable, machine-friendly reference name for SQL (AS alias), exports, and scripting.
269
+ * If not provided, should be auto-generated from label or name.
270
+ */
271
+ alias?: string;
272
+ dataType: string;
256
273
  description?: string;
257
274
  qualifiedEntityName?: string;
258
275
  dateFormat?: DateFormatValue;
@@ -364,6 +381,11 @@ declare interface GroupByColumn extends BaseColumn {
364
381
  declare interface GroupByField extends Field {
365
382
  role: 'groupby';
366
383
  granularity?: 'day' | 'week' | 'month' | 'quarter' | 'year';
384
+ /**
385
+ * Optional SQL expression for grouping (e.g., DATE_TRUNC('month', order_date)).
386
+ * If present, used in SELECT and GROUP BY instead of just the column name.
387
+ */
388
+ expression?: string;
367
389
  }
368
390
 
369
391
  export declare type HtmlOptions = {
@@ -420,6 +442,31 @@ declare interface MetricColumn extends BaseColumn {
420
442
  declare interface MetricField extends Field {
421
443
  role: 'metric';
422
444
  aggregate: AggregateFunction;
445
+ /**
446
+ * Optional SQL expression for the metric (e.g., ship_date - order_date).
447
+ * If present, used as aggregate(expression) instead of aggregate(name).
448
+ */
449
+ expression?: string;
450
+ /**
451
+ * Optional parameters for future extensibility (e.g., window functions).
452
+ * * Example:
453
+ * {
454
+ aggregate: "SUM",
455
+ name: "sales",
456
+ parameters: {
457
+ window: "PARTITION BY region ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW"
458
+ }
459
+ }
460
+
461
+ {
462
+ aggregate: "COUNT",
463
+ name: "order_id",
464
+ parameters: {
465
+ filter: "status = 'Active'"
466
+ }
467
+ }
468
+ */
469
+ parameters?: Record<string, any>;
423
470
  aliasTemplate?: string;
424
471
  valueAliases?: Record<string, string>;
425
472
  }
@@ -243,10 +243,27 @@ export declare type ExportDataPayload = {
243
243
  };
244
244
 
245
245
  declare interface Field {
246
+ /**
247
+ * Unique identifier for this field instance (for joins, UI state, etc.).
248
+ * Should be unique within the context of the query or data model.
249
+ * Example: 'orders.customer_id', 'expr_12345', etc.
250
+ */
246
251
  id: string;
252
+ /**
253
+ * The physical/source column name in the database or data source.
254
+ * Used for mapping to the underlying data model and SQL generation (unless overridden by expression).
255
+ */
247
256
  name: string;
248
- dataType: string;
257
+ /**
258
+ * Human-friendly, localizable display name for the UI (table headers, chart axes, etc.).
259
+ */
249
260
  label: string;
261
+ /**
262
+ * Unique, stable, machine-friendly reference name for SQL (AS alias), exports, and scripting.
263
+ * If not provided, should be auto-generated from label or name.
264
+ */
265
+ alias?: string;
266
+ dataType: string;
250
267
  description?: string;
251
268
  qualifiedEntityName?: string;
252
269
  dateFormat?: DateFormatValue;
@@ -358,6 +375,11 @@ declare interface GroupByColumn extends BaseColumn {
358
375
  declare interface GroupByField extends Field {
359
376
  role: 'groupby';
360
377
  granularity?: 'day' | 'week' | 'month' | 'quarter' | 'year';
378
+ /**
379
+ * Optional SQL expression for grouping (e.g., DATE_TRUNC('month', order_date)).
380
+ * If present, used in SELECT and GROUP BY instead of just the column name.
381
+ */
382
+ expression?: string;
361
383
  }
362
384
 
363
385
  export declare type HtmlOptions = {
@@ -414,6 +436,31 @@ declare interface MetricColumn extends BaseColumn {
414
436
  declare interface MetricField extends Field {
415
437
  role: 'metric';
416
438
  aggregate: AggregateFunction;
439
+ /**
440
+ * Optional SQL expression for the metric (e.g., ship_date - order_date).
441
+ * If present, used as aggregate(expression) instead of aggregate(name).
442
+ */
443
+ expression?: string;
444
+ /**
445
+ * Optional parameters for future extensibility (e.g., window functions).
446
+ * * Example:
447
+ * {
448
+ aggregate: "SUM",
449
+ name: "sales",
450
+ parameters: {
451
+ window: "PARTITION BY region ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW"
452
+ }
453
+ }
454
+
455
+ {
456
+ aggregate: "COUNT",
457
+ name: "order_id",
458
+ parameters: {
459
+ filter: "status = 'Active'"
460
+ }
461
+ }
462
+ */
463
+ parameters?: Record<string, any>;
417
464
  aliasTemplate?: string;
418
465
  valueAliases?: Record<string, string>;
419
466
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.503",
8
+ "version": "0.0.505",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",