drizzle-cube 0.1.42 → 0.1.44

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 (43) hide show
  1. package/dist/adapters/{compiler-B57cLx38.js → compiler-DdaSPwZs.js} +25 -8
  2. package/dist/adapters/express/index.js +84 -63
  3. package/dist/adapters/fastify/index.js +108 -73
  4. package/dist/adapters/hono/index.js +62 -44
  5. package/dist/adapters/nextjs/index.d.ts +6 -0
  6. package/dist/adapters/nextjs/index.js +145 -108
  7. package/dist/adapters/utils.d.ts +46 -0
  8. package/dist/client/charts.js +1 -1
  9. package/dist/client/chunks/{charts-VcPFhxyE.js → charts-CfbqkXfS.js} +415 -425
  10. package/dist/client/chunks/charts-CfbqkXfS.js.map +1 -0
  11. package/dist/client/chunks/{components-DzCsplX7.js → components-B0Wk5TCQ.js} +8814 -7851
  12. package/dist/client/chunks/components-B0Wk5TCQ.js.map +1 -0
  13. package/dist/client/chunks/{icons-MNJ50ahP.js → icons-oifcbJCc.js} +309 -255
  14. package/dist/client/chunks/icons-oifcbJCc.js.map +1 -0
  15. package/dist/client/chunks/providers-aaWIe5KD.js +304 -0
  16. package/dist/client/chunks/providers-aaWIe5KD.js.map +1 -0
  17. package/dist/client/client/BatchCoordinator.d.ts +35 -0
  18. package/dist/client/client/CubeClient.d.ts +5 -0
  19. package/dist/client/components/AnalyticsDashboard.d.ts +1 -1
  20. package/dist/client/components/DashboardFilterPanel.d.ts +15 -0
  21. package/dist/client/components/DashboardFilters/EditModeFilterList.d.ts +12 -0
  22. package/dist/client/components/DashboardFilters/FilterEditModal.d.ts +15 -0
  23. package/dist/client/components/DashboardFilters/ReadOnlyFilterList.d.ts +13 -0
  24. package/dist/client/components/DashboardGrid.d.ts +5 -2
  25. package/dist/client/components/PortletFilterConfigModal.d.ts +11 -0
  26. package/dist/client/components/QueryBuilder/DateRangeSelector.d.ts +2 -0
  27. package/dist/client/components/QueryBuilder/types.d.ts +3 -0
  28. package/dist/client/components.js +2 -2
  29. package/dist/client/hooks.js +61 -61
  30. package/dist/client/hooks.js.map +1 -1
  31. package/dist/client/index.js +3 -3
  32. package/dist/client/providers/CubeProvider.d.ts +5 -0
  33. package/dist/client/providers.js +1 -1
  34. package/dist/client/styles.css +1 -1
  35. package/dist/client/types.d.ts +14 -0
  36. package/dist/client/utils/filterUtils.d.ts +40 -0
  37. package/dist/client-bundle-stats.html +1 -1
  38. package/package.json +1 -1
  39. package/dist/client/chunks/charts-VcPFhxyE.js.map +0 -1
  40. package/dist/client/chunks/components-DzCsplX7.js.map +0 -1
  41. package/dist/client/chunks/icons-MNJ50ahP.js.map +0 -1
  42. package/dist/client/chunks/providers-DwDirAYo.js +0 -208
  43. package/dist/client/chunks/providers-DwDirAYo.js.map +0 -1
@@ -20338,7 +20338,7 @@ function HN(T) {
20338
20338
  }
20339
20339
  return "postgres";
20340
20340
  }
