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.
Files changed (53) hide show
  1. package/dist/adapters/{compiler-CPsEzFP2.js → compiler-CSr2Ti96.js} +553 -505
  2. package/dist/adapters/express/index.js +1 -1
  3. package/dist/adapters/fastify/index.js +1 -1
  4. package/dist/adapters/hono/index.js +1 -1
  5. package/dist/adapters/nextjs/index.js +50 -50
  6. package/dist/client/charts/chartConfigs.d.ts +31 -1
  7. package/dist/client/charts.d.ts +1 -0
  8. package/dist/client/charts.js +1 -1
  9. package/dist/client/chunks/charts-Dx3asDBi.js +2269 -0
  10. package/dist/client/chunks/charts-Dx3asDBi.js.map +1 -0
  11. package/dist/client/chunks/{icons-B5RVM-7b.js → icons-BMGOKdZb.js} +279 -239
  12. package/dist/client/chunks/icons-BMGOKdZb.js.map +1 -0
  13. package/dist/client/chunks/{providers-DI5zeeEU.js → providers-B7MVnAAt.js} +50 -50
  14. package/dist/client/chunks/providers-B7MVnAAt.js.map +1 -0
  15. package/dist/client/components/ChartConfigPanel.d.ts +3 -2
  16. package/dist/client/components/ColorPaletteSelector.d.ts +11 -0
  17. package/dist/client/components/DashboardGrid.d.ts +3 -1
  18. package/dist/client/components/DataHistogram.d.ts +23 -0
  19. package/dist/client/components/PortletEditModal.d.ts +3 -2
  20. package/dist/client/components/charts/ActivityGridChart.config.d.ts +5 -0
  21. package/dist/client/components/charts/ActivityGridChart.d.ts +2 -0
  22. package/dist/client/components/charts/AreaChart.d.ts +1 -1
  23. package/dist/client/components/charts/BarChart.d.ts +1 -1
  24. package/dist/client/components/charts/BubbleChart.d.ts +1 -1
  25. package/dist/client/components/charts/KpiNumber.config.d.ts +5 -0
  26. package/dist/client/components/charts/KpiNumber.d.ts +2 -0
  27. package/dist/client/components/charts/KpiText.config.d.ts +5 -0
  28. package/dist/client/components/charts/KpiText.d.ts +2 -0
  29. package/dist/client/components/charts/LineChart.d.ts +1 -1
  30. package/dist/client/components/charts/PieChart.d.ts +1 -1
  31. package/dist/client/components/charts/RadarChart.d.ts +1 -1
  32. package/dist/client/components/charts/RadialBarChart.d.ts +1 -1
  33. package/dist/client/components/charts/ScatterChart.d.ts +1 -1
  34. package/dist/client/components/charts/TreeMapChart.d.ts +1 -1
  35. package/dist/client/components/charts/index.d.ts +3 -0
  36. package/dist/client/components.js +5134 -2607
  37. package/dist/client/components.js.map +1 -1
  38. package/dist/client/hooks/useCubeMeta.d.ts +1 -0
  39. package/dist/client/hooks.js +62 -60
  40. package/dist/client/hooks.js.map +1 -1
  41. package/dist/client/index.d.ts +1 -0
  42. package/dist/client/index.js +2 -2
  43. package/dist/client/providers.js +1 -1
  44. package/dist/client/types.d.ts +17 -5
  45. package/dist/client/utils/colorPalettes.d.ts +35 -0
  46. package/dist/client-bundle-stats.html +1 -1
  47. package/dist/server/index.d.ts +3 -8
  48. package/dist/server/index.js +748 -700
  49. package/package.json +22 -1
  50. package/dist/client/chunks/charts-BadAUMmd.js +0 -2285
  51. package/dist/client/chunks/charts-BadAUMmd.js.map +0 -1
  52. package/dist/client/chunks/icons-B5RVM-7b.js.map +0 -1
  53. 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-CPsEzFP2.js";
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,4 +1,4 @@
1
- import { S as P, c as u, f as v, a as L, b as Q, h as C } from "../compiler-CPsEzFP2.js";
1
+ import { S as P, c as u, f as v, a as L, b as Q, h as C } from "../compiler-CSr2Ti96.js";
2
2
  const w = function(o, x, q) {
3
3
  const {
4
4
  cubes: b,
@@ -1,5 +1,5 @@
1
1
  import { Hono as x } from "hono";
2
- import { S as v, f as h, a as A, b as w, h as C } from "../compiler-CPsEzFP2.js";
2
+ import { S as v, f as h, a as A, b as w, h as C } from "../compiler-CSr2Ti96.js";
3
3
  var b = (d) => {
4
4
  const l = {
5
5
  ...{
@@ -1,39 +1,39 @@
1
1
  import { NextResponse as o } from "next/server";
2
- import { c as l, f as C, a as H, b as p, h as v, S as A } from "../compiler-CPsEzFP2.js";
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: n, schema: s, engineType: y } = t;
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 A({
8
- drizzle: n,
7
+ const r = new C({
8
+ drizzle: a,
9
9
  schema: s,
10
- engineType: y
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 n = t.headers.get("origin"), s = {};
18
- return e.origin && (typeof e.origin == "string" ? s["Access-Control-Allow-Origin"] = e.origin : Array.isArray(e.origin) ? n && e.origin.includes(n) && (s["Access-Control-Allow-Origin"] = n) : typeof e.origin == "function" && n && e.origin(n) && (s["Access-Control-Allow-Origin"] = n)), 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;
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(n) {
22
- const s = j(n, t);
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 b(t) {
30
- const { extractSecurityContext: e, cors: n } = t, s = g(t);
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 a;
33
+ let n;
34
34
  if (r.method === "POST") {
35
35
  const d = await r.json();
36
- a = d.query || d;
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
- a = JSON.parse(d);
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 f = await e(r, c), i = s.validateQuery(a);
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(a, f), m = C(a, u, s);
63
+ const u = await s.executeMultiCubeQuery(n, y), m = N(n, u, s);
64
64
  return o.json(m, {
65
- headers: n ? j(r, n) : {}
65
+ headers: a ? j(r, a) : {}
66
66
  });
67
- } catch (a) {
68
- return console.error("Next.js load handler error:", a), o.json(
67
+ } catch (n) {
68
+ return process.env.NODE_ENV !== "test" && console.error("Next.js load handler error:", n), o.json(
69
69
  l(
70
- a instanceof Error ? a.message : "Query execution failed",
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 E(t) {
79
- const { cors: e } = t, n = g(t);
80
- return async function(y, r) {
78
+ function A(t) {
79
+ const { cors: e } = t, a = g(t);
80
+ return async function(f, r) {
81
81
  try {
82
- const c = n.getMetadata(), a = H(c);
83
- return o.json(a, {
84
- headers: e ? j(y, e) : {}
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 N(t) {
98
- const { extractSecurityContext: e, cors: n } = t, s = g(t);
97
+ function b(t) {
98
+ const { extractSecurityContext: e, cors: a } = t, s = g(t);
99
99
  return async function(r, c) {
100
- var a, f;
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 = ((a = i.measures) == null ? void 0 : a[0]) || ((f = i.dimensions) == null ? void 0 : f[0]);
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), S = p(i, x);
139
- return o.json(S, {
140
- headers: n ? j(r, n) : {}
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: n } = t, s = g(t);
154
+ const { extractSecurityContext: e, cors: a } = t, s = g(t);
155
155
  return async function(r, c) {
156
156
  try {
157
- let a;
157
+ let n;
158
158
  if (r.method === "POST") {
159
159
  const u = await r.json();
160
- a = u.query || u;
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
- a = JSON.parse(u);
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 f = await e(r, c), i = await v(a, f, s);
181
+ const y = await e(r, c), i = await v(n, y, s);
182
182
  return o.json(i, {
183
- headers: n ? j(r, n) : {}
183
+ headers: a ? j(r, a) : {}
184
184
  });
185
- } catch (a) {
186
- return console.error("Next.js dry-run handler error:", a), o.json(
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: a instanceof Error ? a.message : "Dry-run validation failed",
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: b(t),
199
- meta: E(t),
200
- sql: N(t),
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
- b as createLoadHandler,
208
- E as createMetaHandler,
207
+ H as createLoadHandler,
208
+ A as createMetaHandler,
209
209
  P as createOptionsHandler,
210
- N as createSqlHandler
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
- /** Which display options to show for this chart type */
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;
@@ -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';
@@ -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-BadAUMmd.js";
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,