drizzle-cube 0.2.5 → 0.2.8

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.
Files changed (122) hide show
  1. package/dist/client/charts.js +15 -15
  2. package/dist/client/chunks/{chart-activitygridchart-BzL97Vnm.js → chart-activitygridchart-Cz4bEf3V.js} +219 -217
  3. package/dist/client/chunks/chart-activitygridchart-Cz4bEf3V.js.map +1 -0
  4. package/dist/client/chunks/{chart-activitygridchart-config-48WqIofo.js → chart-activitygridchart-config-BngZDVh_.js} +96 -90
  5. package/dist/client/chunks/chart-activitygridchart-config-BngZDVh_.js.map +1 -0
  6. package/dist/client/chunks/{chart-areachart-BtH3SvAM.js → chart-areachart-DLdolSnU.js} +3 -3
  7. package/dist/client/chunks/{chart-areachart-BtH3SvAM.js.map → chart-areachart-DLdolSnU.js.map} +1 -1
  8. package/dist/client/chunks/{chart-areachart-config-D8taXdn1.js → chart-areachart-config-DWN1E5ej.js} +2 -2
  9. package/dist/client/chunks/{chart-areachart-config-D8taXdn1.js.map → chart-areachart-config-DWN1E5ej.js.map} +1 -1
  10. package/dist/client/chunks/chart-barchart-Bdjz8DJp.js +171 -0
  11. package/dist/client/chunks/chart-barchart-Bdjz8DJp.js.map +1 -0
  12. package/dist/client/chunks/{chart-barchart-config-DjRZBtLb.js → chart-barchart-config-DZA0xTns.js} +2 -2
  13. package/dist/client/chunks/{chart-barchart-config-DjRZBtLb.js.map → chart-barchart-config-DZA0xTns.js.map} +1 -1
  14. package/dist/client/chunks/{chart-bubblechart-Lj_PnppP.js → chart-bubblechart-BlQkmqkI.js} +2 -2
  15. package/dist/client/chunks/{chart-bubblechart-Lj_PnppP.js.map → chart-bubblechart-BlQkmqkI.js.map} +1 -1
  16. package/dist/client/chunks/{chart-bubblechart-config-C6ck2qmg.js → chart-bubblechart-config-C79lfDSO.js} +2 -2
  17. package/dist/client/chunks/{chart-bubblechart-config-C6ck2qmg.js.map → chart-bubblechart-config-C79lfDSO.js.map} +1 -1
  18. package/dist/client/chunks/{chart-charttooltip-D9BKscsw.js → chart-charttooltip-k8soCd2n.js} +2 -2
  19. package/dist/client/chunks/{chart-charttooltip-D9BKscsw.js.map → chart-charttooltip-k8soCd2n.js.map} +1 -1
  20. package/dist/client/chunks/chart-datatable-Mo4gYCwa.js +249 -0
  21. package/dist/client/chunks/chart-datatable-Mo4gYCwa.js.map +1 -0
  22. package/dist/client/chunks/{chart-datatable-config-B5z0SlOJ.js → chart-datatable-config-DqGw99R3.js} +2 -2
  23. package/dist/client/chunks/{chart-datatable-config-B5z0SlOJ.js.map → chart-datatable-config-DqGw99R3.js.map} +1 -1
  24. package/dist/client/chunks/{chart-kpidelta-Bx-stIIk.js → chart-kpidelta-CTcuIO9G.js} +3 -3
  25. package/dist/client/chunks/{chart-kpidelta-Bx-stIIk.js.map → chart-kpidelta-CTcuIO9G.js.map} +1 -1
  26. package/dist/client/chunks/{chart-kpidelta-config-CnZfi_P2.js → chart-kpidelta-config-B-Y-LHmd.js} +2 -2
  27. package/dist/client/chunks/{chart-kpidelta-config-CnZfi_P2.js.map → chart-kpidelta-config-B-Y-LHmd.js.map} +1 -1
  28. package/dist/client/chunks/{chart-kpinumber-config-CVikHojM.js → chart-kpinumber-config-BaNaJMI6.js} +2 -2
  29. package/dist/client/chunks/{chart-kpinumber-config-CVikHojM.js.map → chart-kpinumber-config-BaNaJMI6.js.map} +1 -1
  30. package/dist/client/chunks/{chart-kpinumber-BrXgyKGP.js → chart-kpinumber-slEXt8C-.js} +5 -5
  31. package/dist/client/chunks/{chart-kpinumber-BrXgyKGP.js.map → chart-kpinumber-slEXt8C-.js.map} +1 -1
  32. package/dist/client/chunks/{chart-kpitext-config-B2MovXSw.js → chart-kpitext-config-BNywYqEW.js} +2 -2
  33. package/dist/client/chunks/{chart-kpitext-config-B2MovXSw.js.map → chart-kpitext-config-BNywYqEW.js.map} +1 -1
  34. package/dist/client/chunks/{chart-kpitext-_2tnYN_z.js → chart-kpitext-giq03TOK.js} +3 -3
  35. package/dist/client/chunks/{chart-kpitext-_2tnYN_z.js.map → chart-kpitext-giq03TOK.js.map} +1 -1
  36. package/dist/client/chunks/{chart-linechart-DBdIULsM.js → chart-linechart-BfnU6L-D.js} +4 -4
  37. package/dist/client/chunks/{chart-linechart-DBdIULsM.js.map → chart-linechart-BfnU6L-D.js.map} +1 -1
  38. package/dist/client/chunks/{chart-linechart-config-CVBVB7nS.js → chart-linechart-config-BL_1mjHF.js} +2 -2
  39. package/dist/client/chunks/{chart-linechart-config-CVBVB7nS.js.map → chart-linechart-config-BL_1mjHF.js.map} +1 -1
  40. package/dist/client/chunks/{chart-markdownchart-config-Cq5Sxrgq.js → chart-markdownchart-config-DtZOfYu4.js} +2 -2
  41. package/dist/client/chunks/{chart-markdownchart-config-Cq5Sxrgq.js.map → chart-markdownchart-config-DtZOfYu4.js.map} +1 -1
  42. package/dist/client/chunks/{chart-piechart-CzesCpZ_.js → chart-piechart-CZRDQxeB.js} +3 -3
  43. package/dist/client/chunks/{chart-piechart-CzesCpZ_.js.map → chart-piechart-CZRDQxeB.js.map} +1 -1
  44. package/dist/client/chunks/{chart-piechart-config-Bdd31Gdi.js → chart-piechart-config-Bg4jeIFo.js} +2 -2
  45. package/dist/client/chunks/{chart-piechart-config-Bdd31Gdi.js.map → chart-piechart-config-Bg4jeIFo.js.map} +1 -1
  46. package/dist/client/chunks/{chart-radarchart-B3WUEiTh.js → chart-radarchart-D5yRnY9j.js} +3 -3
  47. package/dist/client/chunks/{chart-radarchart-B3WUEiTh.js.map → chart-radarchart-D5yRnY9j.js.map} +1 -1
  48. package/dist/client/chunks/{chart-radarchart-config-BWyfn0ij.js → chart-radarchart-config-d6dLkI7B.js} +2 -2
  49. package/dist/client/chunks/{chart-radarchart-config-BWyfn0ij.js.map → chart-radarchart-config-d6dLkI7B.js.map} +1 -1
  50. package/dist/client/chunks/{chart-radialbarchart-DBiRcLd9.js → chart-radialbarchart-Djtcn7aH.js} +3 -3
  51. package/dist/client/chunks/{chart-radialbarchart-DBiRcLd9.js.map → chart-radialbarchart-Djtcn7aH.js.map} +1 -1
  52. package/dist/client/chunks/{chart-radialbarchart-config-lU2_NQCD.js → chart-radialbarchart-config-BGf97-BV.js} +2 -2
  53. package/dist/client/chunks/{chart-radialbarchart-config-lU2_NQCD.js.map → chart-radialbarchart-config-BGf97-BV.js.map} +1 -1
  54. package/dist/client/chunks/{chart-scatterchart-C_D9OqA1.js → chart-scatterchart-C83KgqYY.js} +2 -2
  55. package/dist/client/chunks/{chart-scatterchart-C_D9OqA1.js.map → chart-scatterchart-C83KgqYY.js.map} +1 -1
  56. package/dist/client/chunks/{chart-scatterchart-config-DtLnut1M.js → chart-scatterchart-config-DEIB74ot.js} +2 -2
  57. package/dist/client/chunks/{chart-scatterchart-config-DtLnut1M.js.map → chart-scatterchart-config-DEIB74ot.js.map} +1 -1
  58. package/dist/client/chunks/{chart-treemapchart-DJqy3Sy7.js → chart-treemapchart-BDKnKGTz.js} +3 -3
  59. package/dist/client/chunks/{chart-treemapchart-DJqy3Sy7.js.map → chart-treemapchart-BDKnKGTz.js.map} +1 -1
  60. package/dist/client/chunks/{chart-treemapchart-config-BEiIWQnR.js → chart-treemapchart-config-ppKPTB96.js} +2 -2
  61. package/dist/client/chunks/{chart-treemapchart-config-BEiIWQnR.js.map → chart-treemapchart-config-ppKPTB96.js.map} +1 -1
  62. package/dist/client/chunks/{charts-DFbr7EGW.js → charts-MJLpxe3r.js} +42 -42
  63. package/dist/client/chunks/{charts-DFbr7EGW.js.map → charts-MJLpxe3r.js.map} +1 -1
  64. package/dist/client/chunks/components-CXA6-jJq.js +9845 -0
  65. package/dist/client/chunks/components-CXA6-jJq.js.map +1 -0
  66. package/dist/client/chunks/{icons-D6z-_9sa.js → icons-B2XSxpVK.js} +213 -181
  67. package/dist/client/chunks/icons-B2XSxpVK.js.map +1 -0
  68. package/dist/client/chunks/{index-_pVwmFVW.js → index-CSeLP8gq.js} +2 -2
  69. package/dist/client/chunks/{index-_pVwmFVW.js.map → index-CSeLP8gq.js.map} +1 -1
  70. package/dist/client/components/AnalysisBuilder/AnalysisAxisDropZone.d.ts +27 -0
  71. package/dist/client/components/AnalysisBuilder/AnalysisChartConfigPanel.d.ts +21 -0
  72. package/dist/client/components/AnalysisBuilder/AnalysisFilterGroup.d.ts +20 -0
  73. package/dist/client/components/AnalysisBuilder/AnalysisFilterItem.d.ts +16 -0
  74. package/dist/client/components/AnalysisBuilder/AnalysisFilterSection.d.ts +12 -0
  75. package/dist/client/components/AnalysisBuilder/AnalysisQueryPanel.d.ts +10 -0
  76. package/dist/client/components/AnalysisBuilder/AnalysisResultsPanel.d.ts +12 -0
  77. package/dist/client/components/AnalysisBuilder/BreakdownItemCard.d.ts +10 -0
  78. package/dist/client/components/AnalysisBuilder/BreakdownSection.d.ts +8 -0
  79. package/dist/client/components/AnalysisBuilder/FieldDetailPanel.d.ts +4 -0
  80. package/dist/client/components/AnalysisBuilder/FieldSearchItem.d.ts +6 -0
  81. package/dist/client/components/AnalysisBuilder/FieldSearchModal.d.ts +2 -0
  82. package/dist/client/components/AnalysisBuilder/MetricItemCard.d.ts +9 -0
  83. package/dist/client/components/AnalysisBuilder/MetricsSection.d.ts +8 -0
  84. package/dist/client/components/AnalysisBuilder/index.d.ts +3 -0
  85. package/dist/client/components/AnalysisBuilder/types.d.ts +366 -0
  86. package/dist/client/components/AnalysisBuilder/utils.d.ts +103 -0
  87. package/dist/client/components/ChartTypeSelector.d.ts +6 -1
  88. package/dist/client/components/DashboardGrid.d.ts +3 -2
  89. package/dist/client/components/DashboardPortletCard.d.ts +63 -0
  90. package/dist/client/components/QueryBuilder/CubeMetaExplorer.d.ts +2 -2
  91. package/dist/client/components/QueryBuilder/QueryPanel.d.ts +2 -2
  92. package/dist/client/components/QueryBuilder/types.d.ts +7 -138
  93. package/dist/client/components/RowManagedLayout.d.ts +19 -0
  94. package/dist/client/components/charts/DataTable.d.ts +1 -1
  95. package/dist/client/components.js +16 -9148
  96. package/dist/client/components.js.map +1 -1
  97. package/dist/client/hooks.js +2 -2
  98. package/dist/client/icons/types.d.ts +6 -0
  99. package/dist/client/icons.js +1 -1
  100. package/dist/client/index.d.ts +1 -0
  101. package/dist/client/index.js +3202 -49
  102. package/dist/client/index.js.map +1 -1
  103. package/dist/client/providers/CubeProvider.d.ts +4 -2
  104. package/dist/client/providers.js +1 -1
  105. package/dist/client/shared/chartDefaults.d.ts +64 -0
  106. package/dist/client/shared/components/QueryAnalysisPanel.d.ts +7 -0
  107. package/dist/client/shared/index.d.ts +10 -0
  108. package/dist/client/shared/types.d.ts +134 -0
  109. package/dist/client/shared/utils.d.ts +101 -0
  110. package/dist/client/styles.css +1 -1
  111. package/dist/client/types.d.ts +20 -0
  112. package/dist/client/utils/index.d.ts +1 -0
  113. package/dist/client/utils/pivotUtils.d.ts +78 -0
  114. package/dist/client-bundle-stats.html +1 -1
  115. package/package.json +1 -1
  116. package/dist/client/chunks/chart-activitygridchart-BzL97Vnm.js.map +0 -1
  117. package/dist/client/chunks/chart-activitygridchart-config-48WqIofo.js.map +0 -1
  118. package/dist/client/chunks/chart-barchart-DX6DIoIp.js +0 -177
  119. package/dist/client/chunks/chart-barchart-DX6DIoIp.js.map +0 -1
  120. package/dist/client/chunks/chart-datatable-BaECYDn2.js +0 -57
  121. package/dist/client/chunks/chart-datatable-BaECYDn2.js.map +0 -1
  122. package/dist/client/chunks/icons-D6z-_9sa.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { CubeClient } from '../client/CubeClient';
