drizzle-cube 0.4.13 → 0.4.14

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 (116) hide show
  1. package/README.md +1 -0
  2. package/dist/adapters/express/index.cjs +6 -6
  3. package/dist/adapters/express/index.js +73 -72
  4. package/dist/adapters/fastify/index.cjs +5 -5
  5. package/dist/adapters/fastify/index.js +110 -109
  6. package/dist/adapters/{handler-CQkIwtxp.js → handler-DZnCbydH.js} +719 -272
  7. package/dist/adapters/handler-ZDYlokiM.cjs +25 -0
  8. package/dist/adapters/hono/index.cjs +6 -6
  9. package/dist/adapters/hono/index.js +121 -120
  10. package/dist/adapters/nextjs/index.cjs +5 -5
  11. package/dist/adapters/nextjs/index.js +92 -91
  12. package/dist/client/charts.js +67 -59
  13. package/dist/client/charts.js.map +1 -1
  14. package/dist/client/chunks/{RetentionCombinedChart-CEI8KQ3t.js → RetentionCombinedChart-CLq89aOJ.js} +2 -2
  15. package/dist/client/chunks/{RetentionCombinedChart-CEI8KQ3t.js.map → RetentionCombinedChart-CLq89aOJ.js.map} +1 -1
  16. package/dist/client/chunks/{analysis-builder-BMmWeFPr.js → analysis-builder-C5e52Z3p.js} +419 -411
  17. package/dist/client/chunks/analysis-builder-C5e52Z3p.js.map +1 -0
  18. package/dist/client/chunks/{analysis-builder-shared-D56zYeV0.js → analysis-builder-shared-EnM-8plh.js} +2 -2
  19. package/dist/client/chunks/{analysis-builder-shared-D56zYeV0.js.map → analysis-builder-shared-EnM-8plh.js.map} +1 -1
  20. package/dist/client/chunks/{chart-activity-grid-CE7xGFQo.js → chart-activity-grid-CPGcTSuh.js} +2 -2
  21. package/dist/client/chunks/{chart-activity-grid-CE7xGFQo.js.map → chart-activity-grid-CPGcTSuh.js.map} +1 -1
  22. package/dist/client/chunks/{chart-area-BJAgusst.js → chart-area-ByJQ7NZd.js} +3 -3
  23. package/dist/client/chunks/{chart-area-BJAgusst.js.map → chart-area-ByJQ7NZd.js.map} +1 -1
  24. package/dist/client/chunks/{chart-bar-Blypx8O4.js → chart-bar-dj14frMt.js} +2 -2
  25. package/dist/client/chunks/{chart-bar-Blypx8O4.js.map → chart-bar-dj14frMt.js.map} +1 -1
  26. package/dist/client/chunks/chart-box-plot-ZatBpatq.js +322 -0
  27. package/dist/client/chunks/chart-box-plot-ZatBpatq.js.map +1 -0
  28. package/dist/client/chunks/{chart-bubble-Bf42A1-B.js → chart-bubble-CemotLx-.js} +2 -2
  29. package/dist/client/chunks/{chart-bubble-Bf42A1-B.js.map → chart-bubble-CemotLx-.js.map} +1 -1
  30. package/dist/client/chunks/chart-candlestick-BIR4uGGt.js +269 -0
  31. package/dist/client/chunks/chart-candlestick-BIR4uGGt.js.map +1 -0
  32. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js +38 -0
  33. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js.map +1 -0
  34. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js +70 -0
  35. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js.map +1 -0
  36. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js +64 -0
  37. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js.map +1 -0
  38. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js +70 -0
  39. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js.map +1 -0
  40. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js +60 -0
  41. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js.map +1 -0
  42. package/dist/client/chunks/{chart-data-table-Ba_6tuJw.js → chart-data-table-D5G8nMnb.js} +2 -2
  43. package/dist/client/chunks/{chart-data-table-Ba_6tuJw.js.map → chart-data-table-D5G8nMnb.js.map} +1 -1
  44. package/dist/client/chunks/{chart-funnel-C9kenCpp.js → chart-funnel-dofnhD24.js} +2 -2
  45. package/dist/client/chunks/{chart-funnel-C9kenCpp.js.map → chart-funnel-dofnhD24.js.map} +1 -1
  46. package/dist/client/chunks/chart-gauge-CKJJ8m3b.js +374 -0
  47. package/dist/client/chunks/chart-gauge-CKJJ8m3b.js.map +1 -0
  48. package/dist/client/chunks/{chart-heat-map-CYGemyPB.js → chart-heat-map-BVuPUKHT.js} +2 -2
  49. package/dist/client/chunks/{chart-heat-map-CYGemyPB.js.map → chart-heat-map-BVuPUKHT.js.map} +1 -1
  50. package/dist/client/chunks/{chart-kpi-delta-D9XJoKuA.js → chart-kpi-delta-Dgg2eYRl.js} +3 -3
  51. package/dist/client/chunks/{chart-kpi-delta-D9XJoKuA.js.map → chart-kpi-delta-Dgg2eYRl.js.map} +1 -1
  52. package/dist/client/chunks/{chart-kpi-number-C29Vj2g8.js → chart-kpi-number-DkoO99c1.js} +2 -2
  53. package/dist/client/chunks/{chart-kpi-number-C29Vj2g8.js.map → chart-kpi-number-DkoO99c1.js.map} +1 -1
  54. package/dist/client/chunks/{chart-kpi-text-CgjjrurK.js → chart-kpi-text-1O6_lmz7.js} +3 -3
  55. package/dist/client/chunks/{chart-kpi-text-CgjjrurK.js.map → chart-kpi-text-1O6_lmz7.js.map} +1 -1
  56. package/dist/client/chunks/{chart-line-zi6olZet.js → chart-line-DzyZkugh.js} +3 -3
  57. package/dist/client/chunks/{chart-line-zi6olZet.js.map → chart-line-DzyZkugh.js.map} +1 -1
  58. package/dist/client/chunks/chart-measure-profile-C2IkBG3V.js +114 -0
  59. package/dist/client/chunks/chart-measure-profile-C2IkBG3V.js.map +1 -0
  60. package/dist/client/chunks/{chart-pie-C4SuxKSN.js → chart-pie-akbfRfb9.js} +2 -2
  61. package/dist/client/chunks/{chart-pie-C4SuxKSN.js.map → chart-pie-akbfRfb9.js.map} +1 -1
  62. package/dist/client/chunks/{chart-radar-BW3Z_-Ly.js → chart-radar-BaN-Kjww.js} +2 -2
  63. package/dist/client/chunks/{chart-radar-BW3Z_-Ly.js.map → chart-radar-BaN-Kjww.js.map} +1 -1
  64. package/dist/client/chunks/{chart-radial-bar-0Fa3aeP5.js → chart-radial-bar-DpptEL3s.js} +2 -2
  65. package/dist/client/chunks/{chart-radial-bar-0Fa3aeP5.js.map → chart-radial-bar-DpptEL3s.js.map} +1 -1
  66. package/dist/client/chunks/{chart-sankey-DBghfbg1.js → chart-sankey-CG-3hHmX.js} +2 -2
  67. package/dist/client/chunks/{chart-sankey-DBghfbg1.js.map → chart-sankey-CG-3hHmX.js.map} +1 -1
  68. package/dist/client/chunks/{chart-scatter-DOVu1TNq.js → chart-scatter-l_yTVxF3.js} +2 -2
  69. package/dist/client/chunks/{chart-scatter-DOVu1TNq.js.map → chart-scatter-l_yTVxF3.js.map} +1 -1
  70. package/dist/client/chunks/{chart-sunburst-LfNthFlZ.js → chart-sunburst-KhDcKhmZ.js} +2 -2
  71. package/dist/client/chunks/{chart-sunburst-LfNthFlZ.js.map → chart-sunburst-KhDcKhmZ.js.map} +1 -1
  72. package/dist/client/chunks/{chart-tree-map-DZtQPyWX.js → chart-tree-map-CBbiaBXV.js} +2 -2
  73. package/dist/client/chunks/{chart-tree-map-DZtQPyWX.js.map → chart-tree-map-CBbiaBXV.js.map} +1 -1
  74. package/dist/client/chunks/chart-waterfall-CX3vx_lI.js +191 -0
  75. package/dist/client/chunks/chart-waterfall-CX3vx_lI.js.map +1 -0
  76. package/dist/client/chunks/{charts-core-DmGfleFz.js → charts-core-CU9u_HtL.js} +2 -1
  77. package/dist/client/chunks/charts-core-CU9u_HtL.js.map +1 -0
  78. package/dist/client/chunks/{charts-loader-CH0_S06T.js → charts-loader-AW3T1nv5.js} +58 -42
  79. package/dist/client/chunks/charts-loader-AW3T1nv5.js.map +1 -0
  80. package/dist/client/chunks/{components-ClQziOcT.js → components-BkeSy9xv.js} +4 -4
  81. package/dist/client/chunks/components-BkeSy9xv.js.map +1 -0
  82. package/dist/client/components/AgenticNotebook/AgentChatPanel.d.ts +10 -0
  83. package/dist/client/components/AgenticNotebook/ChatMessage.d.ts +2 -0
  84. package/dist/client/components/AgenticNotebook/index.d.ts +11 -1
  85. package/dist/client/components/LoadingIndicator.d.ts +2 -2
  86. package/dist/client/components/charts/BoxPlotChart.config.d.ts +1 -7
  87. package/dist/client/components/charts/CandlestickChart.config.d.ts +5 -0
  88. package/dist/client/components/charts/CandlestickChart.d.ts +4 -0
  89. package/dist/client/components/charts/GaugeChart.config.d.ts +5 -0
  90. package/dist/client/components/charts/GaugeChart.d.ts +4 -0
  91. package/dist/client/components/charts/MeasureProfileChart.config.d.ts +5 -0
  92. package/dist/client/components/charts/MeasureProfileChart.d.ts +4 -0
  93. package/dist/client/components/charts/WaterfallChart.config.d.ts +5 -0
  94. package/dist/client/components/charts/WaterfallChart.d.ts +4 -0
  95. package/dist/client/components/charts/index.d.ts +4 -0
  96. package/dist/client/components.js +1 -1
  97. package/dist/client/hooks/useAgentChat.d.ts +20 -2
  98. package/dist/client/index.js +583 -522
  99. package/dist/client/index.js.map +1 -1
  100. package/dist/client/styles.css +1 -1
  101. package/dist/client/types.d.ts +19 -1
  102. package/dist/client/utils.js +4 -4
  103. package/dist/client-bundle-stats.html +1 -1
  104. package/dist/server/index.cjs +47 -45
  105. package/dist/server/index.d.ts +37 -0
  106. package/dist/server/index.js +1745 -1298
  107. package/package.json +4 -1
  108. package/dist/adapters/handler-dnkqpznh.cjs +0 -23
  109. package/dist/client/chunks/analysis-builder-BMmWeFPr.js.map +0 -1
  110. package/dist/client/chunks/chart-box-plot-Dja4LS3O.js +0 -313
  111. package/dist/client/chunks/chart-box-plot-Dja4LS3O.js.map +0 -1
  112. package/dist/client/chunks/chart-config-box-plot-D3DA7_pr.js +0 -85
  113. package/dist/client/chunks/chart-config-box-plot-D3DA7_pr.js.map +0 -1
  114. package/dist/client/chunks/charts-core-DmGfleFz.js.map +0 -1
  115. package/dist/client/chunks/charts-loader-CH0_S06T.js.map +0 -1
  116. package/dist/client/chunks/components-ClQziOcT.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { NextResponse as t } from "next/server";
