semaphor 0.0.128 → 0.0.129

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/dashboard-plus-DuenxiNV.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-BZ8k_sGe.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-vO1PNFhv.js";
1
+ import { D as f } from "../chunks/dashboard-plus-qMRXHdYf.js";
2
2
  import { EMPTY_SELECTION as a } from "../types/index.js";
3
3
  export {
4
4
  a as EMPTY_SELECTION,
@@ -104,7 +104,7 @@ declare interface CardConfig {
104
104
  * Configuration for on-click dashboard filters triggered by this card.
105
105
  */
106
106
  clickFilterInteractions?: ClickFilterInteraction[];
107
- comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target';
107
+ comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
108
108
  targetValue?: number;
109
109
  showTrendline?: boolean;
110
110
  trendlineWindow?: number;
@@ -347,6 +347,8 @@ export declare type DateOptions = {
347
347
  options: Intl.DateTimeFormatOptions;
348
348
  };
349
349
 
350
+ declare type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
351
+
350
352
  declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
351
353
 
352
354
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
@@ -505,6 +507,7 @@ declare type FilterForCompare = BaseFilter & {
505
507
  declare type FilterForDate = BaseFilter & {
506
508
  operation: 'between' | 'not between';
507
509
  values: [Date, Date];
510
+ relativeMeta?: RelativeDateFilter;
508
511
  };
509
512
 
510
513
  declare type FilterForEqual = BaseFilter & {
@@ -686,7 +689,7 @@ declare type OldFilterValue = string | number | null | (string | number)[] | Ran
686
689
 
687
690
  declare type Operation = '=' | '>' | '<' | '>=' | '<=' | '!=' | 'in' | 'not in' | 'like' | 'not like' | 'between' | 'not between' | 'is null' | 'is not null';
688
691
 
689
- declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in' | 'between' | 'isNull' | 'isNotNull';
692
+ declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in' | 'between' | 'not between' | 'isNull' | 'isNotNull';
690
693
 
691
694
  declare type OptionsMap = {
692
695
  number: NumberOptions;
@@ -752,6 +755,25 @@ declare type RangeValue = {
752
755
  gt?: string | number;
753
756
  };
754
757
 
758
+ declare type RelativeDateFilter = {
759
+ mode: 'last';
760
+ n: number;
761
+ unit: DateUnit;
762
+ complete?: boolean;
763
+ } | {
764
+ mode: 'this';
765
+ unit: DateUnit;
766
+ toDate?: boolean;
767
+ } | {
768
+ mode: 'previous';
769
+ unit: DateUnit;
770
+ } | {
771
+ mode: 'between';
772
+ unit: DateUnit;
773
+ from: number;
774
+ to: number;
775
+ };
776
+
755
777
  declare type SelectedEntities = DatabaseEntityReference[] | DataModelEntityReference[] | FileEntityReference[];
756
778
 
757
779
  export declare type SelectionState = Record<Level, string | null>;
@@ -18,6 +18,7 @@ import { MetricField as MetricField_2 } from '../types/explorer-types';
18
18
  import { PaginationMetadata as PaginationMetadata_2 } from '../types/explorer-types';
19
19
  import { PivotByField as PivotByField_2 } from '../types/explorer-types';
20
20
  import { QueryObserverResult } from '@tanstack/query-core';
21
+ import * as React_2 from 'react';
21
22
  import { RefetchOptions } from '@tanstack/query-core';
22
23
  import { StoreApi } from 'zustand';
23
24
  import { TBaseQuery as TBaseQuery_2 } from '..';
@@ -70,6 +71,8 @@ declare type Actions = {
70
71
  setCardPython: (cardId: string, pythonCode: string) => void;
71
72
  setCardDescription: (sheetId: string, cardId: string, description: string) => void;
72
73
  setCardKpiOptions: (sheetId: string, cardId: string, kpiOptions: Record<string, any>) => void;
74
+ updateCardFilters: (cardId: string, filters: FilterGroup | undefined) => void;
75
+ clearCardFilters: (cardId: string) => void;
73
76
  addFrame: (sheetId: string, frame: TFrame, position?: 'start' | 'end') => void;
74
77
  updateFrame: (sheetId: string, frame: TFrame) => void;
75
78
  updateCard: (sheetId: string, card: TCard) => void;
@@ -250,6 +253,21 @@ export declare type AuthToken = {
250
253
  refreshToken?: string;
251
254
  };
252
255
 
256
+ /**
257
+ * Metadata for auto-resolved joins returned by the backend
258
+ *
259
+ * When the backend auto-resolves joins using semantic relationships,
260
+ * it returns this metadata alongside the query results.
261
+ */
262
+ export declare interface AutoJoinMetadata {
263
+ /** The complete join plan that was auto-resolved */
264
+ resolvedJoinPlan: JoinPlan;
265
+ /** Flag indicating the joins were auto-resolved (vs manually configured) */
266
+ autoResolved: boolean;
267
+ /** Names of the semantic relationships that were used */
268
+ relationshipsUsed: string[];
269
+ }
270
+
253
271
  export declare type AxisConfig = {
254
272
  enabled?: boolean;
255
273
  name?: {
@@ -326,7 +344,7 @@ export declare interface CardConfig {
326
344
  * Configuration for on-click dashboard filters triggered by this card.
327
345
  */
328
346
  clickFilterInteractions?: ClickFilterInteraction[];
329
- comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target';
347
+ comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
330
348
  targetValue?: number;
331
349
  showTrendline?: boolean;
332
350
  trendlineWindow?: number;
@@ -452,6 +470,22 @@ declare type ColumnSettingsMap = Record<string, ColumnSettings>;
452
470
 
453
471
  export declare type ColumnType = 'string' | 'number' | 'date';
454
472
 
473
+ export declare function Combobox({ name, items, value, onChange, isLoading, isError, refetch, className, icon, showNone, }: {
474
+ icon?: React_2.ReactNode;
475
+ name?: string;
476
+ items: {
477
+ id: string;
478
+ name: string;
479
+ }[];
480
+ value: string;
481
+ onChange: (value: string) => void;
482
+ isLoading: boolean;
483
+ isError: boolean;
484
+ refetch: () => void;
485
+ className?: string;
486
+ showNone?: boolean;
487
+ }): JSX_2.Element;
488
+
455
489
  declare type ComboBoxOption = {
456
490
  id: number | string;
457
491
  value: string;
@@ -472,6 +506,13 @@ export declare type ConnectionType = 'GoogleSheets' | 'MySQL' | 'MSSQL' | 'Postg
472
506
 
473
507
  export declare type ContainerId = 'groupBy' | 'metrics' | 'pivotBy' | 'sortBy' | 'source';
474
508
 
509
+ /**
510
+ * Factory function to create empty KPI card configuration
511
+ * Returns a fresh config with new array instances to prevent shared references
512
+ * Used when switching to KPI chart type
513
+ */
514
+ export declare const createEmptyKpiConfig: () => CardConfig;
515
+
475
516
  export declare function createSqlGenConfig(column: TDataColumn, preSqlGen: SqlGen, calc?: AggregateCalc): SqlGen;
476
517
 
477
518
  export declare type CustomCard = CardWithContent | CardWithFooter;
@@ -650,6 +691,8 @@ export declare type DateOptions = {
650
691
 
651
692
  export { DateRange }
652
693
 
694
+ declare type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
695
+
653
696
  export declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
654
697
 
655
698
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
@@ -930,6 +973,7 @@ declare type FilterForCompare = BaseFilter & {
930
973
  declare type FilterForDate = BaseFilter & {
931
974
  operation: 'between' | 'not between';
932
975
  values: [Date, Date];
976
+ relativeMeta?: RelativeDateFilter;
933
977
  };
934
978
 
935
979
  declare type FilterForEqual = BaseFilter & {
@@ -1184,7 +1228,7 @@ export declare type OldFilterValue = string | number | null | (string | number)[
1184
1228
 
1185
1229
  declare type Operation = '=' | '>' | '<' | '>=' | '<=' | '!=' | 'in' | 'not in' | 'like' | 'not like' | 'between' | 'not between' | 'is null' | 'is not null';
1186
1230
 
1187
- export declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in' | 'between' | 'isNull' | 'isNotNull';
1231
+ export declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in' | 'between' | 'not between' | 'isNull' | 'isNotNull';
1188
1232
 
1189
1233
  declare type OptionsMap = {
1190
1234
  number: NumberOptions;
@@ -1289,6 +1333,25 @@ export declare type RangeValue = {
1289
1333
  gt?: string | number;
1290
1334
  };
1291
1335
 
1336
+ declare type RelativeDateFilter = {
1337
+ mode: 'last';
1338
+ n: number;
1339
+ unit: DateUnit;
1340
+ complete?: boolean;
1341
+ } | {
1342
+ mode: 'this';
1343
+ unit: DateUnit;
1344
+ toDate?: boolean;
1345
+ } | {
1346
+ mode: 'previous';
1347
+ unit: DateUnit;
1348
+ } | {
1349
+ mode: 'between';
1350
+ unit: DateUnit;
1351
+ from: number;
1352
+ to: number;
1353
+ };
1354
+
1292
1355
  export declare function resolveDatamodelName(datamodelName: string): string;
1293
1356
 
1294
1357
  export declare const resolveDataType: (value: any) => string;
@@ -1314,31 +1377,10 @@ export declare function ScheduleDashboard({ triggerButtonClassName, }: {
1314
1377
 
1315
1378
  export declare type SchemaItem = DropdownItem;
1316
1379
 
1317
- export declare function SelectComponent({ title, items, value, isLoading, isError, refetch, onChange, showNone, className, disabled, type, }: SelectProps): JSX_2.Element;
1318
-
1319
1380
  export declare type SelectedEntities = DatabaseEntityReference[] | DataModelEntityReference[] | FileEntityReference[];
1320
1381
 
1321
1382
  export declare type SelectionState = Record<Level, string | null>;
1322
1383
 
1323
- declare type SelectProps = {
1324
- title: string;
1325
- items: {
1326
- id: string;
1327
- name: string;
1328
- }[];
1329
- value: string;
1330
- isLoading: boolean;
1331
- isError: boolean;
1332
- refetch: () => void;
1333
- onChange?: (value: string) => void;
1334
- showNone?: boolean;
1335
- className?: string;
1336
- showIcon?: boolean;
1337
- connectionTooltip?: string;
1338
- disabled?: boolean;
1339
- type?: 'select' | 'combobox';
1340
- };
1341
-
1342
1384
  export declare const SemaphorContextProvider: ({ children, dashboardProps, }: {
1343
1385
  children: React.ReactNode;
1344
1386
  dashboardProps: DashboardProps;
@@ -2096,6 +2138,7 @@ export declare function useDateFilterHook(filterId: string): {
2096
2138
  dateRange: DateRange | undefined;
2097
2139
  handleClear: () => void;
2098
2140
  handleChange: (date: DateRange | undefined) => void;
2141
+ handleRelativeChange: (date: DateRange | undefined, relativeMeta: RelativeDateFilter) => void;
2099
2142
  handleReset: () => void;
2100
2143
  };
2101
2144
 
@@ -104,7 +104,7 @@ declare interface CardConfig {
104
104
  * Configuration for on-click dashboard filters triggered by this card.
105
105
  */
106
106
  clickFilterInteractions?: ClickFilterInteraction[];
107
- comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target';
107
+ comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
108
108
  targetValue?: number;
109
109
  showTrendline?: boolean;
110
110
  trendlineWindow?: number;
@@ -350,6 +350,8 @@ export declare type DateOptions = {
350
350
  options: Intl.DateTimeFormatOptions;
351
351
  };
352
352
 
353
+ declare type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
354
+
353
355
  declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
354
356
 
355
357
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
@@ -508,6 +510,7 @@ declare type FilterForCompare = BaseFilter & {
508
510
  declare type FilterForDate = BaseFilter & {
509
511
  operation: 'between' | 'not between';
510
512
  values: [Date, Date];
513
+ relativeMeta?: RelativeDateFilter;
511
514
  };
512
515
 
513
516
  declare type FilterForEqual = BaseFilter & {
@@ -689,7 +692,7 @@ declare type OldFilterValue = string | number | null | (string | number)[] | Ran
689
692
 
690
693
  declare type Operation = '=' | '>' | '<' | '>=' | '<=' | '!=' | 'in' | 'not in' | 'like' | 'not like' | 'between' | 'not between' | 'is null' | 'is not null';
691
694
 
692
- declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in' | 'between' | 'isNull' | 'isNotNull';
695
+ declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in' | 'between' | 'not between' | 'isNull' | 'isNotNull';
693
696
 
694
697
  declare type OptionsMap = {
695
698
  number: NumberOptions;
@@ -755,6 +758,25 @@ declare type RangeValue = {
755
758
  gt?: string | number;
756
759
  };
757
760
 
761
+ declare type RelativeDateFilter = {
762
+ mode: 'last';
763
+ n: number;
764
+ unit: DateUnit;
765
+ complete?: boolean;
766
+ } | {
767
+ mode: 'this';
768
+ unit: DateUnit;
769
+ toDate?: boolean;
770
+ } | {
771
+ mode: 'previous';
772
+ unit: DateUnit;
773
+ } | {
774
+ mode: 'between';
775
+ unit: DateUnit;
776
+ from: number;
777
+ to: number;
778
+ };
779
+
758
780
  declare type SelectedEntities = DatabaseEntityReference[] | DataModelEntityReference[] | FileEntityReference[];
759
781
 
760
782
  export declare type SelectionState = Record<Level, string | null>;
@@ -103,7 +103,7 @@ declare interface CardConfig {
103
103
  * Configuration for on-click dashboard filters triggered by this card.
104
104
  */
105
105
  clickFilterInteractions?: ClickFilterInteraction[];
106
- comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target';
106
+ comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
107
107
  targetValue?: number;
108
108
  showTrendline?: boolean;
109
109
  trendlineWindow?: number;
@@ -344,6 +344,8 @@ export declare type DateOptions = {
344
344
  options: Intl.DateTimeFormatOptions;
345
345
  };
346
346
 
347
+ declare type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
348
+
347
349
  declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
348
350
 
349
351
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
@@ -502,6 +504,7 @@ declare type FilterForCompare = BaseFilter & {
502
504
  declare type FilterForDate = BaseFilter & {
503
505
  operation: 'between' | 'not between';
504
506
  values: [Date, Date];
507
+ relativeMeta?: RelativeDateFilter;
505
508
  };
506
509
 
507
510
  declare type FilterForEqual = BaseFilter & {
@@ -683,7 +686,7 @@ declare type OldFilterValue = string | number | null | (string | number)[] | Ran
683
686
 
684
687
  declare type Operation = '=' | '>' | '<' | '>=' | '<=' | '!=' | 'in' | 'not in' | 'like' | 'not like' | 'between' | 'not between' | 'is null' | 'is not null';
685
688
 
686
- declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in' | 'between' | 'isNull' | 'isNotNull';
689
+ declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'not in' | 'between' | 'not between' | 'isNull' | 'isNotNull';
687
690
 
688
691
  declare type OptionsMap = {
689
692
  number: NumberOptions;
@@ -749,6 +752,25 @@ declare type RangeValue = {
749
752
  gt?: string | number;
750
753
  };
751
754
 
755
+ declare type RelativeDateFilter = {
756
+ mode: 'last';
757
+ n: number;
758
+ unit: DateUnit;
759
+ complete?: boolean;
760
+ } | {
761
+ mode: 'this';
762
+ unit: DateUnit;
763
+ toDate?: boolean;
764
+ } | {
765
+ mode: 'previous';
766
+ unit: DateUnit;
767
+ } | {
768
+ mode: 'between';
769
+ unit: DateUnit;
770
+ from: number;
771
+ to: number;
772
+ };
773
+
752
774
  declare type SelectedEntities = DatabaseEntityReference[] | DataModelEntityReference[] | FileEntityReference[];
753
775
 
754
776
  export declare type SelectionState = Record<Level, string | null>;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.128",
8
+ "version": "0.0.129",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",