3
- import { CubeQueryOptions, CubeApiOptions, FeaturesConfig } from '../types';
3
+ import { CubeQueryOptions, CubeApiOptions, FeaturesConfig, DashboardLayoutMode } from '../types';
4
4
  import { CubeMeta, FieldLabelMap } from '../hooks/useCubeMeta';
5
5
  import { BatchCoordinator } from '../client/BatchCoordinator';
6
6
  interface CubeContextValue {
@@ -16,6 +16,7 @@ interface CubeContextValue {
16
16
  features: FeaturesConfig;
17
17
  batchCoordinator: BatchCoordinator | null;
18
18
  enableBatching: boolean;
19
+ dashboardModes: DashboardLayoutMode[];
19
20
  }
20
21
  interface CubeProviderProps {
21
22
  cubeApi?: CubeClient;
@@ -23,12 +24,13 @@ interface CubeProviderProps {
23
24
  token?: string;
24
25
  options?: CubeQueryOptions;
25
26
  features?: FeaturesConfig;
27
+ dashboardModes?: DashboardLayoutMode[];
26
28
  enableBatching?: boolean;
27
29
  batchDelayMs?: number;
28
30
  children: React.ReactNode;
29
31
  }
30
32
  export declare function CubeProvider({ cubeApi: initialCubeApi, apiOptions: initialApiOptions, token: initialToken, options, features, // Default to AI enabled, schema diagram disabled
31
- enableBatching, // Default to batching enabled
33
+ dashboardModes, enableBatching, // Default to batching enabled
32
34
  batchDelayMs, // Default 100ms batch window
33
35
  children }: CubeProviderProps): import("react/jsx-runtime").JSX.Element;
34
36
  export declare function useCubeContext(): CubeContextValue;
@@ -1,4 +1,4 @@
1
- import { n as a, r as c, u as i } from "./chunks/chart-activitygridchart-BzL97Vnm.js";
1
+ import { n as a, r as c, u as i } from "./chunks/chart-activitygridchart-Cz4bEf3V.js";
2
2
  import { createContext as o, useContext as r } from "react";
3
3
  const e = o(null), n = e.Provider, C = () => r(e);
4
4
  export {
@@ -0,0 +1,64 @@
1
+ import { ChartType, ChartAxisConfig } from '../types';
2
+ import { MetricItem, BreakdownItem } from '../components/AnalysisBuilder/types';
3
+ /**
4
+ * Result of smart chart defaults calculation
5
+ */
6
+ export interface SmartChartDefaults {
7
+ /** The recommended chart type */
8
+ chartType: ChartType;
9
+ /** The auto-configured chart axis settings */
10
+ chartConfig: ChartAxisConfig;
11
+ }
12
+ /**
13
+ * Availability status for a chart type
14
+ */
15
+ export interface ChartAvailability {
16
+ /** Whether the chart type can be used with current selections */
17
+ available: boolean;
18
+ /** Reason why the chart is unavailable (for tooltip) */
19
+ reason?: string;
20
+ }
21
+ /**
22
+ * Map of chart type availability statuses
23
+ */
24
+ export type ChartAvailabilityMap = Record<ChartType, ChartAvailability>;
25
+ /**
26
+ * Check if a specific chart type is available given current selections
27
+ */
28
+ export declare function getChartAvailability(chartType: ChartType, metrics: MetricItem[], breakdowns: BreakdownItem[]): ChartAvailability;
29
+ /**
30
+ * Get availability for all chart types
31
+ */
32
+ export declare function getAllChartAvailability(metrics: MetricItem[], breakdowns: BreakdownItem[]): ChartAvailabilityMap;
33
+ /**
34
+ * Select the best chart type based on current metrics and breakdowns
35
+ *
36
+ * Priority order:
37
+ * 1. If current chart type is still valid, keep it (preserve user intent)
38
+ * 2. If current chart becomes invalid, switch to best alternative:
39
+ * - Has time dimension → line
40
+ * - Has dimension + measure → bar
41
+ * - Has measures only → bar (or kpiNumber if single measure + no breakdowns)
42
+ * - No fields → keep current
43
+ */
44
+ export declare function selectBestChartType(metrics: MetricItem[], breakdowns: BreakdownItem[], currentChartType: ChartType): ChartType;
45
+ /**
46
+ * Get smart default chart configuration based on chart type and selections
47
+ */
48
+ export declare function getSmartChartDefaults(metrics: MetricItem[], breakdowns: BreakdownItem[], currentChartType: ChartType): SmartChartDefaults;
49
+ /**
50
+ * Determine if chart type should be auto-switched based on selections change
51
+ *
52
+ * Returns the new chart type if a switch is recommended, or null if no change needed.
53
+ *
54
+ * @param metrics - Current metrics selection
55
+ * @param breakdowns - Current breakdowns selection
56
+ * @param currentChartType - Current chart type
57
+ * @param userManuallySelected - Whether user manually selected the current chart type
58
+ */
59
+ export declare function shouldAutoSwitchChartType(metrics: MetricItem[], breakdowns: BreakdownItem[], currentChartType: ChartType, userManuallySelected: boolean): ChartType | null;
60
+ /**
61
+ * Merge existing chart config with smart defaults
62
+ * Only fills in missing or invalid fields, preserves valid existing config
63
+ */
64
+ export declare function mergeChartConfigWithDefaults(existingConfig: ChartAxisConfig, smartDefaults: ChartAxisConfig, metrics: MetricItem[], breakdowns: BreakdownItem[]): ChartAxisConfig;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { QueryAnalysis } from '../types';
3
+ interface QueryAnalysisPanelProps {
4
+ analysis: QueryAnalysis;
5
+ }
6
+ declare const QueryAnalysisPanel: React.FC<QueryAnalysisPanelProps>;
7
+ export default QueryAnalysisPanel;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Shared module exports
3
+ * Common types, utilities, and components used across QueryBuilder and AnalysisBuilder
4
+ */
5
+ export type { MetaField, MetaCube, MetaResponse, QueryAnalysis, PrimaryCubeSelectionReason, PrimaryCubeCandidate, PrimaryCubeAnalysis, JoinPathStep, JoinPathAnalysis, PreAggregationAnalysis, QuerySummary, ValidationResult, FilterOperatorMeta, DateRangeType, DateRangeOption, TimeGranularity } from './types';
6
+ export { FILTER_OPERATORS, DATE_RANGE_OPTIONS, TIME_GRANULARITIES } from './types';
7
+ export { isSimpleFilter, isGroupFilter, isAndFilter, isOrFilter, flattenFilters, countFilters, createSimpleFilter, createAndFilter, createOrFilter, transformFiltersForServer, transformFiltersFromServer, hasQueryContent, cleanQuery, cleanQueryForServer, transformQueryForUI, getCubeNameFromField, getFieldType, getFieldTitle, getAvailableOperators, getAllFilterableFields, convertDateRangeTypeToValue, requiresNumberInput, formatDateForCube } from './utils';
8
+ export { default as QueryAnalysisPanel } from './components/QueryAnalysisPanel';
9
+ export { getChartAvailability, getAllChartAvailability, selectBestChartType, getSmartChartDefaults, shouldAutoSwitchChartType, mergeChartConfigWithDefaults } from './chartDefaults';
10
+ export type { SmartChartDefaults, ChartAvailability, ChartAvailabilityMap } from './chartDefaults';
@@ -0,0 +1,134 @@
1
+ import { CubeQuery, FilterOperator } from '../types';
2
+ export interface MetaField {
3
+ name: string;
4
+ title: string;
5
+ shortTitle: string;
6
+ type: string;
7
+ description?: string;
8
+ }
9
+ export interface MetaCube {
10
+ name: string;
11
+ title: string;
12
+ description: string;
13
+ measures: MetaField[];
14
+ dimensions: MetaField[];
15
+ segments: MetaField[];
16
+ }
17
+ export interface MetaResponse {
18
+ cubes: MetaCube[];
19
+ }
20
+ export type PrimaryCubeSelectionReason = 'most_dimensions' | 'most_connected' | 'alphabetical_fallback' | 'single_cube';
21
+ export interface PrimaryCubeCandidate {
22
+ cubeName: string;
23
+ dimensionCount: number;
24
+ joinCount: number;
25
+ canReachAll: boolean;
26
+ }
27
+ export interface PrimaryCubeAnalysis {
28
+ selectedCube: string;
29
+ reason: PrimaryCubeSelectionReason;
30
+ explanation: string;
31
+ candidates?: PrimaryCubeCandidate[];
32
+ }
33
+ export interface JoinPathStep {
34
+ fromCube: string;
35
+ toCube: string;
36
+ relationship: 'belongsTo' | 'hasOne' | 'hasMany' | 'belongsToMany';
37
+ joinType: 'inner' | 'left' | 'right' | 'full';
38
+ joinColumns: Array<{
39
+ sourceColumn: string;
40
+ targetColumn: string;
41
+ }>;
42
+ junctionTable?: {
43
+ tableName: string;
44
+ sourceColumns: string[];
45
+ targetColumns: string[];
46
+ };
47
+ }
48
+ export interface JoinPathAnalysis {
49
+ targetCube: string;
50
+ pathFound: boolean;
51
+ path?: JoinPathStep[];
52
+ pathLength?: number;
53
+ error?: string;
54
+ visitedCubes?: string[];
55
+ }
56
+ export interface PreAggregationAnalysis {
57
+ cubeName: string;
58
+ cteAlias: string;
59
+ reason: string;
60
+ measures: string[];
61
+ joinKeys: Array<{
62
+ sourceColumn: string;
63
+ targetColumn: string;
64
+ }>;
65
+ }
66
+ export interface QuerySummary {
67
+ queryType: 'single_cube' | 'multi_cube_join' | 'multi_cube_cte';
68
+ joinCount: number;
69
+ cteCount: number;
70
+ hasPreAggregation: boolean;
71
+ }
72
+ export interface QueryAnalysis {
73
+ timestamp: string;
74
+ cubeCount: number;
75
+ cubesInvolved: string[];
76
+ primaryCube: PrimaryCubeAnalysis;
77
+ joinPaths: JoinPathAnalysis[];
78
+ preAggregations: PreAggregationAnalysis[];
79
+ querySummary: QuerySummary;
80
+ warnings?: string[];
81
+ }
82
+ export interface ValidationResult {
83
+ valid?: boolean;
84
+ error?: string;
85
+ query?: CubeQuery;
86
+ sql?: {
87
+ sql: string[];
88
+ params: any[];
89
+ };
90
+ queryType?: string;
91
+ normalizedQueries?: any[];
92
+ queryOrder?: string[];
93
+ transformedQueries?: any[];
94
+ pivotQuery?: any;
95
+ complexity?: string;
96
+ cubesUsed?: string[];
97
+ joinType?: string;
98
+ analysis?: QueryAnalysis;
99
+ }
100
+ export interface FilterOperatorMeta {
101
+ label: string;
102
+ description: string;
103
+ requiresValues: boolean;
104
+ supportsMultipleValues: boolean;
105
+ valueType: 'string' | 'number' | 'date' | 'boolean' | 'any';
106
+ fieldTypes: string[];
107
+ }
108
+ export declare const FILTER_OPERATORS: Record<FilterOperator, FilterOperatorMeta>;
109
+ export type DateRangeType = 'custom' | 'today' | 'yesterday' | 'this_week' | 'this_month' | 'this_quarter' | 'this_year' | 'last_7_days' | 'last_30_days' | 'last_week' | 'last_month' | 'last_quarter' | 'last_year' | 'last_12_months' | 'last_n_days' | 'last_n_weeks' | 'last_n_months' | 'last_n_quarters' | 'last_n_years';
110
+ export interface DateRangeOption {
111
+ value: DateRangeType;
112
+ label: string;
113
+ }
114
+ export declare const DATE_RANGE_OPTIONS: DateRangeOption[];
115
+ export declare const TIME_GRANULARITIES: readonly [{
116
+ readonly value: "hour";
117
+ readonly label: "Hour";
118
+ }, {
119
+ readonly value: "day";
120
+ readonly label: "Day";
121
+ }, {
122
+ readonly value: "week";
123
+ readonly label: "Week";
124
+ }, {
125
+ readonly value: "month";
126
+ readonly label: "Month";
127
+ }, {
128
+ readonly value: "quarter";
129
+ readonly label: "Quarter";
130
+ }, {
131
+ readonly value: "year";
132
+ readonly label: "Year";
133
+ }];
134
+ export type TimeGranularity = typeof TIME_GRANULARITIES[number]['value'];
@@ -0,0 +1,101 @@
1
+ import { CubeQuery, Filter, SimpleFilter, GroupFilter } from '../types';
2
+ import { MetaField, MetaResponse } from './types';
3
+ /**
4
+ * Check if a filter is a simple filter
5
+ */
6
+ export declare function isSimpleFilter(filter: Filter): filter is SimpleFilter;
7
+ /**
8
+ * Check if a filter is a group filter
9
+ */
10
+ export declare function isGroupFilter(filter: Filter): filter is GroupFilter;
11
+ /**
12
+ * Check if a filter is an AND filter
13
+ */
14
+ export declare function isAndFilter(filter: Filter): filter is GroupFilter;
15
+ /**
16
+ * Check if a filter is an OR filter
17
+ */
18
+ export declare function isOrFilter(filter: Filter): filter is GroupFilter;
19
+ /**
20
+ * Flatten all simple filters from a hierarchical filter structure
21
+ */
22
+ export declare function flattenFilters(filters: Filter[]): SimpleFilter[];
23
+ /**
24
+ * Count total filters in hierarchical structure
25
+ */
26
+ export declare function countFilters(filters: Filter[]): number;
27
+ /**
28
+ * Create a new simple filter
29
+ */
30
+ export declare function createSimpleFilter(member: string, operator?: string, values?: any[]): SimpleFilter;
31
+ /**
32
+ * Create a new AND filter group
33
+ */
34
+ export declare function createAndFilter(filters?: Filter[]): GroupFilter;
35
+ /**
36
+ * Create a new OR filter group
37
+ */
38
+ export declare function createOrFilter(filters?: Filter[]): GroupFilter;
39
+ /**
40
+ * Transform filters from new GroupFilter format to legacy server format
41
+ * Server expects { and: [...] } and { or: [...] } instead of { type: 'and', filters: [...] }
42
+ */
43
+ export declare function transformFiltersForServer(filters: Filter[]): any[];
44
+ /**
45
+ * Transform filters from server/API format to UI format
46
+ * Converts {and: [...]} and {or: [...]} to {type: 'and', filters: [...]} format
47
+ */
48
+ export declare function transformFiltersFromServer(filters: any[]): Filter[];
49
+ /**
50
+ * Check if query has any content (measures, dimensions, or timeDimensions)
51
+ */
52
+ export declare function hasQueryContent(query: CubeQuery): boolean;
53
+ /**
54
+ * Clean query object by removing empty arrays
55
+ */
56
+ export declare function cleanQuery(query: CubeQuery): CubeQuery;
57
+ /**
58
+ * Clean a query and transform filters for server compatibility
59
+ * This version transforms GroupFilter to legacy and/or format
60
+ */
61
+ export declare function cleanQueryForServer(query: CubeQuery): CubeQuery;
62
+ /**
63
+ * Transform a Cube.js query from external format to UI internal format
64
+ * This handles format differences between server/API queries and QueryBuilder state
65
+ */
66
+ export declare function transformQueryForUI(query: any): CubeQuery;
67
+ /**
68
+ * Get cube name from field name (e.g., "Employees.count" -> "Employees")
69
+ */
70
+ export declare function getCubeNameFromField(fieldName: string): string;
71
+ /**
72
+ * Get field type from schema
73
+ */
74
+ export declare function getFieldType(fieldName: string, schema: MetaResponse): string;
75
+ /**
76
+ * Get field title from schema metadata, falling back to field name
77
+ */
78
+ export declare function getFieldTitle(fieldName: string, schema: MetaResponse | null): string;
79
+ /**
80
+ * Get available operators for a field type
81
+ */
82
+ export declare function getAvailableOperators(fieldType: string): Array<{
83
+ operator: string;
84
+ label: string;
85
+ }>;
86
+ /**
87
+ * Get ALL filterable fields from schema
88
+ */
89
+ export declare function getAllFilterableFields(schema: MetaResponse): MetaField[];
90
+ /**
91
+ * Convert DateRangeType to Cube.js compatible date range format
92
+ */
93
+ export declare function convertDateRangeTypeToValue(rangeType: string, number?: number): string;
94
+ /**
95
+ * Check if a date range type requires a number input
96
+ */
97
+ export declare function requiresNumberInput(rangeType: string): boolean;
98
+ /**
99
+ * Format date for Cube.js (YYYY-MM-DD)
100
+ */
101
+ export declare function formatDateForCube(date: Date): string;