2
2
  import { e as T, s as A, v as D, b as P, a as _, n as Q, p as V, w as I, d as J, i as M, M as k, c as $, S as K } from "../mcp-transport-m1X1GtwG.js";
3
3
  import { formatErrorResponse as i, formatCubeResponse as z, formatMetaResponse as G, formatSqlResponse as U, handleDryRun as q, handleBatchRequest as B, handleDiscover as F, handleSuggest as X, handleValidate as W, handleLoad as Y } from "../utils.js";
4
- function x(n) {
4
+ function E(n) {
5
5
  const { cubes: a, drizzle: s, schema: c, engineType: d, cache: o } = n;
6
6
  if (!a || a.length === 0)
7
7
  throw new Error("At least one cube must be provided in the cubes array");
@@ -29,22 +29,22 @@ function ue(n) {
29
29
  };
30
30
  }
31
31
  function Z(n) {
32
- const { extractSecurityContext: a, cors: s } = n, c = x(n);
32
+ const { extractSecurityContext: a, cors: s } = n, c = E(n);
33
33
  return async function(o, r) {
34
34
  try {
35
35
  let e;
36
36
  if (o.method === "POST") {
37
- const E = await o.json();
38
- e = E.query || E;
37
+ const p = await o.json();
38
+ e = p.query || p;
39
39
  } else if (o.method === "GET") {
40
- const E = o.nextUrl.searchParams.get("query");
41
- if (!E)
40
+ const p = o.nextUrl.searchParams.get("query");
41
+ if (!p)
42
42
  return t.json(
43
43
  i("Query parameter is required", 400),
44
44
  { status: 400 }
45
45
  );
46
46
  try {
47
- e = JSON.parse(E);
47
+ e = JSON.parse(p);
48
48
  } catch {
49
49
  return t.json(
50
50
  i("Invalid JSON in query parameter", 400),
@@ -62,8 +62,8 @@ function Z(n) {
62
62
  i(`Query validation failed: ${y.errors.join(", ")}`, 400),
63
63
  { status: 400 }
64
64
  );
65
- const l = o.headers.get("x-cache-control") === "no-cache", f = await c.executeMultiCubeQuery(e, u, { skipCache: l }), w = z(e, f, c);
66
- return t.json(w, {
65
+ const l = o.headers.get("x-cache-control") === "no-cache", f = await c.executeMultiCubeQuery(e, u, { skipCache: l }), v = z(e, f, c);
66
+ return t.json(v, {
67
67
  headers: s ? g(o, s) : {}
68
68
  });
69
69
  } catch (e) {
@@ -78,7 +78,7 @@ function Z(n) {
78
78
  };
79
79
  }
80
80
  function ee(n) {
81
- const { cors: a } = n, s = x(n);
81
+ const { cors: a } = n, s = E(n);
82
82
  return async function(d, o) {
83
83
  try {
84
84
  const r = s.getMetadata(), e = G(r);
@@ -97,22 +97,22 @@ function ee(n) {
97
97
  };
98
98
  }
99
99
  function te(n) {
100
- const { extractSecurityContext: a, cors: s } = n, c = x(n);
100
+ const { extractSecurityContext: a, cors: s } = n, c = E(n);
101
101
  return async function(o, r) {
102
102
  try {
103
103
  let e;
104
104
  if (o.method === "POST") {
105
- const v = await o.json();
106
- e = v.query || v;
105
+ const C = await o.json();
106
+ e = C.query || C;
107
107
  } else if (o.method === "GET") {
108
- const v = o.nextUrl.searchParams.get("query");
109
- if (!v)
108
+ const C = o.nextUrl.searchParams.get("query");
109
+ if (!C)
110
110
  return t.json(
111
111
  i("Query parameter is required", 400),
112
112
  { status: 400 }
113
113
  );
114
114
  try {
115
- e = JSON.parse(v);
115
+ e = JSON.parse(C);
116
116
  } catch {
117
117
  return t.json(
118
118
  i("Invalid JSON in query parameter", 400),
@@ -136,8 +136,8 @@ function te(n) {
136
136
  i("No measures or dimensions specified", 400),
137
137
  { status: 400 }
138
138
  );
139
- const f = l.split(".")[0], w = await c.generateSQL(f, e, u), E = U(e, w);
140
- return t.json(E, {
139
+ const f = l.split(".")[0], v = await c.generateSQL(f, e, u), p = U(e, v);
140
+ return t.json(p, {
141
141
  headers: s ? g(o, s) : {}
142
142
  });
143
143
  } catch (e) {
@@ -152,7 +152,7 @@ function te(n) {
152
152
  };
153
153
  }
154
154
  function re(n) {
155
- const { extractSecurityContext: a, cors: s } = n, c = x(n);
155
+ const { extractSecurityContext: a, cors: s } = n, c = E(n);
156
156
  return async function(o, r) {
157
157
  try {
158
158
  let e;
@@ -195,7 +195,7 @@ function re(n) {
195
195
  };
196
196
  }
197
197
  function ne(n) {
198
- const { extractSecurityContext: a, cors: s } = n, c = x(n);
198
+ const { extractSecurityContext: a, cors: s } = n, c = E(n);
199
199
  return async function(o, r) {
200
200
  try {
201
201
  if (o.method !== "POST")
@@ -230,7 +230,7 @@ function ne(n) {
230
230
  };
231
231
  }
232
232
  function se(n) {
233
- const { extractSecurityContext: a, cors: s } = n, c = x(n);
233
+ const { extractSecurityContext: a, cors: s } = n, c = E(n);
234
234
  return async function(o, r) {
235
235
  try {
236
236
  if (o.method !== "POST")
@@ -244,12 +244,12 @@ function se(n) {
244
244
  { error: `Query validation failed: ${f.errors.join(", ")}` },
245
245
  { status: 400 }
246
246
  );
247
- const w = await c.explainQuery(
247
+ const v = await c.explainQuery(
248
248
  u,
249
249
  l,
250
250
  y
251
251
  );
252
- return t.json(w, {
252
+ return t.json(v, {
253
253
  headers: s ? g(o, s) : {}
254
254
  });
255
255
  } catch (e) {
@@ -261,7 +261,7 @@ function se(n) {
261
261
  };
262
262
  }
263
263
  function le(n) {
264
- const { cors: a } = n, s = x(n);
264
+ const { cors: a } = n, s = E(n);
265
265
  return async function(d, o) {
266
266
  try {
267
267
  if (d.method !== "POST")
@@ -285,7 +285,7 @@ function le(n) {
285
285
  };
286
286
  }
287
287
  function fe(n) {
288
- const { cors: a } = n, s = x(n);
288
+ const { cors: a } = n, s = E(n);
289
289
  return async function(d, o) {
290
290
  try {
291
291
  if (d.method !== "POST")
@@ -315,7 +315,7 @@ function fe(n) {
315
315
  };
316
316
  }
317
317
  function ye(n) {
318
- const { cors: a } = n, s = x(n);
318
+ const { cors: a } = n, s = E(n);
319
319
  return async function(d, o) {
320
320
  try {
321
321
  if (d.method !== "POST")
@@ -345,7 +345,7 @@ function ye(n) {
345
345
  };
346
346
  }
347
347
  function he(n) {
348
- const { extractSecurityContext: a, cors: s } = n, c = x(n);
348
+ const { extractSecurityContext: a, cors: s } = n, c = E(n);
349
349
  return async function(o, r) {
350
350
  try {
351
351
  if (o.method !== "POST")
@@ -375,7 +375,7 @@ function he(n) {
375
375
  };
376
376
  }
377
377
  function ae(n) {
378
- const { extractSecurityContext: a, cors: s, mcp: c = { enabled: !0 } } = n, d = x(n);
378
+ const { extractSecurityContext: a, cors: s, mcp: c = { enabled: !0 } } = n, d = E(n);
379
379
  return async function(r) {
380
380
  if (r.method === "DELETE")
381
381
  return t.json(
@@ -383,24 +383,24 @@ function ae(n) {
383
383
  { status: 405 }
384
384
  );
385
385
  if (r.method === "GET") {
386
- const m = new TextEncoder(), C = T(), h = new ReadableStream({
387
- start(j) {
388
- j.enqueue(m.encode(A({
386
+ const h = new TextEncoder(), S = T(), x = new ReadableStream({
387
+ start(m) {
388
+ m.enqueue(h.encode(A({
389
389
  jsonrpc: "2.0",
390
390
  method: "mcp/ready",
391
391
  params: { protocol: "streamable-http" }
392
- }, C, 15e3)));
392
+ }, S, 15e3)));
393
393
  }
394
- }), p = new Headers({
394
+ }), j = new Headers({
395
395
  "Content-Type": "text/event-stream",
396
396
  "Cache-Control": "no-cache",
397
397
  Connection: "keep-alive"
398
398
  });
399
399
  if (s) {
400
- const j = g(r, s);
401
- Object.entries(j).forEach(([S, H]) => p.set(S, H));
400
+ const m = g(r, s);
401
+ Object.entries(m).forEach(([w, N]) => j.set(w, N));
402
402
  }
403
- return new t(h, { status: 200, headers: p });
403
+ return new t(x, { status: 200, headers: j });
404
404
  }
405
405
  if (r.method !== "POST")
406
406
  return t.json(
@@ -440,70 +440,70 @@ function ae(n) {
440
440
  P(null, -32600, "Invalid JSON-RPC 2.0 request"),
441
441
  { status: 400 }
442
442
  );
443
- const w = I(u), E = f.method === "initialize", v = (m, C = 200, h = {}) => t.json(m, {
444
- status: C,
445
- headers: { ...s ? g(r, s) : {}, ...h }
443
+ const v = I(u), p = f.method === "initialize", C = (h, S = 200, x = {}) => t.json(h, {
444
+ status: S,
445
+ headers: { ...s ? g(r, s) : {}, ...x }
446
446
  });
447
447
  try {
448
- const m = await J(
448
+ const h = await J(
449
449
  f.method,
450
450
  f.params,
451
451
  {
452
452
  semanticLayer: d,
453
- extractSecurityContext: (j) => a(j),
453
+ extractSecurityContext: (m) => a(m),
454
454
  rawRequest: r,
455
455
  rawResponse: null
456
456
  }
457
457
  );
458
458
  if (M(f))
459
459
  return new t(null, { status: 202 });
460
- const C = E && m && typeof m == "object" && "sessionId" in m ? m.sessionId : void 0, h = {};
461
- C && (h[k] = C);
462
- const p = $(f.id ?? null, m);
463
- if (w) {
464
- const j = new TextEncoder(), S = T(), H = new ReadableStream({
465
- start(N) {
466
- N.enqueue(j.encode(`id: ${S}
460
+ const S = p && h && typeof h == "object" && "sessionId" in h ? h.sessionId : void 0, x = {};
461
+ S && (x[k] = S);
462
+ const j = $(f.id ?? null, h);
463
+ if (v) {
464
+ const m = new TextEncoder(), w = T(), N = new ReadableStream({
465
+ start(b) {
466
+ b.enqueue(m.encode(`id: ${w}
467
467
 
468
- `)), N.enqueue(j.encode(A(p, S))), N.close();
468
+ `)), b.enqueue(m.encode(A(j, w))), b.close();
469
469
  }
470
470
  }), O = new Headers({
471
471
  "Content-Type": "text/event-stream",
472
472
  "Cache-Control": "no-cache",
473
473
  Connection: "keep-alive",
474
- ...h
474
+ ...x
475
475
  });
476
476
  if (s) {
477
- const N = g(r, s);
478
- Object.entries(N).forEach(([b, R]) => O.set(b, R));
477
+ const b = g(r, s);
478
+ Object.entries(b).forEach(([H, R]) => O.set(H, R));
479
479
  }
480
- return new t(H, { status: 200, headers: O });
480
+ return new t(N, { status: 200, headers: O });
481
481
  }
482
- return v(p, 200, h);
483
- } catch (m) {
482
+ return C(j, 200, x);
483
+ } catch (h) {
484
484
  if (M(f))
485
- return process.env.NODE_ENV !== "test" && console.error("Next.js MCP notification processing error:", m), new t(null, { status: 202 });
486
- process.env.NODE_ENV !== "test" && console.error("Next.js MCP RPC handler error:", m);
487
- const C = m?.code ?? -32603, h = m?.data, p = m.message || "MCP request failed", j = P(f.id ?? null, C, p, h);
488
- if (w) {
489
- const S = new TextEncoder(), H = T(), O = new ReadableStream({
490
- start(b) {
491
- b.enqueue(S.encode(`id: ${H}
485
+ return process.env.NODE_ENV !== "test" && console.error("Next.js MCP notification processing error:", h), new t(null, { status: 202 });
486
+ process.env.NODE_ENV !== "test" && console.error("Next.js MCP RPC handler error:", h);
487
+ const S = h?.code ?? -32603, x = h?.data, j = h.message || "MCP request failed", m = P(f.id ?? null, S, j, x);
488
+ if (v) {
489
+ const w = new TextEncoder(), N = T(), O = new ReadableStream({
490
+ start(H) {
491
+ H.enqueue(w.encode(`id: ${N}
492
492
 
493
- `)), b.enqueue(S.encode(A(j, H))), b.close();
493
+ `)), H.enqueue(w.encode(A(m, N))), H.close();
494
494
  }
495
- }), N = new Headers({
495
+ }), b = new Headers({
496
496
  "Content-Type": "text/event-stream",
497
497
  "Cache-Control": "no-cache",
498
498
  Connection: "keep-alive"
499
499
  });
500
500
  if (s) {
501
- const b = g(r, s);
502
- Object.entries(b).forEach(([R, L]) => N.set(R, L));
501
+ const H = g(r, s);
502
+ Object.entries(H).forEach(([R, L]) => b.set(R, L));
503
503
  }
504
- return new t(O, { status: 200, headers: N });
504
+ return new t(O, { status: 200, headers: b });
505
505
  }
506
- return v(j, 200);
506
+ return C(m, 200);
507
507
  }
508
508
  };
509
509
  }
@@ -511,7 +511,7 @@ function oe(n) {
511
511
  const { extractSecurityContext: a, cors: s, agent: c } = n;
512
512
  if (!c)
513
513
  throw new Error("agent config is required for createAgentChatHandler");
514
- const d = x(n);
514
+ const d = E(n);
515
515
  return async function(r, e) {
516
516
  try {
517
517
  if (r.method !== "POST")
@@ -519,61 +519,62 @@ function oe(n) {
519
519
  { error: "Method not allowed - use POST" },
520
520
  { status: 405 }
521
521
  );
522
- const { handleAgentChat: u } = await import("../handler-CQkIwtxp.js"), y = await r.json(), { message: l, sessionId: f } = y;
522
+ const { handleAgentChat: u } = await import("../handler-DZnCbydH.js"), y = await r.json(), { message: l, sessionId: f, history: v } = y;
523
523
  if (!l || typeof l != "string")
524
524
  return t.json(
525
525
  { error: "message is required and must be a string" },
526
526
  { status: 400 }
527
527
  );
528
- let w = (c.apiKey || "").trim();
528
+ let p = (c.apiKey || "").trim();
529
529
  if (c.allowClientApiKey) {
530
- const h = r.headers.get("x-agent-api-key");
531
- h && (w = h.trim());
530
+ const j = r.headers.get("x-agent-api-key");
531
+ j && (p = j.trim());
532
532
  }
533
- if (!w)
533
+ if (!p)
534
534
  return t.json(
535
535
  { error: "No API key configured. Set agent.apiKey in server config or send X-Agent-Api-Key header." },
536
536
  { status: 401 }
537
537
  );
538
- const E = await a(r, e), v = new TextEncoder(), m = new ReadableStream({
539
- async start(h) {
538
+ const C = await a(r, e), h = new TextEncoder(), S = new ReadableStream({
539
+ async start(j) {
540
540
  try {
541
- const p = u({
541
+ const m = u({
542
542
  message: l,
543
543
  sessionId: f,
544
+ history: v,
544
545
  semanticLayer: d,
545
- securityContext: E,
546
+ securityContext: C,
546
547
  agentConfig: c,
547
- apiKey: w
548
+ apiKey: p
548
549
  });
549
- for await (const j of p) {
550
- const S = `data: ${JSON.stringify(j)}
550
+ for await (const w of m) {
551
+ const N = `data: ${JSON.stringify(w)}
551
552
 
552
553
  `;
553
- h.enqueue(v.encode(S));
554
+ j.enqueue(h.encode(N));
554
555
  }
555
- } catch (p) {
556
- const j = {
556
+ } catch (m) {
557
+ const w = {
557
558
  type: "error",
558
- data: { message: p instanceof Error ? p.message : "Stream failed" }
559
+ data: { message: m instanceof Error ? m.message : "Stream failed" }
559
560
  };
560
- h.enqueue(v.encode(`data: ${JSON.stringify(j)}
561
+ j.enqueue(h.encode(`data: ${JSON.stringify(w)}
561
562
 
562
563
  `));
563
564
  } finally {
564
- h.close();
565
+ j.close();
565
566
  }
566
567
  }
567
- }), C = new Headers({
568
+ }), x = new Headers({
568
569
  "Content-Type": "text/event-stream",
569
570
  "Cache-Control": "no-cache",
570
571
  Connection: "keep-alive"
571
572
  });
572
573
  if (s) {
573
- const h = g(r, s);
574
- Object.entries(h).forEach(([p, j]) => C.set(p, j));
574
+ const j = g(r, s);
575
+ Object.entries(j).forEach(([m, w]) => x.set(m, w));
575
576
  }
576
- return new Response(m, { status: 200, headers: C });
577
+ return new Response(S, { status: 200, headers: x });
577
578
  } catch (u) {
578
579
  return process.env.NODE_ENV !== "test" && console.error("Next.js agent chat handler error:", u), t.json(
579
580
  { error: u instanceof Error ? u.message : "Agent chat failed" },
@@ -1,17 +1,17 @@
1
- import { L as w, g as L, c as T, b as O, i as S, p as N, a as P } from "./chunks/charts-loader-CH0_S06T.js";
1
+ import { L as D, g as L, c as P, b as T, i as O, p as S, a as N } from "./chunks/charts-loader-AW3T1nv5.js";
2
2
  import { useState as f, useEffect as c } from "react";
3
3
  import { f as B } from "./chunks/index-CApFCBF9.js";
4
- import { c as M, C as E, N as H, P as I } from "./chunks/charts-core-DmGfleFz.js";
5
- import { B as _ } from "./chunks/chart-bar-Blypx8O4.js";
6
- import { L as j } from "./chunks/chart-line-zi6olZet.js";
7
- import { default as U } from "./chunks/chart-area-BJAgusst.js";
8
- import { default as Y } from "./chunks/chart-pie-C4SuxKSN.js";
9
- import { default as $ } from "./chunks/chart-scatter-DOVu1TNq.js";
10
- import { default as J } from "./chunks/chart-radar-BW3Z_-Ly.js";
11
- import { default as Q } from "./chunks/chart-radial-bar-0Fa3aeP5.js";
12
- import { default as tt } from "./chunks/chart-tree-map-DZtQPyWX.js";
13
- import { default as at } from "./chunks/chart-funnel-C9kenCpp.js";
14
- import { D as ot } from "./chunks/chart-data-table-Ba_6tuJw.js";
4
+ import { c as M, C as E, N as H, P as I } from "./chunks/charts-core-CU9u_HtL.js";
5
+ import { B as _ } from "./chunks/chart-bar-dj14frMt.js";
6
+ import { L as j } from "./chunks/chart-line-DzyZkugh.js";
7
+ import { default as U } from "./chunks/chart-area-ByJQ7NZd.js";
8
+ import { default as Y } from "./chunks/chart-pie-akbfRfb9.js";
9
+ import { default as $ } from "./chunks/chart-scatter-l_yTVxF3.js";
10
+ import { default as J } from "./chunks/chart-radar-BaN-Kjww.js";
11
+ import { default as Q } from "./chunks/chart-radial-bar-DpptEL3s.js";
12
+ import { default as ee } from "./chunks/chart-tree-map-CBbiaBXV.js";
13
+ import { default as ae } from "./chunks/chart-funnel-dofnhD24.js";
14
+ import { D as oe } from "./chunks/chart-data-table-D5G8nMnb.js";
15
15
  const s = {
16
16
  dropZones: [
17
17
  {
@@ -40,7 +40,7 @@ const s = {
40
40
  }
41
41
  ],
42
42
  displayOptions: ["showLegend", "showGrid", "showTooltip"]
43
- }, l = {
43
+ }, p = {
44
44
  bar: () => import("./chunks/chart-config-bar-C8uzktxl.js"),
45
45
  line: () => import("./chunks/chart-config-line-JNagi9tf.js"),
46
46
  area: () => import("./chunks/chart-config-area-CK_GVApT.js"),
@@ -62,8 +62,12 @@ const s = {
62
62
  heatmap: () => import("./chunks/chart-config-heat-map-_wEnTnRA.js"),
63
63
  retentionHeatmap: () => import("./chunks/RetentionHeatmap.config-BWf_-vdj.js"),
64
64
  retentionCombined: () => import("./chunks/RetentionCombinedChart.config-Bbp2ghim.js"),
65
- boxPlot: () => import("./chunks/chart-config-box-plot-D3DA7_pr.js")
66
- }, d = {
65
+ boxPlot: () => import("./chunks/chart-config-box-plot-D_E_SSc2.js"),
66
+ waterfall: () => import("./chunks/chart-config-waterfall-DTyXV_fo.js"),
67
+ candlestick: () => import("./chunks/chart-config-candlestick-CRCpD43-.js"),
68
+ measureProfile: () => import("./chunks/chart-config-measure-profile-ZYaMrtws.js"),
69
+ gauge: () => import("./chunks/chart-config-gauge-CQx9w3d4.js")
70
+ }, u = {
67
71
  bar: "barChartConfig",
68
72
  line: "lineChartConfig",
69
73
  area: "areaChartConfig",
@@ -85,58 +89,62 @@ const s = {
85
89
  heatmap: "heatmapChartConfig",
86
90
  retentionHeatmap: "retentionHeatmapConfig",
87
91
  retentionCombined: "retentionCombinedConfig",
88
- boxPlot: "boxPlotChartConfig"
92
+ boxPlot: "boxPlotChartConfig",
93
+ waterfall: "waterfallChartConfig",
94
+ candlestick: "candlestickChartConfig",
95
+ measureProfile: "measureProfileChartConfig",
96
+ gauge: "gaugeChartConfig"
89
97
  }, a = /* @__PURE__ */ new Map();
90
- async function p(t) {
91
- if (a.has(t))
92
- return a.get(t);
93
- const r = l[t];
98
+ async function l(e) {
99
+ if (a.has(e))
100
+ return a.get(e);
101
+ const r = p[e];
94
102
  if (!r)
95
103
  return null;
96
104
  try {
97
- const e = await r(), o = d[t], i = e[o];
98
- return i ? (a.set(t, i), i) : null;
99
- } catch (e) {
100
- return console.error(`Failed to load config for chart type: ${t}`, e), null;
105
+ const t = await r(), o = u[e], i = t[o];
106
+ return i ? (a.set(e, i), i) : null;
107
+ } catch (t) {
108
+ return console.error(`Failed to load config for chart type: ${e}`, t), null;
101
109
  }
102
110
  }
103
- function u(t) {
104
- return a.get(t) || s;
111
+ function d(e) {
112
+ return a.get(e) || s;
105
113
  }
106
- function b(t) {
107
- return a.has(t);
114
+ function b(e) {
115
+ return a.has(e);
108
116
  }
109
- function x(t) {
110
- const [r, e] = f(
111
- t ? u(t) : s
117
+ function x(e) {
118
+ const [r, t] = f(
119
+ e ? d(e) : s
112
120
  ), [o, i] = f(!1), [C, n] = f(!1);
113
121
  return c(() => {
114
- if (!t) {
115
- e(s), n(!1);
122
+ if (!e) {
123
+ t(s), n(!1);
116
124
  return;
117
125
  }
118
- if (a.has(t)) {
119
- e(a.get(t)), n(!0);
126
+ if (a.has(e)) {
127
+ t(a.get(e)), n(!0);
120
128
  return;
121
129
  }
122
- i(!0), p(t).then((m) => {
123
- m ? (e(m), n(!0)) : (e(s), n(!0));
130
+ i(!0), l(e).then((m) => {
131
+ m ? (t(m), n(!0)) : (t(s), n(!0));
124
132
  }).finally(() => i(!1));
125
- }, [t]), { config: r, loading: o, loaded: C };
133
+ }, [e]), { config: r, loading: o, loaded: C };
126
134
  }
127
- async function h(t) {
128
- a.has(t) || await p(t);
135
+ async function g(e) {
136
+ a.has(e) || await l(e);
129
137
  }
130
- async function y(t) {
131
- await Promise.all(t.map(h));
138
+ async function y(e) {
139
+ await Promise.all(e.map(g));
132
140
  }
133
141
  async function k() {
134
- const t = Object.keys(l);
135
- await Promise.all(t.map(p));
142
+ const e = Object.keys(p);
143
+ await Promise.all(e.map(l));
136
144
  const r = {};
137
- for (const e of t) {
138
- const o = a.get(e);
139
- o && (r[e] = o);
145
+ for (const t of e) {
146
+ const o = a.get(t);
147
+ o && (r[t] = o);
140
148
  }
141
149
  return r;
142
150
  }
@@ -146,9 +154,9 @@ function R() {
146
154
  export {
147
155
  M as CHART_COLORS,
148
156
  E as CHART_MARGINS,
149
- ot as DataTable,
150
- at as FunnelChart,
151
- w as LazyChart,
157
+ oe as DataTable,
158
+ ae as FunnelChart,
159
+ D as LazyChart,
152
160
  H as NEGATIVE_COLOR,
153
161
  I as POSITIVE_COLOR,
154
162
  U as RechartsAreaChart,
@@ -158,21 +166,21 @@ export {
158
166
  J as RechartsRadarChart,
159
167
  Q as RechartsRadialBarChart,
160
168
  $ as RechartsScatterChart,
161
- tt as RechartsTreeMapChart,
169
+ ee as RechartsTreeMapChart,
162
170
  R as clearChartConfigCache,
163
171
  B as formatChartData,
164
172
  L as getAvailableChartTypes,
165
- p as getChartConfigAsync,
166
- u as getChartConfigSync,
167
- T as getUnavailableChartTypes,
173
+ l as getChartConfigAsync,
174
+ d as getChartConfigSync,
175
+ P as getUnavailableChartTypes,
168
176
  b as isChartConfigLoaded,
169
- O as isChartTypeAvailable,
170
- S as isValidChartType,
177
+ T as isChartTypeAvailable,
178
+ O as isValidChartType,
171
179
  k as loadAllChartConfigs,
172
- N as preloadChart,
173
- h as preloadChartConfig,
180
+ S as preloadChart,
181
+ g as preloadChartConfig,
174
182
  y as preloadChartConfigs,
175
- P as preloadCharts,
183
+ N as preloadCharts,
176
184
  x as useChartConfig
177
185
  };
178
186
  //# sourceMappingURL=charts.js.map