drizzle-cube 0.1.12 → 0.1.14

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.
@@ -0,0 +1,119 @@
1
+ import { SemanticLayerCompiler, SemanticQuery, SecurityContext } from '../server';
2
+ /**
3
+ * Calculate query complexity based on query structure
4
+ */
5
+ export declare function calculateQueryComplexity(query: SemanticQuery): string;
6
+ /**
7
+ * Generate a unique request ID
8
+ */
9
+ export declare function generateRequestId(): string;
10
+ /**
11
+ * Build transformed query metadata for Cube.js compatibility
12
+ */
13
+ export declare function buildTransformedQuery(query: SemanticQuery): any;
14
+ /**
15
+ * Get database type from semantic layer
16
+ */
17
+ export declare function getDatabaseType(semanticLayer: SemanticLayerCompiler<any>): string;
18
+ /**
19
+ * Helper function to handle dry-run logic for all adapters
20
+ */
21
+ export declare function handleDryRun(query: SemanticQuery, securityContext: SecurityContext, semanticLayer: SemanticLayerCompiler<any>): Promise<{
22
+ queryType: string;
23
+ normalizedQueries: {
24
+ cube: string;
25
+ query: {
26
+ measures: string[];
27
+ dimensions: string[];
28
+ filters: import('../server').Filter[];
29
+ timeDimensions: import('../server').TimeDimension[];
30
+ order: Record<string, "asc" | "desc">;
31
+ limit: number | undefined;
32
+ offset: number | undefined;
33
+ };
34
+ }[];
35
+ queryOrder: string[];
36
+ transformedQueries: {
37
+ cube: string;
38
+ query: {
39
+ measures: string[];
40
+ dimensions: string[];
41
+ filters: import('../server').Filter[];
42
+ timeDimensions: import('../server').TimeDimension[];
43
+ order: Record<string, "asc" | "desc">;
44
+ limit: number | undefined;
45
+ offset: number | undefined;
46
+ };
47
+ }[];
48
+ pivotQuery: {
49
+ query: SemanticQuery;
50
+ cubes: string[];
51
+ };
52
+ sql: {
53
+ sql: string[];
54
+ params: any[];
55
+ };
56
+ complexity: string;
57
+ valid: boolean;
58
+ cubesUsed: string[];
59
+ joinType: string;
60
+ query: SemanticQuery;
61
+ }>;
62
+ /**
63
+ * Format standard Cube.js API response
64
+ */
65
+ export declare function formatCubeResponse(query: SemanticQuery, result: {
66
+ data: any[];
67
+ annotation?: any;
68
+ }, semanticLayer: SemanticLayerCompiler<any>): {
69
+ queryType: string;
70
+ results: {
71
+ query: SemanticQuery;
72
+ lastRefreshTime: string;
73
+ usedPreAggregations: {};
74
+ transformedQuery: any;
75
+ requestId: string;
76
+ annotation: any;
77
+ dataSource: string;
78
+ dbType: string;
79
+ extDbType: string;
80
+ external: boolean;
81
+ slowQuery: boolean;
82
+ data: any[];
83
+ }[];
84
+ pivotQuery: {
85
+ queryType: string;
86
+ measures?: string[];
87
+ dimensions?: string[];
88
+ filters?: Array<import('../server').Filter>;
89
+ timeDimensions?: Array<import('../server').TimeDimension>;
90
+ limit?: number;
91
+ offset?: number;
92
+ order?: Record<string, "asc" | "desc">;
93
+ };
94
+ slowQuery: boolean;
95
+ };
96
+ /**
97
+ * Format SQL generation response
98
+ */
99
+ export declare function formatSqlResponse(query: SemanticQuery, sqlResult: {
100
+ sql: string;
101
+ params?: any[];
102
+ }): {
103
+ sql: string;
104
+ params: any[];
105
+ query: SemanticQuery;
106
+ };
107
+ /**
108
+ * Format metadata response
109
+ */
110
+ export declare function formatMetaResponse(metadata: any): {
111
+ cubes: any;
112
+ };
113
+ /**
114
+ * Standard error response format
115
+ */
116
+ export declare function formatErrorResponse(error: string | Error, status?: number): {
117
+ error: string;
118
+ status: number;
119
+ };
@@ -1,2 +1,2 @@
1
1
  import { AnalyticsDashboardProps } from '../types';
