react-semaphor 0.0.504 → 0.0.506

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CGZJfir8.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-B6aFim6x.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as a } from "../chunks/index-CgeLnBe2.js";
1
+ import { D as a } from "../chunks/index-B4zq9EOh.js";
2
2
  import { EMPTY_SELECTION as e } from "../types/index.js";
3
3
  export {
4
4
  a as Dashboard,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-CGZJfir8.js"),t=require("./types/index.cjs"),a=require("./chunks/dashboard-plus-DkRjEQS7.js");require("react/jsx-runtime");require("react");require("react-dom");const o=["YYYY-MM-DD","MM/DD/YYYY","DD/MM/YYYY","MMMM DD, YYYY","MMM DD, YYYY","DD MMM YYYY","YYYY-MM","MMMM YYYY","custom"];exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.createSqlGenConfig=e.createSqlGenConfig;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=t.EMPTY_SELECTION;exports.ScheduleDashboard=a.ScheduleDashboard;exports.SelectComponent=a.SelectComponent;exports.Surfboard=a.DashboardPlus;exports.cleanCard=a.cleanCard;exports.downloadPdf=a.downloadPdf;exports.getDashbaordStateWithoutData=a.getDashbaordStateWithoutData;exports.DATE_FORMAT_VALUES=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-B6aFim6x.js"),t=require("./types/index.cjs"),a=require("./chunks/dashboard-plus-BFfj_pPX.js");require("react/jsx-runtime");require("react");require("react-dom");const o=["YYYY-MM-DD","MM/DD/YYYY","DD/MM/YYYY","MMMM DD, YYYY","MMM DD, YYYY","DD MMM YYYY","YYYY-MM","MMMM YYYY","custom"];exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.createSqlGenConfig=e.createSqlGenConfig;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=t.EMPTY_SELECTION;exports.ScheduleDashboard=a.ScheduleDashboard;exports.SelectComponent=a.SelectComponent;exports.Surfboard=a.DashboardPlus;exports.cleanCard=a.cleanCard;exports.downloadPdf=a.downloadPdf;exports.getDashbaordStateWithoutData=a.getDashbaordStateWithoutData;exports.DATE_FORMAT_VALUES=o;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D, c as Y, S as i, S as d, l, f as M, n as u, m, p as n, q as p, k as S, i as T, j as b, o as h, h as c, g as y, e as C, s as f, r as g, b as E, w as x, v as A, d as F, u as v, y as N, t as k, x as q, a as P } from "./chunks/index-CgeLnBe2.js";
1
+ import { D, c as Y, S as i, S as d, l, f as M, n as u, m, p as n, q as p, k as S, i as T, j as b, o as h, h as c, g as y, e as C, s as f, r as g, b as E, w as x, v as A, d as F, u as v, y as N, t as k, x as q, a as P } from "./chunks/index-B4zq9EOh.js";
2
2
  import { EMPTY_SELECTION as _ } from "./types/index.js";
3
- import { S as G, a as H, D as I, c as L, d as O, g as V } from "./chunks/dashboard-plus-l7VBGMzZ.js";
3
+ import { S as G, a as H, D as I, c as L, d as O, g as V } from "./chunks/dashboard-plus-CIhFBA0f.js";
4
4
  import "react/jsx-runtime";
5
5
  import "react";
6
6
  import "react-dom";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-DkRjEQS7.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-BFfj_pPX.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as f } from "../chunks/dashboard-plus-l7VBGMzZ.js";
1
+ import { D as f } from "../chunks/dashboard-plus-CIhFBA0f.js";
2
2
  import { EMPTY_SELECTION as a } from "../types/index.js";
