drizzle-cube 0.1.21 → 0.1.24
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/dist/adapters/{compiler-CPsEzFP2.js → compiler-CSr2Ti96.js} +553 -505
- package/dist/adapters/express/index.js +1 -1
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/hono/index.js +1 -1
- package/dist/adapters/nextjs/index.js +50 -50
- package/dist/client/charts/chartConfigs.d.ts +31 -1
- package/dist/client/charts.d.ts +1 -0
- package/dist/client/charts.js +1 -1
- package/dist/client/chunks/charts-Dx3asDBi.js +2269 -0
- package/dist/client/chunks/charts-Dx3asDBi.js.map +1 -0
- package/dist/client/chunks/{icons-B5RVM-7b.js → icons-BMGOKdZb.js} +279 -239
- package/dist/client/chunks/icons-BMGOKdZb.js.map +1 -0
- package/dist/client/chunks/{providers-DI5zeeEU.js → providers-B7MVnAAt.js} +50 -50
- package/dist/client/chunks/providers-B7MVnAAt.js.map +1 -0
- package/dist/client/components/ChartConfigPanel.d.ts +3 -2
- package/dist/client/components/ColorPaletteSelector.d.ts +11 -0
- package/dist/client/components/DashboardGrid.d.ts +3 -1
- package/dist/client/components/DataHistogram.d.ts +23 -0
- package/dist/client/components/PortletEditModal.d.ts +3 -2
- package/dist/client/components/charts/ActivityGridChart.config.d.ts +5 -0
- package/dist/client/components/charts/ActivityGridChart.d.ts +2 -0
- package/dist/client/components/charts/AreaChart.d.ts +1 -1
- package/dist/client/components/charts/BarChart.d.ts +1 -1
- package/dist/client/components/charts/BubbleChart.d.ts +1 -1
- package/dist/client/components/charts/KpiNumber.config.d.ts +5 -0
- package/dist/client/components/charts/KpiNumber.d.ts +2 -0
- package/dist/client/components/charts/KpiText.config.d.ts +5 -0
- package/dist/client/components/charts/KpiText.d.ts +2 -0
- package/dist/client/components/charts/LineChart.d.ts +1 -1
- package/dist/client/components/charts/PieChart.d.ts +1 -1
- package/dist/client/components/charts/RadarChart.d.ts +1 -1
- package/dist/client/components/charts/RadialBarChart.d.ts +1 -1
- package/dist/client/components/charts/ScatterChart.d.ts +1 -1
- package/dist/client/components/charts/TreeMapChart.d.ts +1 -1
- package/dist/client/components/charts/index.d.ts +3 -0
- package/dist/client/components.js +5134 -2607
- package/dist/client/components.js.map +1 -1
- package/dist/client/hooks/useCubeMeta.d.ts +1 -0
- package/dist/client/hooks.js +62 -60
- package/dist/client/hooks.js.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/providers.js +1 -1
- package/dist/client/types.d.ts +17 -5
- package/dist/client/utils/colorPalettes.d.ts +35 -0
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.d.ts +3 -8
- package/dist/server/index.js +748 -700
- package/package.json +22 -1
- package/dist/client/chunks/charts-BadAUMmd.js +0 -2285
- package/dist/client/chunks/charts-BadAUMmd.js.map +0 -1
- package/dist/client/chunks/icons-B5RVM-7b.js.map +0 -1
- package/dist/client/chunks/providers-DI5zeeEU.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Q, { Router as E } from "express";
|
|
2
2
|
import R from "cors";
|
|
3
|
-
import { S as $, c as a, f as v, a as L, b as x, h } from "../compiler-
|
|
3
|
+
import { S as $, c as a, f as v, a as L, b as x, h } from "../compiler-CSr2Ti96.js";
|
|
4
4
|
function N(l) {
|
|
5
5
|
const {
|
|
6
6
|
cubes: c,
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { NextResponse as o } from "next/server";
|
|
2
|
-
import { c as l, f as
|
|
2
|
+
import { c as l, f as N, a as S, b as p, h as v, S as C } from "../compiler-CSr2Ti96.js";
|
|
3
3
|
function g(t) {
|
|
4
|
-
const { cubes: e, drizzle:
|
|
4
|
+
const { cubes: e, drizzle: a, schema: s, engineType: f } = t;
|
|
5
5
|
if (!e || e.length === 0)
|
|
6
6
|
throw new Error("At least one cube must be provided in the cubes array");
|
|
7
|
-
const r = new
|
|
8
|
-
drizzle:
|
|
7
|
+
const r = new C({
|
|
8
|
+
drizzle: a,
|
|
9
9
|
schema: s,
|
|
10
|
-
engineType:
|
|
10
|
+
engineType: f
|
|
11
11
|
});
|
|
12
12
|
return e.forEach((c) => {
|
|
13
13
|
r.registerCube(c);
|
|
14
14
|
}), r;
|
|
15
15
|
}
|
|
16
16
|
function j(t, e) {
|
|
17
|
-
const
|
|
18
|
-
return e.origin && (typeof e.origin == "string" ? s["Access-Control-Allow-Origin"] = e.origin : Array.isArray(e.origin) ?
|
|
17
|
+
const a = t.headers.get("origin"), s = {};
|
|
18
|
+
return e.origin && (typeof e.origin == "string" ? s["Access-Control-Allow-Origin"] = e.origin : Array.isArray(e.origin) ? a && e.origin.includes(a) && (s["Access-Control-Allow-Origin"] = a) : typeof e.origin == "function" && a && e.origin(a) && (s["Access-Control-Allow-Origin"] = a)), e.methods && (s["Access-Control-Allow-Methods"] = e.methods.join(", ")), e.allowedHeaders && (s["Access-Control-Allow-Headers"] = e.allowedHeaders.join(", ")), e.credentials && (s["Access-Control-Allow-Credentials"] = "true"), s;
|
|
19
19
|
}
|
|
20
20
|
function P(t) {
|
|
21
|
-
return async function(
|
|
22
|
-
const s = j(
|
|
21
|
+
return async function(a) {
|
|
22
|
+
const s = j(a, t);
|
|
23
23
|
return new Response(null, {
|
|
24
24
|
status: 200,
|
|
25
25
|
headers: s
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const { extractSecurityContext: e, cors:
|
|
29
|
+
function H(t) {
|
|
30
|
+
const { extractSecurityContext: e, cors: a } = t, s = g(t);
|
|
31
31
|
return async function(r, c) {
|
|
32
32
|
try {
|
|
33
|
-
let
|
|
33
|
+
let n;
|
|
34
34
|
if (r.method === "POST") {
|
|
35
35
|
const d = await r.json();
|
|
36
|
-
|
|
36
|
+
n = d.query || d;
|
|
37
37
|
} else if (r.method === "GET") {
|
|
38
38
|
const d = r.nextUrl.searchParams.get("query");
|
|
39
39
|
if (!d)
|
|
@@ -42,7 +42,7 @@ function b(t) {
|
|
|
42
42
|
{ status: 400 }
|
|
43
43
|
);
|
|
44
44
|
try {
|
|
45
|
-
|
|
45
|
+
n = JSON.parse(d);
|
|
46
46
|
} catch {
|
|
47
47
|
return o.json(
|
|
48
48
|
l("Invalid JSON in query parameter", 400),
|
|
@@ -54,20 +54,20 @@ function b(t) {
|
|
|
54
54
|
l("Method not allowed", 405),
|
|
55
55
|
{ status: 405 }
|
|
56
56
|
);
|
|
57
|
-
const
|
|
57
|
+
const y = await e(r, c), i = s.validateQuery(n);
|
|
58
58
|
if (!i.isValid)
|
|
59
59
|
return o.json(
|
|
60
60
|
l(`Query validation failed: ${i.errors.join(", ")}`, 400),
|
|
61
61
|
{ status: 400 }
|
|
62
62
|
);
|
|
63
|
-
const u = await s.executeMultiCubeQuery(
|
|
63
|
+
const u = await s.executeMultiCubeQuery(n, y), m = N(n, u, s);
|
|
64
64
|
return o.json(m, {
|
|
65
|
-
headers:
|
|
65
|
+
headers: a ? j(r, a) : {}
|
|
66
66
|
});
|
|
67
|
-
} catch (
|
|
68
|
-
return console.error("Next.js load handler error:",
|
|
67
|
+
} catch (n) {
|
|
68
|
+
return process.env.NODE_ENV !== "test" && console.error("Next.js load handler error:", n), o.json(
|
|
69
69
|
l(
|
|
70
|
-
|
|
70
|
+
n instanceof Error ? n.message : "Query execution failed",
|
|
71
71
|
500
|
|
72
72
|
),
|
|
73
73
|
{ status: 500 }
|
|
@@ -75,16 +75,16 @@ function b(t) {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
const { cors: e } = t,
|
|
80
|
-
return async function(
|
|
78
|
+
function A(t) {
|
|
79
|
+
const { cors: e } = t, a = g(t);
|
|
80
|
+
return async function(f, r) {
|
|
81
81
|
try {
|
|
82
|
-
const c =
|
|
83
|
-
return o.json(
|
|
84
|
-
headers: e ? j(
|
|
82
|
+
const c = a.getMetadata(), n = S(c);
|
|
83
|
+
return o.json(n, {
|
|
84
|
+
headers: e ? j(f, e) : {}
|
|
85
85
|
});
|
|
86
86
|
} catch (c) {
|
|
87
|
-
return console.error("Next.js meta handler error:", c), o.json(
|
|
87
|
+
return process.env.NODE_ENV !== "test" && console.error("Next.js meta handler error:", c), o.json(
|
|
88
88
|
l(
|
|
89
89
|
c instanceof Error ? c.message : "Failed to fetch metadata",
|
|
90
90
|
500
|
|
@@ -94,10 +94,10 @@ function E(t) {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
const { extractSecurityContext: e, cors:
|
|
97
|
+
function b(t) {
|
|
98
|
+
const { extractSecurityContext: e, cors: a } = t, s = g(t);
|
|
99
99
|
return async function(r, c) {
|
|
100
|
-
var
|
|
100
|
+
var n, y;
|
|
101
101
|
try {
|
|
102
102
|
let i;
|
|
103
103
|
if (r.method === "POST") {
|
|
@@ -129,18 +129,18 @@ function N(t) {
|
|
|
129
129
|
l(`Query validation failed: ${m.errors.join(", ")}`, 400),
|
|
130
130
|
{ status: 400 }
|
|
131
131
|
);
|
|
132
|
-
const d = ((
|
|
132
|
+
const d = ((n = i.measures) == null ? void 0 : n[0]) || ((y = i.dimensions) == null ? void 0 : y[0]);
|
|
133
133
|
if (!d)
|
|
134
134
|
return o.json(
|
|
135
135
|
l("No measures or dimensions specified", 400),
|
|
136
136
|
{ status: 400 }
|
|
137
137
|
);
|
|
138
|
-
const w = d.split(".")[0], x = await s.generateSQL(w, i, u),
|
|
139
|
-
return o.json(
|
|
140
|
-
headers:
|
|
138
|
+
const w = d.split(".")[0], x = await s.generateSQL(w, i, u), E = p(i, x);
|
|
139
|
+
return o.json(E, {
|
|
140
|
+
headers: a ? j(r, a) : {}
|
|
141
141
|
});
|
|
142
142
|
} catch (i) {
|
|
143
|
-
return console.error("Next.js SQL handler error:", i), o.json(
|
|
143
|
+
return process.env.NODE_ENV !== "test" && console.error("Next.js SQL handler error:", i), o.json(
|
|
144
144
|
l(
|
|
145
145
|
i instanceof Error ? i.message : "SQL generation failed",
|
|
146
146
|
500
|
|
@@ -151,13 +151,13 @@ function N(t) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
function Q(t) {
|
|
154
|
-
const { extractSecurityContext: e, cors:
|
|
154
|
+
const { extractSecurityContext: e, cors: a } = t, s = g(t);
|
|
155
155
|
return async function(r, c) {
|
|
156
156
|
try {
|
|
157
|
-
let
|
|
157
|
+
let n;
|
|
158
158
|
if (r.method === "POST") {
|
|
159
159
|
const u = await r.json();
|
|
160
|
-
|
|
160
|
+
n = u.query || u;
|
|
161
161
|
} else if (r.method === "GET") {
|
|
162
162
|
const u = r.nextUrl.searchParams.get("query");
|
|
163
163
|
if (!u)
|
|
@@ -166,7 +166,7 @@ function Q(t) {
|
|
|
166
166
|
{ status: 400 }
|
|
167
167
|
);
|
|
168
168
|
try {
|
|
169
|
-
|
|
169
|
+
n = JSON.parse(u);
|
|
170
170
|
} catch {
|
|
171
171
|
return o.json(
|
|
172
172
|
{ error: "Invalid JSON in query parameter", valid: !1 },
|
|
@@ -178,14 +178,14 @@ function Q(t) {
|
|
|
178
178
|
{ error: "Method not allowed", valid: !1 },
|
|
179
179
|
{ status: 405 }
|
|
180
180
|
);
|
|
181
|
-
const
|
|
181
|
+
const y = await e(r, c), i = await v(n, y, s);
|
|
182
182
|
return o.json(i, {
|
|
183
|
-
headers:
|
|
183
|
+
headers: a ? j(r, a) : {}
|
|
184
184
|
});
|
|
185
|
-
} catch (
|
|
186
|
-
return console.error("Next.js dry-run handler error:",
|
|
185
|
+
} catch (n) {
|
|
186
|
+
return process.env.NODE_ENV !== "test" && console.error("Next.js dry-run handler error:", n), o.json(
|
|
187
187
|
{
|
|
188
|
-
error:
|
|
188
|
+
error: n instanceof Error ? n.message : "Dry-run validation failed",
|
|
189
189
|
valid: !1
|
|
190
190
|
},
|
|
191
191
|
{ status: 400 }
|
|
@@ -195,17 +195,17 @@ function Q(t) {
|
|
|
195
195
|
}
|
|
196
196
|
function q(t) {
|
|
197
197
|
return {
|
|
198
|
-
load:
|
|
199
|
-
meta:
|
|
200
|
-
sql:
|
|
198
|
+
load: H(t),
|
|
199
|
+
meta: A(t),
|
|
200
|
+
sql: b(t),
|
|
201
201
|
dryRun: Q(t)
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
export {
|
|
205
205
|
q as createCubeHandlers,
|
|
206
206
|
Q as createDryRunHandler,
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
H as createLoadHandler,
|
|
208
|
+
A as createMetaHandler,
|
|
209
209
|
P as createOptionsHandler,
|
|
210
|
-
|
|
210
|
+
b as createSqlHandler
|
|
211
211
|
};
|
|
@@ -22,14 +22,44 @@ export interface AxisDropZoneConfig {
|
|
|
22
22
|
/** Placeholder text when drop zone is empty */
|
|
23
23
|
emptyText?: string;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for a single display option
|
|
27
|
+
*/
|
|
28
|
+
export interface DisplayOptionConfig {
|
|
29
|
+
/** The key to store this field in displayConfig */
|
|
30
|
+
key: string;
|
|
31
|
+
/** Display label for the option */
|
|
32
|
+
label: string;
|
|
33
|
+
/** Type of input control to render */
|
|
34
|
+
type: 'boolean' | 'string' | 'number' | 'select' | 'color' | 'paletteColor';
|
|
35
|
+
/** Default value for the option */
|
|
36
|
+
defaultValue?: any;
|
|
37
|
+
/** Placeholder text for string/number inputs */
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
/** Options for select type */
|
|
40
|
+
options?: Array<{
|
|
41
|
+
value: any;
|
|
42
|
+
label: string;
|
|
43
|
+
}>;
|
|
44
|
+
/** Help text shown below the input */
|
|
45
|
+
description?: string;
|
|
46
|
+
/** Minimum value for number inputs */
|
|
47
|
+
min?: number;
|
|
48
|
+
/** Maximum value for number inputs */
|
|
49
|
+
max?: number;
|
|
50
|
+
/** Step value for number inputs */
|
|
51
|
+
step?: number;
|
|
52
|
+
}
|
|
25
53
|
/**
|
|
26
54
|
* Complete configuration for a chart type
|
|
27
55
|
*/
|
|
28
56
|
export interface ChartTypeConfig {
|
|
29
57
|
/** Configuration for each drop zone */
|
|
30
58
|
dropZones: AxisDropZoneConfig[];
|
|
31
|
-
/**
|
|
59
|
+
/** Simple display options (backward compatibility) - rendered as boolean checkboxes */
|
|
32
60
|
displayOptions?: string[];
|
|
61
|
+
/** Structured display options with metadata for different input types */
|
|
62
|
+
displayOptionsConfig?: DisplayOptionConfig[];
|
|
33
63
|
/** Optional custom validation function */
|
|
34
64
|
validate?: (config: any) => {
|
|
35
65
|
isValid: boolean;
|
package/dist/client/charts.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export { RechartsBarChart, RechartsLineChart, RechartsAreaChart, RechartsPieChar
|
|
|
8
8
|
export { formatChartData } from './utils/index';
|
|
9
9
|
export { CHART_COLORS, POSITIVE_COLOR, NEGATIVE_COLOR, CHART_MARGINS } from './utils/chartConstants';
|
|
10
10
|
export type { ChartType, ChartAxisConfig, ChartDisplayConfig } from './types';
|
|
11
|
+
export type { ChartTypeConfig, DisplayOptionConfig, AxisDropZoneConfig } from './charts/chartConfigs';
|
package/dist/client/charts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { k as t, C as s, D as h, N as R, u as e, A as C, B as c, L as O, P as T, R as A, a as L, S, T as I, f as _ } from "./chunks/charts-
|
|
1
|
+
import { k as t, C as s, D as h, N as R, u as e, A as C, B as c, L as O, P as T, R as A, a as L, S, T as I, f as _ } from "./chunks/charts-Dx3asDBi.js";
|
|
2
2
|
export {
|
|
3
3
|
t as CHART_COLORS,
|
|
4
4
|
s as CHART_MARGINS,
|