20341
- async function BN(T, E, e) {
20341
+ async function pN(T, E, e) {
20342
20342
  const R = e.validateQuery(T);
20343
20343
  if (!R.isValid)
20344
20344
  throw new Error(`Query validation failed: ${R.errors.join(", ")}`);
@@ -20398,7 +20398,7 @@ async function BN(T, E, e) {
20398
20398
  query: T
20399
20399
  };
20400
20400
  }
20401
- function pN(T, E, e) {
20401
+ function dN(T, E, e) {
20402
20402
  const R = HN(e), A = GN(), S = (/* @__PURE__ */ new Date()).toISOString(), I = mN(T);
20403
20403
  return {
20404
20404
  queryType: "regularQuery",
@@ -20459,7 +20459,23 @@ function fN(T, E = 500) {
20459
20459
  status: E
20460
20460
  };
20461
20461
  }
20462
- class dN {
20462
+ async function hN(T, E, e) {
20463
+ return { results: (await Promise.allSettled(
20464
+ T.map(async (S) => {
20465
+ const I = await e.executeMultiCubeQuery(S, E);
20466
+ return dN(S, I, e);
20467
+ })
20468
+ )).map((S, I) => S.status === "fulfilled" ? {
20469
+ success: !0,
20470
+ ...S.value
20471
+ } : {
20472
+ success: !1,
20473
+ error: S.reason instanceof Error ? S.reason.message : String(S.reason),
20474
+ query: T[I]
20475
+ // Include the query that failed for debugging
20476
+ }) };
20477
+ }
20478
+ class BN {
20463
20479
  cubes = /* @__PURE__ */ new Map();
20464
20480
  dbExecutor;
20465
20481
  metadataCache;
@@ -20818,12 +20834,13 @@ function ne(T, E, e, R) {
20818
20834
  }
20819
20835
  !I.dimensions[S] && !I.measures[S] && e.push(`Filter field '${S}' not found on cube '${A}' (must be a dimension or measure)`);
20820
20836
  }
20821
- new dN();
20837
+ new BN();
20822
20838
  export {
20823
- dN as S,
20839
+ BN as S,
20824
20840
  YN as a,
20825
20841
  FN as b,
20826
- fN as c,
20827
- pN as f,
20828
- BN as h
20842
+ pN as c,
20843
+ fN as d,
20844
+ dN as f,
20845
+ hN as h
20829
20846
  };
@@ -1,138 +1,159 @@
1
- import p, { Router as w } from "express";
1
+ import p, { Router as C } from "express";
2
2
  import S from "cors";
3
- import { S as E, c as s, f as g, a as R, b as q, h as v } from "../compiler-B57cLx38.js";
4
- function $(l) {
3
+ import { S as R, d as o, f as g, h as E, a as $, b as Q, c as q } from "../compiler-DdaSPwZs.js";
4
+ function L(d) {
5
5
  const {
6
- cubes: c,
6
+ cubes: y,
7
7
  drizzle: j,
8
8
  schema: x,
9
- extractSecurityContext: d,
10
- engineType: h,
9
+ extractSecurityContext: l,
10
+ engineType: v,
11
11
  cors: b,
12
- basePath: y = "/cubejs-api/v1",
13
- jsonLimit: Q = "10mb"
14
- } = l;
15
- if (!c || c.length === 0)
12
+ basePath: c = "/cubejs-api/v1",
13
+ jsonLimit: h = "10mb"
14
+ } = d;
15
+ if (!y || y.length === 0)
16
16
  throw new Error("At least one cube must be provided in the cubes array");
17
- const i = w();
18
- b && i.use(S(b)), i.use(p.json({ limit: Q })), i.use(p.urlencoded({ extended: !0, limit: Q }));
19
- const a = new E({
17
+ const i = C();
18
+ b && i.use(S(b)), i.use(p.json({ limit: h })), i.use(p.urlencoded({ extended: !0, limit: h }));
19
+ const a = new R({
20
20
  drizzle: j,
21
21
  schema: x,
22
- engineType: h
22
+ engineType: v
23
23
  });
24
- return c.forEach((t) => {
24
+ return y.forEach((t) => {
25
25
  a.registerCube(t);
26
- }), i.post(`${y}/load`, async (t, r) => {
26
+ }), i.post(`${c}/load`, async (t, r) => {
27
27
  try {
28
- const e = t.body.query || t.body, o = await d(t, r), n = a.validateQuery(e);
28
+ const e = t.body.query || t.body, s = await l(t, r), n = a.validateQuery(e);
29
29
  if (!n.isValid)
30
- return r.status(400).json(s(
30
+ return r.status(400).json(o(
31
31
  `Query validation failed: ${n.errors.join(", ")}`,
32
32
  400
33
33
  ));
34
- const u = await a.executeMultiCubeQuery(e, o);
34
+ const u = await a.executeMultiCubeQuery(e, s);
35
35
  r.json(g(e, u, a));
36
36
  } catch (e) {
37
- console.error("Query execution error:", e), r.status(500).json(s(
37
+ console.error("Query execution error:", e), r.status(500).json(o(
38
38
  e instanceof Error ? e.message : "Query execution failed",
39
39
  500
40
40
  ));
41
41
  }
42
- }), i.get(`${y}/load`, async (t, r) => {
42
+ }), i.get(`${c}/load`, async (t, r) => {
43
43
  try {
44
44
  const e = t.query.query;
45
45
  if (!e)
46
- return r.status(400).json(s(
46
+ return r.status(400).json(o(
47
47
  "Query parameter is required",
48
48
  400
49
49
  ));
50
- let o;
50
+ let s;
51
51
  try {
52
- o = JSON.parse(e);
52
+ s = JSON.parse(e);
53
53
  } catch {
54
- return r.status(400).json(s(
54
+ return r.status(400).json(o(
55
55
  "Invalid JSON in query parameter",
56
56
  400
57
57
  ));
58
58
  }
59
- const n = await d(t, r), u = a.validateQuery(o);
59
+ const n = await l(t, r), u = a.validateQuery(s);
60
60
  if (!u.isValid)
61
- return r.status(400).json(s(
61
+ return r.status(400).json(o(
62
62
  `Query validation failed: ${u.errors.join(", ")}`,
63
63
  400
64
64
  ));
65
- const f = await a.executeMultiCubeQuery(o, n);
66
- r.json(g(o, f, a));
65
+ const f = await a.executeMultiCubeQuery(s, n);
66
+ r.json(g(s, f, a));
67
67
  } catch (e) {
68
- console.error("Query execution error:", e), r.status(500).json(s(
68
+ console.error("Query execution error:", e), r.status(500).json(o(
69
69
  e instanceof Error ? e.message : "Query execution failed",
70
70
  500
71
71
  ));
72
72
  }
73
- }), i.get(`${y}/meta`, (t, r) => {
73
+ }), i.post(`${c}/batch`, async (t, r) => {
74
+ try {
75
+ const { queries: e } = t.body;
76
+ if (!e || !Array.isArray(e))
77
+ return r.status(400).json(o(
78
+ 'Request body must contain a "queries" array',
79
+ 400
80
+ ));
81
+ if (e.length === 0)
82
+ return r.status(400).json(o(
83
+ "Queries array cannot be empty",
84
+ 400
85
+ ));
86
+ const s = await l(t, r), n = await E(e, s, a);
87
+ r.json(n);
88
+ } catch (e) {
89
+ console.error("Batch execution error:", e), r.status(500).json(o(
90
+ e instanceof Error ? e.message : "Batch execution failed",
91
+ 500
92
+ ));
93
+ }
94
+ }), i.get(`${c}/meta`, (t, r) => {
74
95
  try {
75
96
  const e = a.getMetadata();
76
- r.json(R(e));
97
+ r.json($(e));
77
98
  } catch (e) {
78
- console.error("Metadata error:", e), r.status(500).json(s(
99
+ console.error("Metadata error:", e), r.status(500).json(o(
79
100
  e instanceof Error ? e.message : "Failed to fetch metadata",
80
101
  500
81
102
  ));
82
103
  }
83
- }), i.post(`${y}/sql`, async (t, r) => {
104
+ }), i.post(`${c}/sql`, async (t, r) => {
84
105
  try {
85
- const e = t.body, o = await d(t, r), n = a.validateQuery(e);
106
+ const e = t.body, s = await l(t, r), n = a.validateQuery(e);
86
107
  if (!n.isValid)
87
- return r.status(400).json(s(
108
+ return r.status(400).json(o(
88
109
  `Query validation failed: ${n.errors.join(", ")}`,
89
110
  400
90
111
  ));
91
112
  const u = e.measures?.[0] || e.dimensions?.[0];
92
113
  if (!u)
93
- return r.status(400).json(s(
114
+ return r.status(400).json(o(
94
115
  "No measures or dimensions specified",
95
116
  400
96
117
  ));
97
- const f = u.split(".")[0], m = await a.generateSQL(f, e, o);
98
- r.json(q(e, m));
118
+ const f = u.split(".")[0], m = await a.generateSQL(f, e, s);
119
+ r.json(Q(e, m));
99
120
  } catch (e) {
100
- console.error("SQL generation error:", e), r.status(500).json(s(
121
+ console.error("SQL generation error:", e), r.status(500).json(o(
101
122
  e instanceof Error ? e.message : "SQL generation failed",
102
123
  500
103
124
  ));
104
125
  }
105
- }), i.get(`${y}/sql`, async (t, r) => {
126
+ }), i.get(`${c}/sql`, async (t, r) => {
106
127
  try {
107
128
  const e = t.query.query;
108
129
  if (!e)
109
- return r.status(400).json(s(
130
+ return r.status(400).json(o(
110
131
  "Query parameter is required",
111
132
  400
112
133
  ));
113
- const o = JSON.parse(e), n = await d(t, r), u = a.validateQuery(o);
134
+ const s = JSON.parse(e), n = await l(t, r), u = a.validateQuery(s);
114
135
  if (!u.isValid)
115
- return r.status(400).json(s(
136
+ return r.status(400).json(o(
116
137
  `Query validation failed: ${u.errors.join(", ")}`,
117
138
  400
118
139
  ));
119
- const f = o.measures?.[0] || o.dimensions?.[0];
140
+ const f = s.measures?.[0] || s.dimensions?.[0];
120
141
  if (!f)
121
- return r.status(400).json(s(
142
+ return r.status(400).json(o(
122
143
  "No measures or dimensions specified",
123
144
  400
124
145
  ));
125
- const m = f.split(".")[0], C = await a.generateSQL(m, o, n);
126
- r.json(q(o, C));
146
+ const m = f.split(".")[0], w = await a.generateSQL(m, s, n);
147
+ r.json(Q(s, w));
127
148
  } catch (e) {
128
- console.error("SQL generation error:", e), r.status(500).json(s(
149
+ console.error("SQL generation error:", e), r.status(500).json(o(
129
150
  e instanceof Error ? e.message : "SQL generation failed",
130
151
  500
131
152
  ));
132
153
  }
133
- }), i.post(`${y}/dry-run`, async (t, r) => {
154
+ }), i.post(`${c}/dry-run`, async (t, r) => {
134
155
  try {
135
- const e = t.body.query || t.body, o = await d(t, r), n = await v(e, o, a);
156
+ const e = t.body.query || t.body, s = await l(t, r), n = await q(e, s, a);
136
157
  r.json(n);
137
158
  } catch (e) {
138
159
  console.error("Dry-run error:", e), r.status(400).json({
@@ -140,7 +161,7 @@ function $(l) {
140
161
  valid: !1
141
162
  });
142
163
  }
143
- }), i.get(`${y}/dry-run`, async (t, r) => {
164
+ }), i.get(`${c}/dry-run`, async (t, r) => {
144
165
  try {
145
166
  const e = t.query.query;
146
167
  if (!e)
@@ -148,7 +169,7 @@ function $(l) {
148
169
  error: "Query parameter is required",
149
170
  valid: !1
150
171
  });
151
- const o = JSON.parse(e), n = await d(t, r), u = await v(o, n, a);
172
+ const s = JSON.parse(e), n = await l(t, r), u = await q(s, n, a);
152
173
  r.json(u);
153
174
  } catch (e) {
154
175
  console.error("Dry-run error:", e), r.status(400).json({
@@ -156,20 +177,20 @@ function $(l) {
156
177
  valid: !1
157
178
  });
158
179
  }
159
- }), i.use((t, r, e, o) => {
160
- console.error("Express adapter error:", t), e.headersSent || e.status(500).json(s(t, 500));
180
+ }), i.use((t, r, e, s) => {
181
+ console.error("Express adapter error:", t), e.headersSent || e.status(500).json(o(t, 500));
161
182
  }), i;
162
183
  }
163
- function L(l, c) {
164
- const j = $(c);
165
- return l.use("/", j), l;
184
+ function N(d, y) {
185
+ const j = L(y);
186
+ return d.use("/", j), d;
166
187
  }
167
- function J(l) {
168
- const c = p();
169
- return L(c, l);
188
+ function J(d) {
189
+ const y = p();
190
+ return N(y, d);
170
191
  }
171
192
  export {
172
193
  J as createCubeApp,
173
- $ as createCubeRouter,
174
- L as mountCubeRoutes
194
+ L as createCubeRouter,
195
+ N as mountCubeRoutes
175
196
  };
@@ -1,30 +1,30 @@
1
- import { S as j, c as i, f as q, a as $, b as h, h as v } from "../compiler-B57cLx38.js";
2
- const Q = function(a, C, p) {
1
+ import { S as E, d as o, f, h as R, a as $, b as q, c as Q } from "../compiler-DdaSPwZs.js";
2
+ const v = function(a, x, p) {
3
3
  const {
4
- cubes: g,
5
- drizzle: w,
6
- schema: x,
4
+ cubes: b,
5
+ drizzle: C,
6
+ schema: w,
7
7
  extractSecurityContext: y,
8
8
  engineType: S,
9
- cors: f,
10
- basePath: d = "/cubejs-api/v1",
11
- bodyLimit: b = 10485760
9
+ cors: h,
10
+ basePath: c = "/cubejs-api/v1",
11
+ bodyLimit: m = 10485760
12
12
  // 10MB
13
- } = C;
14
- if (!g || g.length === 0)
13
+ } = x;
14
+ if (!b || b.length === 0)
15
15
  return p(new Error("At least one cube must be provided in the cubes array"));
16
- f && a.register(import("@fastify/cors"), f), a.addHook("onRequest", async (r, t) => {
16
+ h && a.register(import("@fastify/cors"), h), a.addHook("onRequest", async (r, t) => {
17
17
  r.method === "POST" && (r.body = void 0);
18
18
  });
19
- const o = new j({
20
- drizzle: w,
21
- schema: x,
19
+ const n = new E({
20
+ drizzle: C,
21
+ schema: w,
22
22
  engineType: S
23
23
  });
24
- g.forEach((r) => {
25
- o.registerCube(r);
26
- }), a.post(`${d}/load`, {
27
- bodyLimit: b,
24
+ b.forEach((r) => {
25
+ n.registerCube(r);
26
+ }), a.post(`${c}/load`, {
27
+ bodyLimit: m,
28
28
  schema: {
29
29
  body: {
30
30
  type: "object",
@@ -33,21 +33,21 @@ const Q = function(a, C, p) {
33
33
  }
34
34
  }, async (r, t) => {
35
35
  try {
36
- const e = r.body, s = e.query || e, u = await y(r), n = o.validateQuery(s);
37
- if (!n.isValid)
38
- return t.status(400).send(i(
39
- `Query validation failed: ${n.errors.join(", ")}`,
36
+ const e = r.body, s = e.query || e, i = await y(r), u = n.validateQuery(s);
37
+ if (!u.isValid)
38
+ return t.status(400).send(o(
39
+ `Query validation failed: ${u.errors.join(", ")}`,
40
40
  400
41
41
  ));
42
- const c = await o.executeMultiCubeQuery(s, u);
43
- return q(s, c, o);
42
+ const d = await n.executeMultiCubeQuery(s, i);
43
+ return f(s, d, n);
44
44
  } catch (e) {
45
- return r.log.error(e, "Query execution error"), t.status(500).send(i(
45
+ return r.log.error(e, "Query execution error"), t.status(500).send(o(
46
46
  e instanceof Error ? e.message : "Query execution failed",
47
47
  500
48
48
  ));
49
49
  }
50
- }), a.get(`${d}/load`, {
50
+ }), a.get(`${c}/load`, {
51
51
  schema: {
52
52
  querystring: {
53
53
  type: "object",
@@ -64,37 +64,72 @@ const Q = function(a, C, p) {
64
64
  try {
65
65
  s = JSON.parse(e);
66
66
  } catch {
67
- return t.status(400).send(i(
67
+ return t.status(400).send(o(
68
68
  "Invalid JSON in query parameter",
69
69
  400
70
70
  ));
71
71
  }
72
- const u = await y(r), n = o.validateQuery(s);
73
- if (!n.isValid)
74
- return t.status(400).send(i(
75
- `Query validation failed: ${n.errors.join(", ")}`,
72
+ const i = await y(r), u = n.validateQuery(s);
73
+ if (!u.isValid)
74
+ return t.status(400).send(o(
75
+ `Query validation failed: ${u.errors.join(", ")}`,
76
76
  400
77
77
  ));
78
- const c = await o.executeMultiCubeQuery(s, u);
79
- return q(s, c, o);
78
+ const d = await n.executeMultiCubeQuery(s, i);
79
+ return f(s, d, n);
80
80
  } catch (e) {
81
- return r.log.error(e, "Query execution error"), t.status(500).send(i(
81
+ return r.log.error(e, "Query execution error"), t.status(500).send(o(
82
82
  e instanceof Error ? e.message : "Query execution failed",
83
83
  500
84
84
  ));
85
85
  }
86
- }), a.get(`${d}/meta`, async (r, t) => {
86
+ }), a.post(`${c}/batch`, {
87
+ bodyLimit: m,
88
+ schema: {
89
+ body: {
90
+ type: "object",
91
+ required: ["queries"],
92
+ properties: {
93
+ queries: {
94
+ type: "array",
95
+ items: { type: "object" }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }, async (r, t) => {
101
+ try {
102
+ const { queries: e } = r.body;
103
+ if (!e || !Array.isArray(e))
104
+ return t.status(400).send(o(
105
+ 'Request body must contain a "queries" array',
106
+ 400
107
+ ));
108
+ if (e.length === 0)
109
+ return t.status(400).send(o(
110
+ "Queries array cannot be empty",
111
+ 400
112
+ ));
113
+ const s = await y(r);
114
+ return await R(e, s, n);
115
+ } catch (e) {
116
+ return r.log.error(e, "Batch execution error"), t.status(500).send(o(
117
+ e instanceof Error ? e.message : "Batch execution failed",
118
+ 500
119
+ ));
120
+ }
121
+ }), a.get(`${c}/meta`, async (r, t) => {
87
122
  try {
88
- const e = o.getMetadata();
123
+ const e = n.getMetadata();
89
124
  return $(e);
90
125
  } catch (e) {
91
- return r.log.error(e, "Metadata error"), t.status(500).send(i(
126
+ return r.log.error(e, "Metadata error"), t.status(500).send(o(
92
127
  e instanceof Error ? e.message : "Failed to fetch metadata",
93
128
  500
94
129
  ));
95
130
  }
96
- }), a.post(`${d}/sql`, {
97
- bodyLimit: b,
131
+ }), a.post(`${c}/sql`, {
132
+ bodyLimit: m,
98
133
  schema: {
99
134
  body: {
100
135
  type: "object",
@@ -103,27 +138,27 @@ const Q = function(a, C, p) {
103
138
  }
104
139
  }, async (r, t) => {
105
140
  try {
106
- const e = r.body, s = await y(r), u = o.validateQuery(e);
107
- if (!u.isValid)
108
- return t.status(400).send(i(
109
- `Query validation failed: ${u.errors.join(", ")}`,
141
+ const e = r.body, s = await y(r), i = n.validateQuery(e);
142
+ if (!i.isValid)
143
+ return t.status(400).send(o(
144
+ `Query validation failed: ${i.errors.join(", ")}`,
110
145
  400
111
146
  ));
112
- const n = e.measures?.[0] || e.dimensions?.[0];
113
- if (!n)
114
- return t.status(400).send(i(
147
+ const u = e.measures?.[0] || e.dimensions?.[0];
148
+ if (!u)
149
+ return t.status(400).send(o(
115
150
  "No measures or dimensions specified",
116
151
  400
117
152
  ));
118
- const c = n.split(".")[0], m = await o.generateSQL(c, e, s);
119
- return h(e, m);
153
+ const d = u.split(".")[0], g = await n.generateSQL(d, e, s);
154
+ return q(e, g);
120
155
  } catch (e) {
121
- return r.log.error(e, "SQL generation error"), t.status(500).send(i(
156
+ return r.log.error(e, "SQL generation error"), t.status(500).send(o(
122
157
  e instanceof Error ? e.message : "SQL generation failed",
123
158
  500
124
159
  ));
125
160
  }
126
- }), a.get(`${d}/sql`, {
161
+ }), a.get(`${c}/sql`, {
127
162
  schema: {
128
163
  querystring: {
129
164
  type: "object",
@@ -135,28 +170,28 @@ const Q = function(a, C, p) {
135
170
  }
136
171
  }, async (r, t) => {
137
172
  try {
138
- const { query: e } = r.query, s = JSON.parse(e), u = await y(r), n = o.validateQuery(s);
139
- if (!n.isValid)
140
- return t.status(400).send(i(
141
- `Query validation failed: ${n.errors.join(", ")}`,
173
+ const { query: e } = r.query, s = JSON.parse(e), i = await y(r), u = n.validateQuery(s);
174
+ if (!u.isValid)
175
+ return t.status(400).send(o(
176
+ `Query validation failed: ${u.errors.join(", ")}`,
142
177
  400
143
178
  ));
144
- const c = s.measures?.[0] || s.dimensions?.[0];
145
- if (!c)
146
- return t.status(400).send(i(
179
+ const d = s.measures?.[0] || s.dimensions?.[0];
180
+ if (!d)
181
+ return t.status(400).send(o(
147
182
  "No measures or dimensions specified",
148
183
  400
149
184
  ));
150
- const m = c.split(".")[0], E = await o.generateSQL(m, s, u);
151
- return h(s, E);
185
+ const g = d.split(".")[0], j = await n.generateSQL(g, s, i);
186
+ return q(s, j);
152
187
  } catch (e) {
153
- return r.log.error(e, "SQL generation error"), t.status(500).send(i(
188
+ return r.log.error(e, "SQL generation error"), t.status(500).send(o(
154
189
  e instanceof Error ? e.message : "SQL generation failed",
155
190
  500
156
191
  ));
157
192
  }
158
- }), a.post(`${d}/dry-run`, {
159
- bodyLimit: b,
193
+ }), a.post(`${c}/dry-run`, {
194
+ bodyLimit: m,
160
195
  schema: {
161
196
  body: {
162
197
  type: "object",
@@ -165,15 +200,15 @@ const Q = function(a, C, p) {
165
200
  }
166
201
  }, async (r, t) => {
167
202
  try {
168
- const e = r.body, s = e.query || e, u = await y(r);
169
- return await v(s, u, o);
203
+ const e = r.body, s = e.query || e, i = await y(r);
204
+ return await Q(s, i, n);
170
205
  } catch (e) {
171
206
  return r.log.error(e, "Dry-run error"), t.status(400).send({
172
207
  error: e instanceof Error ? e.message : "Dry-run validation failed",
173
208
  valid: !1
174
209
  });
175
210
  }
176
- }), a.get(`${d}/dry-run`, {
211
+ }), a.get(`${c}/dry-run`, {
177
212
  schema: {
178
213
  querystring: {
179
214
  type: "object",
@@ -185,27 +220,27 @@ const Q = function(a, C, p) {
185
220
  }
186
221
  }, async (r, t) => {
187
222
  try {
188
- const { query: e } = r.query, s = JSON.parse(e), u = await y(r);
189
- return await v(s, u, o);
223
+ const { query: e } = r.query, s = JSON.parse(e), i = await y(r);
224
+ return await Q(s, i, n);
190
225
  } catch (e) {
191
226
  return r.log.error(e, "Dry-run error"), t.status(400).send({
192
227
  error: e instanceof Error ? e.message : "Dry-run validation failed",
193
228
  valid: !1
194
229
  });
195
230
  }
196
- }), a.setErrorHandler(async (r, t, e) => (t.log.error(r, "Fastify cube adapter error"), e.statusCode < 400 && e.status(500), i(r, e.statusCode))), p();
231
+ }), a.setErrorHandler(async (r, t, e) => (t.log.error(r, "Fastify cube adapter error"), e.statusCode < 400 && e.status(500), o(r, e.statusCode))), p();
197
232
  };
198
233
  async function L(l, a) {
199
- await l.register(Q, a);
234
+ await l.register(v, a);
200
235
  }
201
- function R(l) {
236
+ function N(l) {
202
237
  const a = require("fastify")({
203
238
  logger: !0
204
239
  });
205
- return a.register(Q, l), a;
240
+ return a.register(v, l), a;
206
241
  }
207
242
  export {
208
- R as createCubeApp,
209
- Q as cubePlugin,
243
+ N as createCubeApp,
244
+ v as cubePlugin,
210
245
  L as registerCubeRoutes
211
246
  };