drizzle-cube 0.1.3 → 0.1.5
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.
- package/README.md +24 -2
- package/dist/adapters/hono/index.d.ts +5 -1
- package/dist/adapters/hono/index.js +259 -96
- package/dist/client/client/CubeClient.d.ts +15 -0
- package/dist/client/components/AnalyticsDashboard.d.ts +2 -0
- package/dist/client/components/AnalyticsPage.d.ts +1 -0
- package/dist/client/components/AnalyticsPortlet.d.ts +6 -0
- package/dist/client/components/ChartConfigEditor.d.ts +8 -0
- package/dist/client/components/ChartErrorBoundary.d.ts +21 -0
- package/dist/client/components/DashboardEditModal.d.ts +14 -0
- package/dist/client/components/DashboardGrid.d.ts +11 -0
- package/dist/client/components/Modal.d.ts +16 -0
- package/dist/client/components/PortletContainer.d.ts +10 -0
- package/dist/client/components/PortletEditModal.d.ts +12 -0
- package/dist/client/components/QueryBuilder/CubeMetaExplorer.d.ts +4 -0
- package/dist/client/components/QueryBuilder/QueryPanel.d.ts +4 -0
- package/dist/client/components/QueryBuilder/ResultsPanel.d.ts +4 -0
- package/dist/client/components/QueryBuilder/SetupPanel.d.ts +11 -0
- package/dist/client/components/QueryBuilder/index.d.ts +3 -0
- package/dist/client/components/QueryBuilder/types.d.ts +132 -0
- package/dist/client/components/QueryBuilder/utils.d.ts +42 -0
- package/dist/client/components/charts/AreaChart.d.ts +2 -0
- package/dist/client/components/charts/BarChart.d.ts +2 -0
- package/dist/client/components/charts/ChartContainer.d.ts +7 -0
- package/dist/client/components/charts/ChartLegend.d.ts +7 -0
- package/dist/client/components/charts/ChartTooltip.d.ts +7 -0
- package/dist/client/components/charts/DataTable.d.ts +2 -0
- package/dist/client/components/charts/LineChart.d.ts +2 -0
- package/dist/client/components/charts/PieChart.d.ts +2 -0
- package/dist/client/components/charts/RadarChart.d.ts +2 -0
- package/dist/client/components/charts/RadialBarChart.d.ts +2 -0
- package/dist/client/components/charts/ScatterChart.d.ts +2 -0
- package/dist/client/components/charts/TreeMapChart.d.ts +2 -0
- package/dist/client/components/charts/index.d.ts +13 -0
- package/dist/client/hooks/useCubeQuery.d.ts +8 -0
- package/dist/client/index.d.ts +15 -0
- package/dist/client/index.js +25439 -4
- package/dist/client/providers/CubeProvider.d.ts +15 -0
- package/dist/client/styles.css +1 -0
- package/dist/client/types.d.ts +111 -0
- package/dist/client/utils/chartConstants.d.ts +15 -0
- package/dist/client/utils/chartUtils.d.ts +9 -0
- package/dist/client/utils/index.d.ts +87 -0
- package/dist/server/index.d.ts +84 -1155
- package/dist/server/index.js +1046 -2826
- package/package.json +14 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ApiConfig } from './types';
|
|
3
|
+
interface SetupPanelProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onToggle: () => void;
|
|
6
|
+
config: ApiConfig;
|
|
7
|
+
onConfigChange: (config: ApiConfig) => void;
|
|
8
|
+
onReset: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const SetupPanel: React.FC<SetupPanelProps>;
|
|
11
|
+
export default SetupPanel;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { CubeQuery } 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 ValidationStatus = 'idle' | 'validating' | 'valid' | 'invalid';
|
|
21
|
+
export type ExecutionStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
22
|
+
export type SchemaStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
23
|
+
export interface QueryBuilderState {
|
|
24
|
+
query: CubeQuery;
|
|
25
|
+
schema: MetaResponse | null;
|
|
26
|
+
schemaStatus: SchemaStatus;
|
|
27
|
+
schemaError: string | null;
|
|
28
|
+
validationStatus: ValidationStatus;
|
|
29
|
+
validationError: string | null;
|
|
30
|
+
validationSql: {
|
|
31
|
+
sql: string[];
|
|
32
|
+
params: any[];
|
|
33
|
+
} | null;
|
|
34
|
+
executionStatus: ExecutionStatus;
|
|
35
|
+
executionResults: any[] | null;
|
|
36
|
+
executionError: string | null;
|
|
37
|
+
totalRowCount: number | null;
|
|
38
|
+
totalRowCountStatus: 'idle' | 'loading' | 'success' | 'error';
|
|
39
|
+
}
|
|
40
|
+
export interface ValidationResult {
|
|
41
|
+
valid?: boolean;
|
|
42
|
+
error?: string;
|
|
43
|
+
query?: CubeQuery;
|
|
44
|
+
sql?: {
|
|
45
|
+
sql: string[];
|
|
46
|
+
params: any[];
|
|
47
|
+
};
|
|
48
|
+
queryType?: string;
|
|
49
|
+
normalizedQueries?: any[];
|
|
50
|
+
queryOrder?: string[];
|
|
51
|
+
transformedQueries?: any[];
|
|
52
|
+
pivotQuery?: any;
|
|
53
|
+
complexity?: string;
|
|
54
|
+
cubesUsed?: string[];
|
|
55
|
+
joinType?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface ApiConfig {
|
|
58
|
+
baseApiUrl: string;
|
|
59
|
+
apiToken: string;
|
|
60
|
+
}
|
|
61
|
+
export interface QueryBuilderProps {
|
|
62
|
+
baseUrl: string;
|
|
63
|
+
className?: string;
|
|
64
|
+
initialQuery?: CubeQuery;
|
|
65
|
+
disableLocalStorage?: boolean;
|
|
66
|
+
hideSettings?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface QueryBuilderRef {
|
|
69
|
+
getCurrentQuery: () => CubeQuery;
|
|
70
|
+
getValidationState: () => {
|
|
71
|
+
status: ValidationStatus;
|
|
72
|
+
result?: ValidationResult;
|
|
73
|
+
};
|
|
74
|
+
getValidationResult: () => ValidationResult | null;
|
|
75
|
+
}
|
|
76
|
+
export interface CubeMetaExplorerProps {
|
|
77
|
+
schema: MetaResponse | null;
|
|
78
|
+
schemaStatus: SchemaStatus;
|
|
79
|
+
schemaError: string | null;
|
|
80
|
+
selectedFields: {
|
|
81
|
+
measures: string[];
|
|
82
|
+
dimensions: string[];
|
|
83
|
+
timeDimensions: string[];
|
|
84
|
+
};
|
|
85
|
+
onFieldSelect: (fieldName: string, fieldType: 'measures' | 'dimensions' | 'timeDimensions') => void;
|
|
86
|
+
onFieldDeselect: (fieldName: string, fieldType: 'measures' | 'dimensions' | 'timeDimensions') => void;
|
|
87
|
+
onRetrySchema?: () => void;
|
|
88
|
+
onOpenSettings?: () => void;
|
|
89
|
+
}
|
|
90
|
+
export interface QueryPanelProps {
|
|
91
|
+
query: CubeQuery;
|
|
92
|
+
validationStatus: ValidationStatus;
|
|
93
|
+
validationError: string | null;
|
|
94
|
+
validationSql: {
|
|
95
|
+
sql: string[];
|
|
96
|
+
params: any[];
|
|
97
|
+
} | null;
|
|
98
|
+
onValidate: () => void;
|
|
99
|
+
onExecute: () => void;
|
|
100
|
+
onRemoveField: (fieldName: string, fieldType: 'measures' | 'dimensions' | 'timeDimensions') => void;
|
|
101
|
+
onTimeDimensionGranularityChange: (dimensionName: string, granularity: string) => void;
|
|
102
|
+
onClearQuery?: () => void;
|
|
103
|
+
showSettings?: boolean;
|
|
104
|
+
onSettingsClick?: () => void;
|
|
105
|
+
}
|
|
106
|
+
export interface ResultsPanelProps {
|
|
107
|
+
executionStatus: ExecutionStatus;
|
|
108
|
+
executionResults: any[] | null;
|
|
109
|
+
executionError: string | null;
|
|
110
|
+
query: CubeQuery;
|
|
111
|
+
displayLimit?: number;
|
|
112
|
+
onDisplayLimitChange?: (limit: number) => void;
|
|
113
|
+
totalRowCount?: number | null;
|
|
114
|
+
totalRowCountStatus?: 'idle' | 'loading' | 'success' | 'error';
|
|
115
|
+
}
|
|
116
|
+
export declare const TIME_GRANULARITIES: readonly [{
|
|
117
|
+
readonly value: "day";
|
|
118
|
+
readonly label: "Day";
|
|
119
|
+
}, {
|
|
120
|
+
readonly value: "week";
|
|
121
|
+
readonly label: "Week";
|
|
122
|
+
}, {
|
|
123
|
+
readonly value: "month";
|
|
124
|
+
readonly label: "Month";
|
|
125
|
+
}, {
|
|
126
|
+
readonly value: "quarter";
|
|
127
|
+
readonly label: "Quarter";
|
|
128
|
+
}, {
|
|
129
|
+
readonly value: "year";
|
|
130
|
+
readonly label: "Year";
|
|
131
|
+
}];
|
|
132
|
+
export type TimeGranularity = typeof TIME_GRANULARITIES[number]['value'];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CubeQuery } from '../../types';
|
|
2
|
+
import { MetaField, MetaResponse } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Check if a field is selected in the current query
|
|
5
|
+
*/
|
|
6
|
+
export declare function isFieldSelected(fieldName: string, fieldType: 'measures' | 'dimensions' | 'timeDimensions', query: CubeQuery): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Get all time dimension fields from schema
|
|
9
|
+
*/
|
|
10
|
+
export declare function getTimeDimensionFields(schema: MetaResponse): MetaField[];
|
|
11
|
+
/**
|
|
12
|
+
* Get all non-time dimension fields from schema
|
|
13
|
+
*/
|
|
14
|
+
export declare function getRegularDimensionFields(schema: MetaResponse): MetaField[];
|
|
15
|
+
/**
|
|
16
|
+
* Get all measure fields from schema
|
|
17
|
+
*/
|
|
18
|
+
export declare function getMeasureFields(schema: MetaResponse): MetaField[];
|
|
19
|
+
/**
|
|
20
|
+
* Check if query has any content (measures, dimensions, or timeDimensions)
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasQueryContent(query: CubeQuery): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Get count of selected fields across all types
|
|
25
|
+
*/
|
|
26
|
+
export declare function getSelectedFieldsCount(query: CubeQuery): number;
|
|
27
|
+
/**
|
|
28
|
+
* Get cube name from field name (e.g., "Employees.count" -> "Employees")
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCubeNameFromField(fieldName: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Group fields by cube name
|
|
33
|
+
*/
|
|
34
|
+
export declare function groupFieldsByCube(fields: MetaField[]): Record<string, MetaField[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Clean query object by removing empty arrays
|
|
37
|
+
*/
|
|
38
|
+
export declare function cleanQuery(query: CubeQuery): CubeQuery;
|
|
39
|
+
/**
|
|
40
|
+
* Create an empty query object
|
|
41
|
+
*/
|
|
42
|
+
export declare function createEmptyQuery(): CubeQuery;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
interface ChartContainerProps {
|
|
3
|
+
children: ReactElement;
|
|
4
|
+
height?: string | number;
|
|
5
|
+
}
|
|
6
|
+
export default function ChartContainer({ children, height }: ChartContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface ChartLegendProps {
|
|
2
|
+
onMouseEnter?: (o: any, i: any) => void;
|
|
3
|
+
onMouseLeave?: () => void;
|
|
4
|
+
showLegend?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default function ChartLegend({ onMouseEnter, onMouseLeave, showLegend }: ChartLegendProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface ChartTooltipProps {
|
|
3
|
+
formatter?: (value: any, name: any, props: any) => [React.ReactText, React.ReactText];
|
|
4
|
+
labelFormatter?: (label: any) => React.ReactText;
|
|
5
|
+
}
|
|
6
|
+
export default function ChartTooltip({ formatter, labelFormatter }: ChartTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart components for drizzle-cube client
|
|
3
|
+
* Minimal Recharts-based components with Tailwind styling
|
|
4
|
+
*/
|
|
5
|
+
export { default as RechartsBarChart } from './BarChart';
|
|
6
|
+
export { default as RechartsLineChart } from './LineChart';
|
|
7
|
+
export { default as RechartsAreaChart } from './AreaChart';
|
|
8
|
+
export { default as RechartsPieChart } from './PieChart';
|
|
9
|
+
export { default as RechartsScatterChart } from './ScatterChart';
|
|
10
|
+
export { default as RechartsRadarChart } from './RadarChart';
|
|
11
|
+
export { default as RechartsRadialBarChart } from './RadialBarChart';
|
|
12
|
+
export { default as RechartsTreeMapChart } from './TreeMapChart';
|
|
13
|
+
export { default as DataTable } from './DataTable';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CubeQuery, CubeQueryOptions, CubeResultSet } from '../types';
|
|
2
|
+
interface UseCubeQueryResult {
|
|
3
|
+
resultSet: CubeResultSet | null;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: Error | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function useCubeQuery(query: CubeQuery | null, options?: CubeQueryOptions): UseCubeQueryResult;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { default as AnalyticsPortlet } from './components/AnalyticsPortlet';
|
|
2
|
+
export { default as AnalyticsDashboard } from './components/AnalyticsDashboard';
|
|
3
|
+
export { RechartsBarChart, RechartsLineChart, RechartsAreaChart, RechartsPieChart, RechartsScatterChart, RechartsRadarChart, RechartsRadialBarChart, RechartsTreeMapChart, DataTable } from './components/charts';
|
|
4
|
+
export { default as DashboardGrid } from './components/DashboardGrid';
|
|
5
|
+
export { default as PortletContainer } from './components/PortletContainer';
|
|
6
|
+
export { default as PortletEditModal } from './components/PortletEditModal';
|
|
7
|
+
export { default as DashboardEditModal } from './components/DashboardEditModal';
|
|
8
|
+
export { default as Modal } from './components/Modal';
|
|
9
|
+
export { default as ChartConfigEditor } from './components/ChartConfigEditor';
|
|
10
|
+
export { default as QueryBuilder } from './components/QueryBuilder';
|
|
11
|
+
export { CubeProvider } from './providers/CubeProvider';
|
|
12
|
+
export { useCubeQuery } from './hooks/useCubeQuery';
|
|
13
|
+
export { createCubeClient } from './client/CubeClient';
|
|
14
|
+
export type { PortletConfig, ChartType, ChartAxisConfig, ChartDisplayConfig, CubeQuery, CubeQueryOptions, DashboardConfig } from './types';
|
|
15
|
+
export { createDashboardLayout, formatChartData } from './utils';
|