drizzle-cube 0.1.9 → 0.1.10

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.
@@ -1,6 +1,6 @@
1
1
  import { Hono as D } from "hono";
2
2
  var S = (q) => {
3
- const d = {
3
+ const c = {
4
4
  ...{
5
5
  origin: "*",
6
6
  allowMethods: ["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH"],
@@ -8,22 +8,22 @@ var S = (q) => {
8
8
  exposeHeaders: []
9
9
  },
10
10
  ...q
11
- }, A = /* @__PURE__ */ ((u) => typeof u == "string" ? u === "*" ? () => u : (n) => u === n ? n : null : typeof u == "function" ? u : (n) => u.includes(n) ? n : null)(d.origin), j = ((u) => typeof u == "function" ? u : Array.isArray(u) ? () => u : () => [])(d.allowMethods);
11
+ }, v = /* @__PURE__ */ ((u) => typeof u == "string" ? u === "*" ? () => u : (n) => u === n ? n : null : typeof u == "function" ? u : (n) => u.includes(n) ? n : null)(c.origin), j = ((u) => typeof u == "function" ? u : Array.isArray(u) ? () => u : () => [])(c.allowMethods);
12
12
  return async function(n, m) {
13
13
  var x;
14
14
  function p(h, f) {
15
15
  n.res.headers.set(h, f);
16
16
  }
17
- const b = A(n.req.header("origin") || "", n);
18
- if (b && p("Access-Control-Allow-Origin", b), d.origin !== "*") {
17
+ const b = v(n.req.header("origin") || "", n);
18
+ if (b && p("Access-Control-Allow-Origin", b), c.origin !== "*") {
19
19
  const h = n.req.header("Vary");
20
20
  h ? p("Vary", h) : p("Vary", "Origin");
21
21
  }
22
- if (d.credentials && p("Access-Control-Allow-Credentials", "true"), (x = d.exposeHeaders) != null && x.length && p("Access-Control-Expose-Headers", d.exposeHeaders.join(",")), n.req.method === "OPTIONS") {
23
- d.maxAge != null && p("Access-Control-Max-Age", d.maxAge.toString());
22
+ if (c.credentials && p("Access-Control-Allow-Credentials", "true"), (x = c.exposeHeaders) != null && x.length && p("Access-Control-Expose-Headers", c.exposeHeaders.join(",")), n.req.method === "OPTIONS") {
23
+ c.maxAge != null && p("Access-Control-Max-Age", c.maxAge.toString());
24
24
  const h = j(n.req.header("origin") || "", n);
25
25
  h.length && p("Access-Control-Allow-Methods", h.join(","));
26
- let f = d.allowHeaders;
26
+ let f = c.allowHeaders;
27
27
  if (!(f != null && f.length)) {
28
28
  const e = n.req.header("Access-Control-Request-Headers");
29
29
  e && (f = e.split(/\s*,\s*/));
@@ -40,13 +40,13 @@ var S = (q) => {
40
40
  function E(q) {
41
41
  const {
42
42
  semanticLayer: a,
43
- drizzle: d,
44
- schema: A,
43
+ drizzle: c,
44
+ schema: v,
45
45
  getSecurityContext: j,
46
46
  cors: u,
47
47
  basePath: n = "/cubejs-api/v1"
48
48
  } = q, m = new D();
49
- u && m.use("/*", S(u)), a.hasExecutor() || a.setDrizzle(d, A), m.post(`${n}/load`, async (e) => {
49
+ u && m.use("/*", S(u)), a.hasExecutor() || a.setDrizzle(c, v), m.post(`${n}/load`, async (e) => {
50
50
  try {
51
51
  const r = await e.req.json(), s = r.query || r, t = await j(e), o = a.validateQuery(s);
52
52
  if (!o.isValid)
@@ -88,7 +88,15 @@ function E(q) {
88
88
  return e.json({
89
89
  error: "Query parameter is required"
90
90
  }, 400);
91
- const s = JSON.parse(r), t = await j(e), o = a.validateQuery(s);
91
+ let s;
92
+ try {
93
+ s = JSON.parse(r);
94
+ } catch {
95
+ return e.json({
96
+ error: "Invalid JSON in query parameter"
97
+ }, 400);
98
+ }
99
+ const t = await j(e), o = a.validateQuery(s);
92
100
  if (!o.isValid)
93
101
  return e.json({
94
102
  error: `Query validation failed: ${o.errors.join(", ")}`
@@ -229,23 +237,23 @@ function E(q) {
229
237
  return "postgres";
230
238
  }
231
239
  async function f(e, r) {
232
- var y, g, Q, v;
240
+ var y, g, Q, A;
233
241
  const s = a.validateQuery(e);
234
242
  if (!s.isValid)
235
243
  throw new Error(`Query validation failed: ${s.errors.join(", ")}`);
236
244
  const t = /* @__PURE__ */ new Set();
237
- (y = e.measures) == null || y.forEach((c) => {
238
- const w = c.split(".")[0];
245
+ (y = e.measures) == null || y.forEach((d) => {
246
+ const w = d.split(".")[0];
239
247
  t.add(w);
240
- }), (g = e.dimensions) == null || g.forEach((c) => {
241
- const w = c.split(".")[0];
248
+ }), (g = e.dimensions) == null || g.forEach((d) => {
249
+ const w = d.split(".")[0];
242
250
  t.add(w);
243
- }), (Q = e.timeDimensions) == null || Q.forEach((c) => {
244
- const w = c.dimension.split(".")[0];
251
+ }), (Q = e.timeDimensions) == null || Q.forEach((d) => {
252
+ const w = d.dimension.split(".")[0];
245
253
  t.add(w);
246
- }), (v = e.filters) == null || v.forEach((c) => {
247
- if ("member" in c) {
248
- const w = c.member.split(".")[0];
254
+ }), (A = e.filters) == null || A.forEach((d) => {
255
+ if ("member" in d) {
256
+ const w = d.member.split(".")[0];
249
257
  t.add(w);
250
258
  }
251
259
  });
@@ -254,16 +262,16 @@ function E(q) {
254
262
  if (o)
255
263
  i = await a.generateMultiCubeSQL(e, r);
256
264
  else {
257
- const c = Array.from(t)[0];
258
- i = await a.generateSQL(c, e, r);
265
+ const d = Array.from(t)[0];
266
+ i = await a.generateSQL(d, e, r);
259
267
  }
260
- const l = Array.from(t).map((c) => {
268
+ const l = Array.from(t).map((d) => {
261
269
  var w, T;
262
270
  return {
263
- cube: c,
271
+ cube: d,
264
272
  query: {
265
- measures: ((w = e.measures) == null ? void 0 : w.filter((C) => C.startsWith(c + "."))) || [],
266
- dimensions: ((T = e.dimensions) == null ? void 0 : T.filter((C) => C.startsWith(c + "."))) || [],
273
+ measures: ((w = e.measures) == null ? void 0 : w.filter((C) => C.startsWith(d + "."))) || [],
274
+ dimensions: ((T = e.dimensions) == null ? void 0 : T.filter((C) => C.startsWith(d + "."))) || [],
267
275
  filters: e.filters || [],
268
276
  timeDimensions: e.timeDimensions || [],
269
277
  order: e.order || {},
@@ -321,15 +329,15 @@ function E(q) {
321
329
  }), m;
322
330
  }
323
331
  function M(q, a) {
324
- const d = E(a);
325
- return q.route("/", d), q;
332
+ const c = E(a);
333
+ return q.route("/", c), q;
326
334
  }
327
- function R(q) {
335
+ function N(q) {
328
336
  const a = new D();
329
337
  return M(a, q);
330
338
  }
331
339
  export {
332
- R as createCubeApp,
340
+ N as createCubeApp,
333
341
  E as createCubeRoutes,
334
342
  M as mountCubeRoutes
335
343
  };
@@ -3,7 +3,7 @@ export interface ModalProps {
3
3
  isOpen: boolean;
4
4
  onClose: () => void;
5
5
  title?: string;
6
- size?: 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'fullscreen';
6
+ size?: 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'fullscreen' | 'fullscreen-mobile';
7
7
  closeOnBackdropClick?: boolean;
8
8
  closeOnEscape?: boolean;
9
9
  showCloseButton?: boolean;