drizzle-cube 0.1.29 → 0.1.31
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 +1 -1
- package/dist/adapters/{compiler-BibS3bXd.js → compiler-CVega_Gv.js} +1786 -1820
- package/dist/adapters/express/index.js +87 -89
- package/dist/adapters/fastify/index.js +81 -83
- package/dist/adapters/hono/index.js +113 -116
- package/dist/adapters/nextjs/index.js +101 -102
- package/dist/client/charts.js +1 -1
- package/dist/client/chunks/charts-MTxju0dv.js +2402 -0
- package/dist/client/chunks/charts-MTxju0dv.js.map +1 -0
- package/dist/client/chunks/{icons-B_0yoGjv.js → icons-C_McHd9z.js} +10 -1
- package/dist/client/chunks/{icons-B_0yoGjv.js.map → icons-C_McHd9z.js.map} +1 -1
- package/dist/client/chunks/providers-DwDirAYo.js +208 -0
- package/dist/client/chunks/{providers-B7MVnAAt.js.map → providers-DwDirAYo.js.map} +1 -1
- package/dist/client/components.js +9741 -9616
- package/dist/client/components.js.map +1 -1
- package/dist/client/hooks.js +2 -2
- package/dist/client/index.js +2 -2
- package/dist/client/providers.js +1 -1
- package/dist/client/styles.css +1 -1
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.js +1479 -1485
- package/package.json +29 -20
- package/dist/client/chunks/charts-BM1k01Jw.js +0 -2404
- package/dist/client/chunks/charts-BM1k01Jw.js.map +0 -1
- package/dist/client/chunks/providers-B7MVnAAt.js +0 -211
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Hono as
|
|
2
|
-
import { S as
|
|
3
|
-
var
|
|
4
|
-
const
|
|
1
|
+
import { Hono as w } from "hono";
|
|
2
|
+
import { S as x, f as j, a as Q, b as g, h as p } from "../compiler-CVega_Gv.js";
|
|
3
|
+
var v = (d) => {
|
|
4
|
+
const u = {
|
|
5
5
|
...{
|
|
6
6
|
origin: "*",
|
|
7
7
|
allowMethods: ["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH"],
|
|
@@ -9,28 +9,27 @@ var b = (d) => {
|
|
|
9
9
|
exposeHeaders: []
|
|
10
10
|
},
|
|
11
11
|
...d
|
|
12
|
-
},
|
|
13
|
-
return async function(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
n.res.headers.set(r, t);
|
|
12
|
+
}, h = /* @__PURE__ */ ((a) => typeof a == "string" ? a === "*" ? () => a : (o) => a === o ? o : null : typeof a == "function" ? a : (o) => a.includes(o) ? o : null)(u.origin), f = ((a) => typeof a == "function" ? a : Array.isArray(a) ? () => a : () => [])(u.allowMethods);
|
|
13
|
+
return async function(o, c) {
|
|
14
|
+
function s(r, e) {
|
|
15
|
+
o.res.headers.set(r, e);
|
|
17
16
|
}
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const r =
|
|
17
|
+
const n = await h(o.req.header("origin") || "", o);
|
|
18
|
+
if (n && s("Access-Control-Allow-Origin", n), u.origin !== "*") {
|
|
19
|
+
const r = o.req.header("Vary");
|
|
21
20
|
r ? s("Vary", r) : s("Vary", "Origin");
|
|
22
21
|
}
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
const r = f(
|
|
22
|
+
if (u.credentials && s("Access-Control-Allow-Credentials", "true"), u.exposeHeaders?.length && s("Access-Control-Expose-Headers", u.exposeHeaders.join(",")), o.req.method === "OPTIONS") {
|
|
23
|
+
u.maxAge != null && s("Access-Control-Max-Age", u.maxAge.toString());
|
|
24
|
+
const r = await f(o.req.header("origin") || "", o);
|
|
26
25
|
r.length && s("Access-Control-Allow-Methods", r.join(","));
|
|
27
|
-
let
|
|
28
|
-
if (!
|
|
29
|
-
const
|
|
30
|
-
|
|
26
|
+
let e = u.allowHeaders;
|
|
27
|
+
if (!e?.length) {
|
|
28
|
+
const t = o.req.header("Access-Control-Request-Headers");
|
|
29
|
+
t && (e = t.split(/\s*,\s*/));
|
|
31
30
|
}
|
|
32
|
-
return
|
|
33
|
-
headers:
|
|
31
|
+
return e?.length && (s("Access-Control-Allow-Headers", e.join(",")), o.res.headers.append("Vary", "Access-Control-Request-Headers")), o.res.headers.delete("Content-Length"), o.res.headers.delete("Content-Type"), new Response(null, {
|
|
32
|
+
headers: o.res.headers,
|
|
34
33
|
status: 204,
|
|
35
34
|
statusText: "No Content"
|
|
36
35
|
});
|
|
@@ -38,160 +37,158 @@ var b = (d) => {
|
|
|
38
37
|
await c();
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
|
-
function
|
|
40
|
+
function A(d) {
|
|
42
41
|
const {
|
|
43
42
|
cubes: y,
|
|
44
|
-
drizzle:
|
|
45
|
-
schema:
|
|
43
|
+
drizzle: u,
|
|
44
|
+
schema: h,
|
|
46
45
|
extractSecurityContext: f,
|
|
47
|
-
engineType:
|
|
48
|
-
cors:
|
|
46
|
+
engineType: a,
|
|
47
|
+
cors: o,
|
|
49
48
|
basePath: c = "/cubejs-api/v1"
|
|
50
49
|
} = d;
|
|
51
50
|
if (!y || y.length === 0)
|
|
52
51
|
throw new Error("At least one cube must be provided in the cubes array");
|
|
53
|
-
const s = new
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
drizzle:
|
|
57
|
-
schema:
|
|
58
|
-
engineType:
|
|
52
|
+
const s = new w();
|
|
53
|
+
o && s.use("/*", v(o));
|
|
54
|
+
const n = new x({
|
|
55
|
+
drizzle: u,
|
|
56
|
+
schema: h,
|
|
57
|
+
engineType: a
|
|
59
58
|
});
|
|
60
|
-
return y.forEach((
|
|
61
|
-
|
|
62
|
-
}), s.post(`${c}/load`, async (
|
|
59
|
+
return y.forEach((r) => {
|
|
60
|
+
n.registerCube(r);
|
|
61
|
+
}), s.post(`${c}/load`, async (r) => {
|
|
63
62
|
try {
|
|
64
|
-
const
|
|
63
|
+
const e = await r.req.json(), t = e.query || e, l = await f(r), i = n.validateQuery(t);
|
|
65
64
|
if (!i.isValid)
|
|
66
|
-
return
|
|
65
|
+
return r.json({
|
|
67
66
|
error: `Query validation failed: ${i.errors.join(", ")}`
|
|
68
67
|
}, 400);
|
|
69
|
-
const m = await
|
|
70
|
-
return
|
|
71
|
-
} catch (
|
|
72
|
-
return console.error("Query execution error:",
|
|
73
|
-
error:
|
|
68
|
+
const m = await n.executeMultiCubeQuery(t, l);
|
|
69
|
+
return r.json(j(t, m, n));
|
|
70
|
+
} catch (e) {
|
|
71
|
+
return console.error("Query execution error:", e), r.json({
|
|
72
|
+
error: e instanceof Error ? e.message : "Query execution failed"
|
|
74
73
|
}, 500);
|
|
75
74
|
}
|
|
76
|
-
}), s.get(`${c}/load`, async (
|
|
75
|
+
}), s.get(`${c}/load`, async (r) => {
|
|
77
76
|
try {
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
80
|
-
return
|
|
77
|
+
const e = r.req.query("query");
|
|
78
|
+
if (!e)
|
|
79
|
+
return r.json({
|
|
81
80
|
error: "Query parameter is required"
|
|
82
81
|
}, 400);
|
|
83
82
|
let t;
|
|
84
83
|
try {
|
|
85
|
-
t = JSON.parse(
|
|
84
|
+
t = JSON.parse(e);
|
|
86
85
|
} catch {
|
|
87
|
-
return
|
|
86
|
+
return r.json({
|
|
88
87
|
error: "Invalid JSON in query parameter"
|
|
89
88
|
}, 400);
|
|
90
89
|
}
|
|
91
|
-
const
|
|
90
|
+
const l = await f(r), i = n.validateQuery(t);
|
|
92
91
|
if (!i.isValid)
|
|
93
|
-
return
|
|
92
|
+
return r.json({
|
|
94
93
|
error: `Query validation failed: ${i.errors.join(", ")}`
|
|
95
94
|
}, 400);
|
|
96
|
-
const m = await
|
|
97
|
-
return
|
|
98
|
-
} catch (
|
|
99
|
-
return console.error("Query execution error:",
|
|
100
|
-
error:
|
|
95
|
+
const m = await n.executeMultiCubeQuery(t, l);
|
|
96
|
+
return r.json(j(t, m, n));
|
|
97
|
+
} catch (e) {
|
|
98
|
+
return console.error("Query execution error:", e), r.json({
|
|
99
|
+
error: e instanceof Error ? e.message : "Query execution failed"
|
|
101
100
|
}, 500);
|
|
102
101
|
}
|
|
103
|
-
}), s.get(`${c}/meta`, (
|
|
102
|
+
}), s.get(`${c}/meta`, (r) => {
|
|
104
103
|
try {
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
} catch (
|
|
108
|
-
return console.error("Metadata error:",
|
|
109
|
-
error:
|
|
104
|
+
const e = n.getMetadata();
|
|
105
|
+
return r.json(Q(e));
|
|
106
|
+
} catch (e) {
|
|
107
|
+
return console.error("Metadata error:", e), r.json({
|
|
108
|
+
error: e instanceof Error ? e.message : "Failed to fetch metadata"
|
|
110
109
|
}, 500);
|
|
111
110
|
}
|
|
112
|
-
}), s.post(`${c}/sql`, async (
|
|
113
|
-
var r, t;
|
|
111
|
+
}), s.post(`${c}/sql`, async (r) => {
|
|
114
112
|
try {
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
117
|
-
return
|
|
118
|
-
error: `Query validation failed: ${
|
|
113
|
+
const e = await r.req.json(), t = await f(r), l = n.validateQuery(e);
|
|
114
|
+
if (!l.isValid)
|
|
115
|
+
return r.json({
|
|
116
|
+
error: `Query validation failed: ${l.errors.join(", ")}`
|
|
119
117
|
}, 400);
|
|
120
|
-
const
|
|
121
|
-
if (!
|
|
122
|
-
return
|
|
118
|
+
const i = e.measures?.[0] || e.dimensions?.[0];
|
|
119
|
+
if (!i)
|
|
120
|
+
return r.json({
|
|
123
121
|
error: "No measures or dimensions specified"
|
|
124
122
|
}, 400);
|
|
125
|
-
const
|
|
126
|
-
return
|
|
127
|
-
} catch (
|
|
128
|
-
return console.error("SQL generation error:",
|
|
129
|
-
error:
|
|
123
|
+
const m = i.split(".")[0], q = await n.generateSQL(m, e, t);
|
|
124
|
+
return r.json(g(e, q));
|
|
125
|
+
} catch (e) {
|
|
126
|
+
return console.error("SQL generation error:", e), r.json({
|
|
127
|
+
error: e instanceof Error ? e.message : "SQL generation failed"
|
|
130
128
|
}, 500);
|
|
131
129
|
}
|
|
132
|
-
}), s.get(`${c}/sql`, async (
|
|
133
|
-
var r, t;
|
|
130
|
+
}), s.get(`${c}/sql`, async (r) => {
|
|
134
131
|
try {
|
|
135
|
-
const
|
|
136
|
-
if (!
|
|
137
|
-
return
|
|
132
|
+
const e = r.req.query("query");
|
|
133
|
+
if (!e)
|
|
134
|
+
return r.json({
|
|
138
135
|
error: "Query parameter is required"
|
|
139
136
|
}, 400);
|
|
140
|
-
const
|
|
141
|
-
if (!
|
|
142
|
-
return
|
|
143
|
-
error: `Query validation failed: ${
|
|
137
|
+
const t = JSON.parse(e), l = await f(r), i = n.validateQuery(t);
|
|
138
|
+
if (!i.isValid)
|
|
139
|
+
return r.json({
|
|
140
|
+
error: `Query validation failed: ${i.errors.join(", ")}`
|
|
144
141
|
}, 400);
|
|
145
|
-
const
|
|
146
|
-
if (!
|
|
147
|
-
return
|
|
142
|
+
const m = t.measures?.[0] || t.dimensions?.[0];
|
|
143
|
+
if (!m)
|
|
144
|
+
return r.json({
|
|
148
145
|
error: "No measures or dimensions specified"
|
|
149
146
|
}, 400);
|
|
150
|
-
const
|
|
151
|
-
return
|
|
152
|
-
} catch (
|
|
153
|
-
return console.error("SQL generation error:",
|
|
154
|
-
error:
|
|
147
|
+
const q = m.split(".")[0], C = await n.generateSQL(q, t, l);
|
|
148
|
+
return r.json(g(t, C));
|
|
149
|
+
} catch (e) {
|
|
150
|
+
return console.error("SQL generation error:", e), r.json({
|
|
151
|
+
error: e instanceof Error ? e.message : "SQL generation failed"
|
|
155
152
|
}, 500);
|
|
156
153
|
}
|
|
157
|
-
}), s.post(`${c}/dry-run`, async (
|
|
154
|
+
}), s.post(`${c}/dry-run`, async (r) => {
|
|
158
155
|
try {
|
|
159
|
-
const
|
|
160
|
-
return
|
|
161
|
-
} catch (
|
|
162
|
-
return console.error("Dry-run error:",
|
|
163
|
-
error:
|
|
156
|
+
const e = await r.req.json(), t = e.query || e, l = await f(r), i = await p(t, l, n);
|
|
157
|
+
return r.json(i);
|
|
158
|
+
} catch (e) {
|
|
159
|
+
return console.error("Dry-run error:", e), r.json({
|
|
160
|
+
error: e instanceof Error ? e.message : "Dry-run validation failed",
|
|
164
161
|
valid: !1
|
|
165
162
|
}, 400);
|
|
166
163
|
}
|
|
167
|
-
}), s.get(`${c}/dry-run`, async (
|
|
164
|
+
}), s.get(`${c}/dry-run`, async (r) => {
|
|
168
165
|
try {
|
|
169
|
-
const
|
|
170
|
-
if (!
|
|
171
|
-
return
|
|
166
|
+
const e = r.req.query("query");
|
|
167
|
+
if (!e)
|
|
168
|
+
return r.json({
|
|
172
169
|
error: "Query parameter is required",
|
|
173
170
|
valid: !1
|
|
174
171
|
}, 400);
|
|
175
|
-
const t = JSON.parse(
|
|
176
|
-
return
|
|
177
|
-
} catch (
|
|
178
|
-
return console.error("Dry-run error:",
|
|
179
|
-
error:
|
|
172
|
+
const t = JSON.parse(e), l = await f(r), i = await p(t, l, n);
|
|
173
|
+
return r.json(i);
|
|
174
|
+
} catch (e) {
|
|
175
|
+
return console.error("Dry-run error:", e), r.json({
|
|
176
|
+
error: e instanceof Error ? e.message : "Dry-run validation failed",
|
|
180
177
|
valid: !1
|
|
181
178
|
}, 400);
|
|
182
179
|
}
|
|
183
180
|
}), s;
|
|
184
181
|
}
|
|
185
|
-
function
|
|
186
|
-
const
|
|
187
|
-
return d.route("/",
|
|
182
|
+
function b(d, y) {
|
|
183
|
+
const u = A(y);
|
|
184
|
+
return d.route("/", u), d;
|
|
188
185
|
}
|
|
189
|
-
function
|
|
190
|
-
const y = new
|
|
191
|
-
return
|
|
186
|
+
function H(d) {
|
|
187
|
+
const y = new w();
|
|
188
|
+
return b(y, d);
|
|
192
189
|
}
|
|
193
190
|
export {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
H as createCubeApp,
|
|
192
|
+
A as createCubeRoutes,
|
|
193
|
+
b as mountCubeRoutes
|
|
197
194
|
};
|
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
import { NextResponse as o } from "next/server";
|
|
2
|
-
import { c
|
|
3
|
-
function g(
|
|
4
|
-
const { cubes:
|
|
5
|
-
if (!
|
|
2
|
+
import { c, f as x, a as E, b as N, h as S, S as p } from "../compiler-CVega_Gv.js";
|
|
3
|
+
function g(n) {
|
|
4
|
+
const { cubes: r, drizzle: a, schema: s, engineType: f } = n;
|
|
5
|
+
if (!r || r.length === 0)
|
|
6
6
|
throw new Error("At least one cube must be provided in the cubes array");
|
|
7
|
-
const
|
|
7
|
+
const t = new p({
|
|
8
8
|
drizzle: a,
|
|
9
9
|
schema: s,
|
|
10
10
|
engineType: f
|
|
11
11
|
});
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
}),
|
|
12
|
+
return r.forEach((i) => {
|
|
13
|
+
t.registerCube(i);
|
|
14
|
+
}), t;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const a =
|
|
18
|
-
return
|
|
16
|
+
function h(n, r) {
|
|
17
|
+
const a = n.headers.get("origin"), s = {};
|
|
18
|
+
return r.origin && (typeof r.origin == "string" ? s["Access-Control-Allow-Origin"] = r.origin : Array.isArray(r.origin) ? a && r.origin.includes(a) && (s["Access-Control-Allow-Origin"] = a) : typeof r.origin == "function" && a && r.origin(a) && (s["Access-Control-Allow-Origin"] = a)), r.methods && (s["Access-Control-Allow-Methods"] = r.methods.join(", ")), r.allowedHeaders && (s["Access-Control-Allow-Headers"] = r.allowedHeaders.join(", ")), r.credentials && (s["Access-Control-Allow-Credentials"] = "true"), s;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function R(n) {
|
|
21
21
|
return async function(a) {
|
|
22
|
-
const s =
|
|
22
|
+
const s = h(a, n);
|
|
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:
|
|
31
|
-
return async function(
|
|
29
|
+
function v(n) {
|
|
30
|
+
const { extractSecurityContext: r, cors: a } = n, s = g(n);
|
|
31
|
+
return async function(t, i) {
|
|
32
32
|
try {
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
35
|
-
const d = await
|
|
36
|
-
|
|
37
|
-
} else if (
|
|
38
|
-
const d =
|
|
33
|
+
let e;
|
|
34
|
+
if (t.method === "POST") {
|
|
35
|
+
const d = await t.json();
|
|
36
|
+
e = d.query || d;
|
|
37
|
+
} else if (t.method === "GET") {
|
|
38
|
+
const d = t.nextUrl.searchParams.get("query");
|
|
39
39
|
if (!d)
|
|
40
40
|
return o.json(
|
|
41
|
-
|
|
41
|
+
c("Query parameter is required", 400),
|
|
42
42
|
{ status: 400 }
|
|
43
43
|
);
|
|
44
44
|
try {
|
|
45
|
-
|
|
45
|
+
e = JSON.parse(d);
|
|
46
46
|
} catch {
|
|
47
47
|
return o.json(
|
|
48
|
-
|
|
48
|
+
c("Invalid JSON in query parameter", 400),
|
|
49
49
|
{ status: 400 }
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
} else
|
|
53
53
|
return o.json(
|
|
54
|
-
|
|
54
|
+
c("Method not allowed", 405),
|
|
55
55
|
{ status: 405 }
|
|
56
56
|
);
|
|
57
|
-
const y = await
|
|
58
|
-
if (!
|
|
57
|
+
const y = await r(t, i), u = s.validateQuery(e);
|
|
58
|
+
if (!u.isValid)
|
|
59
59
|
return o.json(
|
|
60
|
-
|
|
60
|
+
c(`Query validation failed: ${u.errors.join(", ")}`, 400),
|
|
61
61
|
{ status: 400 }
|
|
62
62
|
);
|
|
63
|
-
const
|
|
64
|
-
return o.json(
|
|
65
|
-
headers: a ?
|
|
63
|
+
const l = await s.executeMultiCubeQuery(e, y), j = x(e, l, s);
|
|
64
|
+
return o.json(j, {
|
|
65
|
+
headers: a ? h(t, a) : {}
|
|
66
66
|
});
|
|
67
|
-
} catch (
|
|
68
|
-
return process.env.NODE_ENV !== "test" && console.error("Next.js load handler error:",
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
} catch (e) {
|
|
68
|
+
return process.env.NODE_ENV !== "test" && console.error("Next.js load handler error:", e), o.json(
|
|
69
|
+
c(
|
|
70
|
+
e instanceof Error ? e.message : "Query execution failed",
|
|
71
71
|
500
|
|
72
72
|
),
|
|
73
73
|
{ status: 500 }
|
|
@@ -75,18 +75,18 @@ function H(t) {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
const { cors:
|
|
80
|
-
return async function(f,
|
|
78
|
+
function C(n) {
|
|
79
|
+
const { cors: r } = n, a = g(n);
|
|
80
|
+
return async function(f, t) {
|
|
81
81
|
try {
|
|
82
|
-
const
|
|
83
|
-
return o.json(
|
|
84
|
-
headers:
|
|
82
|
+
const i = a.getMetadata(), e = E(i);
|
|
83
|
+
return o.json(e, {
|
|
84
|
+
headers: r ? h(f, r) : {}
|
|
85
85
|
});
|
|
86
|
-
} catch (
|
|
87
|
-
return process.env.NODE_ENV !== "test" && console.error("Next.js meta handler error:",
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
} catch (i) {
|
|
87
|
+
return process.env.NODE_ENV !== "test" && console.error("Next.js meta handler error:", i), o.json(
|
|
88
|
+
c(
|
|
89
|
+
i instanceof Error ? i.message : "Failed to fetch metadata",
|
|
90
90
|
500
|
|
91
91
|
),
|
|
92
92
|
{ status: 500 }
|
|
@@ -94,55 +94,54 @@ function A(t) {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
const { extractSecurityContext:
|
|
99
|
-
return async function(
|
|
100
|
-
var n, y;
|
|
97
|
+
function H(n) {
|
|
98
|
+
const { extractSecurityContext: r, cors: a } = n, s = g(n);
|
|
99
|
+
return async function(t, i) {
|
|
101
100
|
try {
|
|
102
|
-
let
|
|
103
|
-
if (
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
} else if (
|
|
107
|
-
const
|
|
108
|
-
if (!
|
|
101
|
+
let e;
|
|
102
|
+
if (t.method === "POST") {
|
|
103
|
+
const m = await t.json();
|
|
104
|
+
e = m.query || m;
|
|
105
|
+
} else if (t.method === "GET") {
|
|
106
|
+
const m = t.nextUrl.searchParams.get("query");
|
|
107
|
+
if (!m)
|
|
109
108
|
return o.json(
|
|
110
|
-
|
|
109
|
+
c("Query parameter is required", 400),
|
|
111
110
|
{ status: 400 }
|
|
112
111
|
);
|
|
113
112
|
try {
|
|
114
|
-
|
|
113
|
+
e = JSON.parse(m);
|
|
115
114
|
} catch {
|
|
116
115
|
return o.json(
|
|
117
|
-
|
|
116
|
+
c("Invalid JSON in query parameter", 400),
|
|
118
117
|
{ status: 400 }
|
|
119
118
|
);
|
|
120
119
|
}
|
|
121
120
|
} else
|
|
122
121
|
return o.json(
|
|
123
|
-
|
|
122
|
+
c("Method not allowed", 405),
|
|
124
123
|
{ status: 405 }
|
|
125
124
|
);
|
|
126
|
-
const
|
|
127
|
-
if (!
|
|
125
|
+
const y = await r(t, i), u = s.validateQuery(e);
|
|
126
|
+
if (!u.isValid)
|
|
128
127
|
return o.json(
|
|
129
|
-
|
|
128
|
+
c(`Query validation failed: ${u.errors.join(", ")}`, 400),
|
|
130
129
|
{ status: 400 }
|
|
131
130
|
);
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
131
|
+
const l = e.measures?.[0] || e.dimensions?.[0];
|
|
132
|
+
if (!l)
|
|
134
133
|
return o.json(
|
|
135
|
-
|
|
134
|
+
c("No measures or dimensions specified", 400),
|
|
136
135
|
{ status: 400 }
|
|
137
136
|
);
|
|
138
|
-
const
|
|
139
|
-
return o.json(
|
|
140
|
-
headers: a ?
|
|
137
|
+
const j = l.split(".")[0], d = await s.generateSQL(j, e, y), w = N(e, d);
|
|
138
|
+
return o.json(w, {
|
|
139
|
+
headers: a ? h(t, a) : {}
|
|
141
140
|
});
|
|
142
|
-
} catch (
|
|
143
|
-
return process.env.NODE_ENV !== "test" && console.error("Next.js SQL handler error:",
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
} catch (e) {
|
|
142
|
+
return process.env.NODE_ENV !== "test" && console.error("Next.js SQL handler error:", e), o.json(
|
|
143
|
+
c(
|
|
144
|
+
e instanceof Error ? e.message : "SQL generation failed",
|
|
146
145
|
500
|
|
147
146
|
),
|
|
148
147
|
{ status: 500 }
|
|
@@ -150,23 +149,23 @@ function b(t) {
|
|
|
150
149
|
}
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
|
-
function
|
|
154
|
-
const { extractSecurityContext:
|
|
155
|
-
return async function(
|
|
152
|
+
function A(n) {
|
|
153
|
+
const { extractSecurityContext: r, cors: a } = n, s = g(n);
|
|
154
|
+
return async function(t, i) {
|
|
156
155
|
try {
|
|
157
|
-
let
|
|
158
|
-
if (
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
} else if (
|
|
162
|
-
const
|
|
163
|
-
if (!
|
|
156
|
+
let e;
|
|
157
|
+
if (t.method === "POST") {
|
|
158
|
+
const l = await t.json();
|
|
159
|
+
e = l.query || l;
|
|
160
|
+
} else if (t.method === "GET") {
|
|
161
|
+
const l = t.nextUrl.searchParams.get("query");
|
|
162
|
+
if (!l)
|
|
164
163
|
return o.json(
|
|
165
164
|
{ error: "Query parameter is required", valid: !1 },
|
|
166
165
|
{ status: 400 }
|
|
167
166
|
);
|
|
168
167
|
try {
|
|
169
|
-
|
|
168
|
+
e = JSON.parse(l);
|
|
170
169
|
} catch {
|
|
171
170
|
return o.json(
|
|
172
171
|
{ error: "Invalid JSON in query parameter", valid: !1 },
|
|
@@ -178,14 +177,14 @@ function Q(t) {
|
|
|
178
177
|
{ error: "Method not allowed", valid: !1 },
|
|
179
178
|
{ status: 405 }
|
|
180
179
|
);
|
|
181
|
-
const y = await
|
|
182
|
-
return o.json(
|
|
183
|
-
headers: a ?
|
|
180
|
+
const y = await r(t, i), u = await S(e, y, s);
|
|
181
|
+
return o.json(u, {
|
|
182
|
+
headers: a ? h(t, a) : {}
|
|
184
183
|
});
|
|
185
|
-
} catch (
|
|
186
|
-
return process.env.NODE_ENV !== "test" && console.error("Next.js dry-run handler error:",
|
|
184
|
+
} catch (e) {
|
|
185
|
+
return process.env.NODE_ENV !== "test" && console.error("Next.js dry-run handler error:", e), o.json(
|
|
187
186
|
{
|
|
188
|
-
error:
|
|
187
|
+
error: e instanceof Error ? e.message : "Dry-run validation failed",
|
|
189
188
|
valid: !1
|
|
190
189
|
},
|
|
191
190
|
{ status: 400 }
|
|
@@ -193,19 +192,19 @@ function Q(t) {
|
|
|
193
192
|
}
|
|
194
193
|
};
|
|
195
194
|
}
|
|
196
|
-
function
|
|
195
|
+
function M(n) {
|
|
197
196
|
return {
|
|
198
|
-
load:
|
|
199
|
-
meta:
|
|
200
|
-
sql:
|
|
201
|
-
dryRun:
|
|
197
|
+
load: v(n),
|
|
198
|
+
meta: C(n),
|
|
199
|
+
sql: H(n),
|
|
200
|
+
dryRun: A(n)
|
|
202
201
|
};
|
|
203
202
|
}
|
|
204
203
|
export {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
204
|
+
M as createCubeHandlers,
|
|
205
|
+
A as createDryRunHandler,
|
|
206
|
+
v as createLoadHandler,
|
|
207
|
+
C as createMetaHandler,
|
|
208
|
+
R as createOptionsHandler,
|
|
209
|
+
H as createSqlHandler
|
|
211
210
|
};
|
package/dist/client/charts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as t, C as s, D as h, N as R, G 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 { r as t, C as s, D as h, N as R, G 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-MTxju0dv.js";
|
|
2
2
|
export {
|
|
3
3
|
t as CHART_COLORS,
|
|
4
4
|
s as CHART_MARGINS,
|