2
- export default function AnalyticsDashboard({ config, apiUrl, apiOptions, editable, onConfigChange, onSave, onDirtyStateChange }: AnalyticsDashboardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function AnalyticsDashboard({ config, editable, onConfigChange, onSave, onDirtyStateChange }: AnalyticsDashboardProps): import("react/jsx-runtime").JSX.Element;
@@ -15,6 +15,7 @@ interface AxisDropZoneProps {
15
15
  onDragStart: (e: React.DragEvent<HTMLDivElement>, field: string, fromKey: string) => void;
16
16
  onDragOver: (e: React.DragEvent<HTMLDivElement>) => void;
17
17
  getFieldStyling: (field: string) => FieldStyling;
18
+ onReorder?: (fromIndex: number, toIndex: number, axisKey: string) => void;
18
19
  }
19
- export default function AxisDropZone({ config, fields, onDrop, onRemove, onDragStart, onDragOver, getFieldStyling }: AxisDropZoneProps): import("react/jsx-runtime").JSX.Element;
20
+ export default function AxisDropZone({ config, fields, onDrop, onRemove, onDragStart, onDragOver, getFieldStyling, onReorder }: AxisDropZoneProps): import("react/jsx-runtime").JSX.Element;
20
21
  export {};
@@ -5,7 +5,6 @@ interface DashboardGridProps {
5
5
  onConfigChange?: (config: DashboardConfig) => void;
6
6
  onPortletRefresh?: (portletId: string) => void;
7
7
  onSave?: (config: DashboardConfig) => Promise<void> | void;
8
- apiUrl?: string;
9
8
  }
10
- export default function DashboardGrid({ config, editable, onConfigChange, onPortletRefresh, onSave, apiUrl }: DashboardGridProps): import("react/jsx-runtime").JSX.Element;
9
+ export default function DashboardGrid({ config, editable, onConfigChange, onPortletRefresh, onSave }: DashboardGridProps): import("react/jsx-runtime").JSX.Element;
11
10
  export {};
@@ -6,7 +6,6 @@ interface PortletEditModalProps {
6
6
  portlet?: PortletConfig | null;
7
7
  title: string;
8
8
  submitText: string;
9
- apiUrl?: string;
10
9
  }
11
- export default function PortletEditModal({ isOpen, onClose, onSave, portlet, title, submitText, apiUrl }: PortletEditModalProps): import("react/jsx-runtime").JSX.Element;
10
+ export default function PortletEditModal({ isOpen, onClose, onSave, portlet, title, submitText }: PortletEditModalProps): import("react/jsx-runtime").JSX.Element;
12
11
  export {};
@@ -59,7 +59,6 @@ export interface ApiConfig {
59
59
  apiToken: string;
60
60
  }
61
61
  export interface QueryBuilderProps {
62
- baseUrl: string;
63
62
  className?: string;
64
63
  initialQuery?: CubeQuery;
65
64
  disableLocalStorage?: boolean;
@@ -7,8 +7,8 @@ export { default as PortletEditModal } from './components/PortletEditModal';
7
7
  export { default as DashboardEditModal } from './components/DashboardEditModal';
8
8
  export { default as Modal } from './components/Modal';
9
9
  export { default as QueryBuilder } from './components/QueryBuilder';
10
- export { CubeProvider } from './providers/CubeProvider';
10
+ export { CubeProvider, useCubeContext } from './providers/CubeProvider';
11
11
  export { useCubeQuery } from './hooks/useCubeQuery';
12
12
  export { createCubeClient } from './client/CubeClient';
13
- export type { PortletConfig, ChartType, ChartAxisConfig, ChartDisplayConfig, CubeQuery, CubeQueryOptions, DashboardConfig } from './types';
13
+ export type { PortletConfig, ChartType, ChartAxisConfig, ChartDisplayConfig, CubeQuery, CubeQueryOptions, CubeApiOptions, DashboardConfig } from './types';
14
14
  export { createDashboardLayout, formatChartData } from './utils';