3
3
  export {
4
4
  a as EMPTY_SELECTION,
@@ -196,9 +196,9 @@ declare interface DataModelEntityReference extends DatabaseEntityReference {
196
196
 
197
197
  declare interface DataSource {
198
198
  connectionId: string;
199
- semanticModelId?: string;
199
+ semanticDomainId?: string;
200
200
  connectionType: string;
201
- mode: 'database' | 'upload' | 'url' | 'semanticModel';
201
+ mode: 'database' | 'upload' | 'url' | 'semanticDomain';
202
202
  dbSelection?: {
203
203
  database: string;
204
204
  schema: string;
@@ -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 '..';
@@ -441,15 +443,16 @@ export declare interface DataModelEntityReference extends DatabaseEntityReferenc
441
443
  export declare interface DatasetEntityReference extends DatabaseEntityReference {
442
444
  type: 'dataset';
443
445
  id: string;
446
+ domainId: string;
444
447
  label: string;
445
448
  description: string;
446
449
  }
447
450
 
448
451
  export declare interface DataSource {
449
452
  connectionId: string;
450
- semanticModelId?: string;
453
+ semanticDomainId?: string;
451
454
  connectionType: string;
452
- mode: 'database' | 'upload' | 'url' | 'semanticModel';
455
+ mode: 'database' | 'upload' | 'url' | 'semanticDomain';
453
456
  dbSelection?: {
454
457
  database: string;
455
458
  schema: string;
@@ -563,7 +566,7 @@ declare interface ExplorerActions {
563
566
  setActiveTabCard: (cardId: string | null) => void;
564
567
  updateDataSource: (dataSource: DataSource) => void;
565
568
  setDataSource: (dataSource: DataSource) => void;
566
- updateSemanticModel: (semanticModelId: string) => void;
569
+ updateSemanticDomain: (semanticDomainId: string) => void;
567
570
  updateDirectSource: (updates: Partial<DataSource>) => void;
568
571
  getAvailableFields: () => Array<{
569
572
  id: string;
@@ -603,10 +606,27 @@ export declare type ExportDataPayload = {
603
606
  };
604
607
 
605
608
  export declare interface Field {
609
+ /**
610
+ * Unique identifier for this field instance (for joins, UI state, etc.).
611
+ * Should be unique within the context of the query or data model.
612
+ * Example: 'orders.customer_id', 'expr_12345', etc.
613
+ */
606
614
  id: string;
615
+ /**
616
+ * The physical/source column name in the database or data source.
617
+ * Used for mapping to the underlying data model and SQL generation (unless overridden by expression).
618
+ */
607
619
  name: string;
608
- dataType: string;
620
+ /**
621
+ * Human-friendly, localizable display name for the UI (table headers, chart axes, etc.).
622
+ */
609
623
  label: string;
624
+ /**
625
+ * Unique, stable, machine-friendly reference name for SQL (AS alias), exports, and scripting.
626
+ * If not provided, should be auto-generated from label or name.
627
+ */
628
+ alias?: string;
629
+ dataType: string;
610
630
  description?: string;
611
631
  qualifiedEntityName?: string;
612
632
  dateFormat?: DateFormatValue;
@@ -771,6 +791,11 @@ export declare interface GroupByColumn extends BaseColumn {
771
791
  export declare interface GroupByField extends Field {
772
792
  role: 'groupby';
773
793
  granularity?: 'day' | 'week' | 'month' | 'quarter' | 'year';
794
+ /**
795
+ * Optional SQL expression for grouping (e.g., DATE_TRUNC('month', order_date)).
796
+ * If present, used in SELECT and GROUP BY instead of just the column name.
797
+ */
798
+ expression?: string;
774
799
  }
775
800
 
776
801
  export declare type HtmlOptions = {
@@ -839,6 +864,31 @@ export declare interface MetricColumn extends BaseColumn {
839
864
  export declare interface MetricField extends Field {
840
865
  role: 'metric';
841
866
  aggregate: AggregateFunction;
867
+ /**
868
+ * Optional SQL expression for the metric (e.g., ship_date - order_date).
869
+ * If present, used as aggregate(expression) instead of aggregate(name).
870
+ */
871
+ expression?: string;
872
+ /**
873
+ * Optional parameters for future extensibility (e.g., window functions).
874
+ * * Example:
875
+ * {
876
+ aggregate: "SUM",
877
+ name: "sales",
878
+ parameters: {
879
+ window: "PARTITION BY region ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW"
880
+ }
881
+ }
882
+
883
+ {
884
+ aggregate: "COUNT",
885
+ name: "order_id",
886
+ parameters: {
887
+ filter: "status = 'Active'"
888
+ }
889
+ }
890
+ */
891
+ parameters?: Record<string, any>;
842
892
  aliasTemplate?: string;
843
893
  valueAliases?: Record<string, string>;
844
894
  }
@@ -1356,6 +1406,14 @@ export declare const useEditorActions: () => Actions_2;
1356
1406
  export declare function useEditorAside(token?: AuthToken, _connectionQueryKey?: string): {
1357
1407
  connectionItems: ConnectionItem[];
1358
1408
  selectedConnectionId: string | undefined;
1409
+ selectedConnection: {
1410
+ id: string;
1411
+ name: string;
1412
+ type: string;
1413
+ dialect?: Dialect_2;
1414
+ uiType?: "database" | "api" | "s3";
1415
+ capabilities: TDbCapabilities_2;
1416
+ } | undefined;
1359
1417
  isConnectionsLoading: boolean;
1360
1418
  isConnectionsError: boolean;
1361
1419
  modelItems: DropdownItem_2[];
@@ -199,9 +199,9 @@ declare interface DataModelEntityReference extends DatabaseEntityReference {
199
199
 
200
200
  declare interface DataSource {
201
201
  connectionId: string;
202
- semanticModelId?: string;
202
+ semanticDomainId?: string;
203
203
  connectionType: string;
204
- mode: 'database' | 'upload' | 'url' | 'semanticModel';
204
+ mode: 'database' | 'upload' | 'url' | 'semanticDomain';
205
205
  dbSelection?: {
206
206
  database: string;
207
207
  schema: string;
@@ -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
  }
@@ -193,9 +193,9 @@ declare interface DataModelEntityReference extends DatabaseEntityReference {
193
193
 
194
194
  declare interface DataSource {
195
195
  connectionId: string;
196
- semanticModelId?: string;
196
+ semanticDomainId?: string;
197
197
  connectionType: string;
198
- mode: 'database' | 'upload' | 'url' | 'semanticModel';
198
+ mode: 'database' | 'upload' | 'url' | 'semanticDomain';
199
199
  dbSelection?: {
200
200
  database: string;
201
201
  schema: string;
@@ -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.504",
8
+ "version": "0.0.506",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",