drizzle-cube 0.2.13 → 0.2.15

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 (158) hide show
  1. package/dist/adapters/compiler-A-Mz5Rzh.cjs +22 -0
  2. package/dist/adapters/{compiler-DrkCCzf0.js → compiler-CQq2_dSQ.js} +1677 -1540
  3. package/dist/adapters/express/index.cjs +1 -1
  4. package/dist/adapters/express/index.js +1 -1
  5. package/dist/adapters/fastify/index.cjs +1 -1
  6. package/dist/adapters/fastify/index.js +1 -1
  7. package/dist/adapters/hono/index.cjs +1 -1
  8. package/dist/adapters/hono/index.js +1 -1
  9. package/dist/adapters/nextjs/index.cjs +1 -1
  10. package/dist/adapters/nextjs/index.js +1 -1
  11. package/dist/client/charts.js +27 -36
  12. package/dist/client/charts.js.map +1 -1
  13. package/dist/client/chunks/charts-B8YMw1mi.js +7227 -0
  14. package/dist/client/chunks/charts-B8YMw1mi.js.map +1 -0
  15. package/dist/client/chunks/charts-amt7VOyw.js +277 -0
  16. package/dist/client/chunks/{charts-CHzWeaY1.js.map → charts-amt7VOyw.js.map} +1 -1
  17. package/dist/client/chunks/components-K3xrnHN-.js +13698 -0
  18. package/dist/client/chunks/components-K3xrnHN-.js.map +1 -0
  19. package/dist/client/chunks/core-Dkym7d1O.js +6 -0
  20. package/dist/client/chunks/core-Dkym7d1O.js.map +1 -0
  21. package/dist/client/chunks/{index-DlsvcKXf.js → index-B7NSVb33.js} +2 -2
  22. package/dist/client/chunks/{index-DlsvcKXf.js.map → index-B7NSVb33.js.map} +1 -1
  23. package/dist/client/chunks/javascript-DII1YQGr.js +659 -0
  24. package/dist/client/chunks/javascript-DII1YQGr.js.map +1 -0
  25. package/dist/client/components/AnalysisBuilder/AnalysisFilterItem.d.ts +1 -3
  26. package/dist/client/components/AnalysisBuilder/FilterConfigModal.d.ts +16 -0
  27. package/dist/client/components/AnalyticsPortlet.d.ts +2 -1
  28. package/dist/client/components/DashboardFilters/FilterEditModal.d.ts +1 -1
  29. package/dist/client/components/DashboardFilters/ReadOnlyFilterList.d.ts +1 -1
  30. package/dist/client/components/DashboardPortletCard.d.ts +3 -3
  31. package/dist/client/components/QueryBuilderShim.d.ts +3 -0
  32. package/dist/client/components/charts/ActivityGridChart.d.ts +3 -1
  33. package/dist/client/components/charts/AreaChart.d.ts +3 -1
  34. package/dist/client/components/charts/BarChart.d.ts +3 -1
  35. package/dist/client/components/charts/BubbleChart.d.ts +3 -1
  36. package/dist/client/components/charts/DataTable.d.ts +3 -1
  37. package/dist/client/components/charts/KpiDelta.d.ts +3 -1
  38. package/dist/client/components/charts/KpiNumber.d.ts +3 -1
  39. package/dist/client/components/charts/KpiText.d.ts +3 -1
  40. package/dist/client/components/charts/LineChart.d.ts +3 -1
  41. package/dist/client/components/charts/MarkdownChart.d.ts +3 -1
  42. package/dist/client/components/charts/PieChart.d.ts +3 -1
  43. package/dist/client/components/charts/RadarChart.d.ts +3 -1
  44. package/dist/client/components/charts/RadialBarChart.d.ts +3 -1
  45. package/dist/client/components/charts/ScatterChart.d.ts +3 -1
  46. package/dist/client/components/charts/TreeMapChart.d.ts +3 -1
  47. package/dist/client/components/{QueryBuilder → shared}/CubeMetaExplorer.d.ts +1 -1
  48. package/dist/client/components/{QueryBuilder → shared}/DateRangeFilter.d.ts +1 -1
  49. package/dist/client/components/{QueryBuilder → shared}/FilterBuilder.d.ts +1 -1
  50. package/dist/client/components/{QueryBuilder → shared}/FilterGroup.d.ts +1 -1
  51. package/dist/client/components/{QueryBuilder → shared}/FilterItem.d.ts +1 -1
  52. package/dist/client/components/{QueryBuilder → shared}/FilterValueSelector.d.ts +1 -1
  53. package/dist/client/components/{QueryBuilder → shared}/utils.d.ts +1 -1
  54. package/dist/client/components.d.ts +1 -1
  55. package/dist/client/components.js +2 -2
  56. package/dist/client/hooks/useCubeFieldLabel.d.ts +16 -0
  57. package/dist/client/hooks/useScrollDetection.d.ts +27 -0
  58. package/dist/client/hooks/useTheme.d.ts +11 -0
  59. package/dist/client/hooks.js +8 -8
  60. package/dist/client/icons.js +5 -5
  61. package/dist/client/index.d.ts +8 -3
  62. package/dist/client/index.js +50 -45
  63. package/dist/client/index.js.map +1 -1
  64. package/dist/client/providers/CubeApiProvider.d.ts +22 -0
  65. package/dist/client/providers/CubeFeaturesProvider.d.ts +15 -0
  66. package/dist/client/providers/CubeMetaProvider.d.ts +17 -0
  67. package/dist/client/providers/CubeProvider.d.ts +28 -8
  68. package/dist/client/providers.js +3 -3
  69. package/dist/client/shared/components/CodeBlock.d.ts +10 -0
  70. package/dist/client/shared/index.d.ts +1 -0
  71. package/dist/client/styles.css +1 -1
  72. package/dist/client/utils/chartUtils.d.ts +2 -2
  73. package/dist/client/utils/filterUtils.d.ts +15 -0
  74. package/dist/client/utils/index.d.ts +1 -0
  75. package/dist/client/{components/QueryBuilder → utils}/shareUtils.d.ts +1 -1
  76. package/dist/client/utils/syntaxHighlighting.d.ts +31 -0
  77. package/dist/client-bundle-stats.html +1 -1
  78. package/dist/server/index.cjs +16 -16
  79. package/dist/server/index.d.ts +50 -0
  80. package/dist/server/index.js +857 -729
  81. package/package.json +5 -1
  82. package/dist/adapters/compiler-CMwSRhTS.cjs +0 -22
  83. package/dist/client/chunks/chart-activitygridchart-CUGN9Xq9.js +0 -2622
  84. package/dist/client/chunks/chart-activitygridchart-CUGN9Xq9.js.map +0 -1
  85. package/dist/client/chunks/chart-activitygridchart-config-AVBoHdRn.js +0 -244
  86. package/dist/client/chunks/chart-activitygridchart-config-AVBoHdRn.js.map +0 -1
  87. package/dist/client/chunks/chart-areachart-B4tknnsY.js +0 -239
  88. package/dist/client/chunks/chart-areachart-B4tknnsY.js.map +0 -1
  89. package/dist/client/chunks/chart-areachart-config-D9pPUKHZ.js +0 -78
  90. package/dist/client/chunks/chart-areachart-config-D9pPUKHZ.js.map +0 -1
  91. package/dist/client/chunks/chart-axisformatcontrols-Ch_IYF94.js +0 -196
  92. package/dist/client/chunks/chart-axisformatcontrols-Ch_IYF94.js.map +0 -1
  93. package/dist/client/chunks/chart-barchart-D_op06r-.js +0 -216
  94. package/dist/client/chunks/chart-barchart-D_op06r-.js.map +0 -1
  95. package/dist/client/chunks/chart-barchart-config-iniz62ni.js +0 -71
  96. package/dist/client/chunks/chart-barchart-config-iniz62ni.js.map +0 -1
  97. package/dist/client/chunks/chart-bubblechart-BsaIXUbS.js +0 -214
  98. package/dist/client/chunks/chart-bubblechart-BsaIXUbS.js.map +0 -1
  99. package/dist/client/chunks/chart-bubblechart-config-yLq2oyR3.js +0 -72
  100. package/dist/client/chunks/chart-bubblechart-config-yLq2oyR3.js.map +0 -1
  101. package/dist/client/chunks/chart-chartcontainer-CdwzIKP1.js +0 -103
  102. package/dist/client/chunks/chart-chartcontainer-CdwzIKP1.js.map +0 -1
  103. package/dist/client/chunks/chart-charttooltip-Bx3I8jQv.js +0 -26
  104. package/dist/client/chunks/chart-charttooltip-Bx3I8jQv.js.map +0 -1
  105. package/dist/client/chunks/chart-datatable-C7MS9q4Y.js +0 -283
  106. package/dist/client/chunks/chart-datatable-C7MS9q4Y.js.map +0 -1
  107. package/dist/client/chunks/chart-datatable-config-DmEA3A-7.js +0 -29
  108. package/dist/client/chunks/chart-datatable-config-DmEA3A-7.js.map +0 -1
  109. package/dist/client/chunks/chart-kpidelta-7-KOmb3w.js +0 -436
  110. package/dist/client/chunks/chart-kpidelta-7-KOmb3w.js.map +0 -1
  111. package/dist/client/chunks/chart-kpidelta-config-DtSDG4Kl.js +0 -98
  112. package/dist/client/chunks/chart-kpidelta-config-DtSDG4Kl.js.map +0 -1
  113. package/dist/client/chunks/chart-kpinumber-HOPfcK2N.js +0 -398
  114. package/dist/client/chunks/chart-kpinumber-HOPfcK2N.js.map +0 -1
  115. package/dist/client/chunks/chart-kpinumber-config-Da2LFeKM.js +0 -76
  116. package/dist/client/chunks/chart-kpinumber-config-Da2LFeKM.js.map +0 -1
  117. package/dist/client/chunks/chart-kpitext-BZkC9u3A.js +0 -165
  118. package/dist/client/chunks/chart-kpitext-BZkC9u3A.js.map +0 -1
  119. package/dist/client/chunks/chart-kpitext-config-DjvigyfE.js +0 -48
  120. package/dist/client/chunks/chart-kpitext-config-DjvigyfE.js.map +0 -1
  121. package/dist/client/chunks/chart-linechart-DqFmLbRe.js +0 -198
  122. package/dist/client/chunks/chart-linechart-DqFmLbRe.js.map +0 -1
  123. package/dist/client/chunks/chart-linechart-config-DLVS2Zxc.js +0 -66
  124. package/dist/client/chunks/chart-linechart-config-DLVS2Zxc.js.map +0 -1
  125. package/dist/client/chunks/chart-markdownchart-9n_TemoB.js +0 -256
  126. package/dist/client/chunks/chart-markdownchart-9n_TemoB.js.map +0 -1
  127. package/dist/client/chunks/chart-markdownchart-config-CgOA3YSw.js +0 -61
  128. package/dist/client/chunks/chart-markdownchart-config-CgOA3YSw.js.map +0 -1
  129. package/dist/client/chunks/chart-piechart-CrXFd9pE.js +0 -127
  130. package/dist/client/chunks/chart-piechart-CrXFd9pE.js.map +0 -1
  131. package/dist/client/chunks/chart-piechart-config-DgwOeKHr.js +0 -39
  132. package/dist/client/chunks/chart-piechart-config-DgwOeKHr.js.map +0 -1
  133. package/dist/client/chunks/chart-radarchart-config-BAV8D5PR.js +0 -45
  134. package/dist/client/chunks/chart-radarchart-config-BAV8D5PR.js.map +0 -1
  135. package/dist/client/chunks/chart-radarchart-tar2GBkO.js +0 -131
  136. package/dist/client/chunks/chart-radarchart-tar2GBkO.js.map +0 -1
  137. package/dist/client/chunks/chart-radialbarchart-ab8Swtal.js +0 -120
  138. package/dist/client/chunks/chart-radialbarchart-ab8Swtal.js.map +0 -1
  139. package/dist/client/chunks/chart-radialbarchart-config-CKozBBEC.js +0 -38
  140. package/dist/client/chunks/chart-radialbarchart-config-CKozBBEC.js.map +0 -1
  141. package/dist/client/chunks/chart-scatterchart-BP06BeU5.js +0 -203
  142. package/dist/client/chunks/chart-scatterchart-BP06BeU5.js.map +0 -1
  143. package/dist/client/chunks/chart-scatterchart-config-UdHmbZ3s.js +0 -54
  144. package/dist/client/chunks/chart-scatterchart-config-UdHmbZ3s.js.map +0 -1
  145. package/dist/client/chunks/chart-treemapchart-DAiixITm.js +0 -265
  146. package/dist/client/chunks/chart-treemapchart-DAiixITm.js.map +0 -1
  147. package/dist/client/chunks/chart-treemapchart-config-D17VOwTM.js +0 -47
  148. package/dist/client/chunks/chart-treemapchart-config-D17VOwTM.js.map +0 -1
  149. package/dist/client/chunks/charts-CHzWeaY1.js +0 -286
  150. package/dist/client/chunks/components-DnM9CCUS.js +0 -13931
  151. package/dist/client/chunks/components-DnM9CCUS.js.map +0 -1
  152. package/dist/client/components/QueryBuilder/QueryAnalysisPanel.d.ts +0 -7
  153. package/dist/client/components/QueryBuilder/QueryPanel.d.ts +0 -4
  154. package/dist/client/components/QueryBuilder/ResultsPanel.d.ts +0 -4
  155. package/dist/client/components/QueryBuilder/SetupPanel.d.ts +0 -11
  156. package/dist/client/components/QueryBuilder/ShareWarningModal.d.ts +0 -9
  157. package/dist/client/components/QueryBuilder/index.d.ts +0 -3
  158. /package/dist/client/components/{QueryBuilder → shared}/DateRangeSelector.d.ts +0 -0
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("express"),v=require("cors"),o=require("../compiler-CMwSRhTS.cjs");function E(d){const{cubes:y,drizzle:p,schema:g,extractSecurityContext:l,engineType:h,cors:R,basePath:c="/cubejs-api/v1",jsonLimit:b="10mb"}=d;if(!y||y.length===0)throw new Error("At least one cube must be provided in the cubes array");const i=m.Router();R&&i.use(v(R)),i.use(m.json({limit:b})),i.use(m.urlencoded({extended:!0,limit:b}));const a=new o.SemanticLayerCompiler({drizzle:p,schema:g,engineType:h});return y.forEach(t=>{a.registerCube(t)}),i.post(`${c}/load`,async(t,r)=>{try{const e=t.body.query||t.body,s=await l(t,r),n=a.validateQuery(e);if(!n.isValid)return r.status(400).json(o.formatErrorResponse(`Query validation failed: ${n.errors.join(", ")}`,400));const u=await a.executeMultiCubeQuery(e,s);r.json(o.formatCubeResponse(e,u,a))}catch(e){console.error("Query execution error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"Query execution failed",500))}}),i.get(`${c}/load`,async(t,r)=>{try{const e=t.query.query;if(!e)return r.status(400).json(o.formatErrorResponse("Query parameter is required",400));let s;try{s=JSON.parse(e)}catch{return r.status(400).json(o.formatErrorResponse("Invalid JSON in query parameter",400))}const n=await l(t,r),u=a.validateQuery(s);if(!u.isValid)return r.status(400).json(o.formatErrorResponse(`Query validation failed: ${u.errors.join(", ")}`,400));const f=await a.executeMultiCubeQuery(s,n);r.json(o.formatCubeResponse(s,f,a))}catch(e){console.error("Query execution error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"Query execution failed",500))}}),i.post(`${c}/batch`,async(t,r)=>{try{const{queries:e}=t.body;if(!e||!Array.isArray(e))return r.status(400).json(o.formatErrorResponse('Request body must contain a "queries" array',400));if(e.length===0)return r.status(400).json(o.formatErrorResponse("Queries array cannot be empty",400));const s=await l(t,r),n=await o.handleBatchRequest(e,s,a);r.json(n)}catch(e){console.error("Batch execution error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"Batch execution failed",500))}}),i.get(`${c}/meta`,(t,r)=>{try{const e=a.getMetadata();r.json(o.formatMetaResponse(e))}catch(e){console.error("Metadata error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"Failed to fetch metadata",500))}}),i.post(`${c}/sql`,async(t,r)=>{try{const e=t.body,s=await l(t,r),n=a.validateQuery(e);if(!n.isValid)return r.status(400).json(o.formatErrorResponse(`Query validation failed: ${n.errors.join(", ")}`,400));const u=e.measures?.[0]||e.dimensions?.[0];if(!u)return r.status(400).json(o.formatErrorResponse("No measures or dimensions specified",400));const f=u.split(".")[0],j=await a.generateSQL(f,e,s);r.json(o.formatSqlResponse(e,j))}catch(e){console.error("SQL generation error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"SQL generation failed",500))}}),i.get(`${c}/sql`,async(t,r)=>{try{const e=t.query.query;if(!e)return r.status(400).json(o.formatErrorResponse("Query parameter is required",400));const s=JSON.parse(e),n=await l(t,r),u=a.validateQuery(s);if(!u.isValid)return r.status(400).json(o.formatErrorResponse(`Query validation failed: ${u.errors.join(", ")}`,400));const f=s.measures?.[0]||s.dimensions?.[0];if(!f)return r.status(400).json(o.formatErrorResponse("No measures or dimensions specified",400));const j=f.split(".")[0],Q=await a.generateSQL(j,s,n);r.json(o.formatSqlResponse(s,Q))}catch(e){console.error("SQL generation error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"SQL generation failed",500))}}),i.post(`${c}/dry-run`,async(t,r)=>{try{const e=t.body.query||t.body,s=await l(t,r),n=await o.handleDryRun(e,s,a);r.json(n)}catch(e){console.error("Dry-run error:",e),r.status(400).json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1})}}),i.get(`${c}/dry-run`,async(t,r)=>{try{const e=t.query.query;if(!e)return r.status(400).json({error:"Query parameter is required",valid:!1});const s=JSON.parse(e),n=await l(t,r),u=await o.handleDryRun(s,n,a);r.json(u)}catch(e){console.error("Dry-run error:",e),r.status(400).json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1})}}),i.use((t,r,e,s)=>{console.error("Express adapter error:",t),e.headersSent||e.status(500).json(o.formatErrorResponse(t,500))}),i}function q(d,y){const p=E(y);return d.use("/",p),d}function x(d){const y=m();return q(y,d)}exports.createCubeApp=x;exports.createCubeRouter=E;exports.mountCubeRoutes=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("express"),v=require("cors"),o=require("../compiler-A-Mz5Rzh.cjs");function E(d){const{cubes:y,drizzle:p,schema:g,extractSecurityContext:l,engineType:h,cors:R,basePath:c="/cubejs-api/v1",jsonLimit:b="10mb"}=d;if(!y||y.length===0)throw new Error("At least one cube must be provided in the cubes array");const i=m.Router();R&&i.use(v(R)),i.use(m.json({limit:b})),i.use(m.urlencoded({extended:!0,limit:b}));const a=new o.SemanticLayerCompiler({drizzle:p,schema:g,engineType:h});return y.forEach(t=>{a.registerCube(t)}),i.post(`${c}/load`,async(t,r)=>{try{const e=t.body.query||t.body,s=await l(t,r),n=a.validateQuery(e);if(!n.isValid)return r.status(400).json(o.formatErrorResponse(`Query validation failed: ${n.errors.join(", ")}`,400));const u=await a.executeMultiCubeQuery(e,s);r.json(o.formatCubeResponse(e,u,a))}catch(e){console.error("Query execution error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"Query execution failed",500))}}),i.get(`${c}/load`,async(t,r)=>{try{const e=t.query.query;if(!e)return r.status(400).json(o.formatErrorResponse("Query parameter is required",400));let s;try{s=JSON.parse(e)}catch{return r.status(400).json(o.formatErrorResponse("Invalid JSON in query parameter",400))}const n=await l(t,r),u=a.validateQuery(s);if(!u.isValid)return r.status(400).json(o.formatErrorResponse(`Query validation failed: ${u.errors.join(", ")}`,400));const f=await a.executeMultiCubeQuery(s,n);r.json(o.formatCubeResponse(s,f,a))}catch(e){console.error("Query execution error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"Query execution failed",500))}}),i.post(`${c}/batch`,async(t,r)=>{try{const{queries:e}=t.body;if(!e||!Array.isArray(e))return r.status(400).json(o.formatErrorResponse('Request body must contain a "queries" array',400));if(e.length===0)return r.status(400).json(o.formatErrorResponse("Queries array cannot be empty",400));const s=await l(t,r),n=await o.handleBatchRequest(e,s,a);r.json(n)}catch(e){console.error("Batch execution error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"Batch execution failed",500))}}),i.get(`${c}/meta`,(t,r)=>{try{const e=a.getMetadata();r.json(o.formatMetaResponse(e))}catch(e){console.error("Metadata error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"Failed to fetch metadata",500))}}),i.post(`${c}/sql`,async(t,r)=>{try{const e=t.body,s=await l(t,r),n=a.validateQuery(e);if(!n.isValid)return r.status(400).json(o.formatErrorResponse(`Query validation failed: ${n.errors.join(", ")}`,400));const u=e.measures?.[0]||e.dimensions?.[0];if(!u)return r.status(400).json(o.formatErrorResponse("No measures or dimensions specified",400));const f=u.split(".")[0],j=await a.generateSQL(f,e,s);r.json(o.formatSqlResponse(e,j))}catch(e){console.error("SQL generation error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"SQL generation failed",500))}}),i.get(`${c}/sql`,async(t,r)=>{try{const e=t.query.query;if(!e)return r.status(400).json(o.formatErrorResponse("Query parameter is required",400));const s=JSON.parse(e),n=await l(t,r),u=a.validateQuery(s);if(!u.isValid)return r.status(400).json(o.formatErrorResponse(`Query validation failed: ${u.errors.join(", ")}`,400));const f=s.measures?.[0]||s.dimensions?.[0];if(!f)return r.status(400).json(o.formatErrorResponse("No measures or dimensions specified",400));const j=f.split(".")[0],Q=await a.generateSQL(j,s,n);r.json(o.formatSqlResponse(s,Q))}catch(e){console.error("SQL generation error:",e),r.status(500).json(o.formatErrorResponse(e instanceof Error?e.message:"SQL generation failed",500))}}),i.post(`${c}/dry-run`,async(t,r)=>{try{const e=t.body.query||t.body,s=await l(t,r),n=await o.handleDryRun(e,s,a);r.json(n)}catch(e){console.error("Dry-run error:",e),r.status(400).json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1})}}),i.get(`${c}/dry-run`,async(t,r)=>{try{const e=t.query.query;if(!e)return r.status(400).json({error:"Query parameter is required",valid:!1});const s=JSON.parse(e),n=await l(t,r),u=await o.handleDryRun(s,n,a);r.json(u)}catch(e){console.error("Dry-run error:",e),r.status(400).json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1})}}),i.use((t,r,e,s)=>{console.error("Express adapter error:",t),e.headersSent||e.status(500).json(o.formatErrorResponse(t,500))}),i}function q(d,y){const p=E(y);return d.use("/",p),d}function x(d){const y=m();return q(y,d)}exports.createCubeApp=x;exports.createCubeRouter=E;exports.mountCubeRoutes=q;
@@ -1,6 +1,6 @@
1
1
  import p, { Router as C } from "express";
2
2
  import S from "cors";
3
- import { S as R, d as o, f as g, h as E, a as $, b as Q, c as q } from "../compiler-DrkCCzf0.js";
3
+ import { S as R, d as o, f as g, h as E, a as $, b as Q, c as q } from "../compiler-CQq2_dSQ.js";
4
4
  function L(d) {
5
5
  const {
6
6
  cubes: y,
@@ -1 +1 @@
1
- "use strict";var S=Object.create;var q=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var $=(n,s,m,g)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of x(s))!P.call(n,d)&&d!==m&&q(n,d,{get:()=>s[d],enumerable:!(g=w(s,d))||g.enumerable});return n};var L=(n,s,m)=>(m=n!=null?S(j(n)):{},$(s||!n||!n.__esModule?q(m,"default",{value:n,enumerable:!0}):m,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../compiler-CMwSRhTS.cjs"),h=function(s,m,g){const{cubes:d,drizzle:E,schema:v,extractSecurityContext:p,engineType:C,cors:R,basePath:y="/cubejs-api/v1",bodyLimit:b=10485760}=m;if(!d||d.length===0)return g(new Error("At least one cube must be provided in the cubes array"));R&&s.register(import("@fastify/cors"),R),s.addHook("onRequest",async(e,t)=>{e.method==="POST"&&(e.body=void 0)});const i=new o.SemanticLayerCompiler({drizzle:E,schema:v,engineType:C});d.forEach(e=>{i.registerCube(e)}),s.post(`${y}/load`,{bodyLimit:b,schema:{body:{type:"object",additionalProperties:!0}}},async(e,t)=>{try{const r=e.body,a=r.query||r,u=await p(e),c=i.validateQuery(a);if(!c.isValid)return t.status(400).send(o.formatErrorResponse(`Query validation failed: ${c.errors.join(", ")}`,400));const l=await i.executeMultiCubeQuery(a,u);return o.formatCubeResponse(a,l,i)}catch(r){return e.log.error(r,"Query execution error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"Query execution failed",500))}}),s.get(`${y}/load`,{schema:{querystring:{type:"object",properties:{query:{type:"string"}},required:["query"]}}},async(e,t)=>{try{const{query:r}=e.query;let a;try{a=JSON.parse(r)}catch{return t.status(400).send(o.formatErrorResponse("Invalid JSON in query parameter",400))}const u=await p(e),c=i.validateQuery(a);if(!c.isValid)return t.status(400).send(o.formatErrorResponse(`Query validation failed: ${c.errors.join(", ")}`,400));const l=await i.executeMultiCubeQuery(a,u);return o.formatCubeResponse(a,l,i)}catch(r){return e.log.error(r,"Query execution error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"Query execution failed",500))}}),s.post(`${y}/batch`,{bodyLimit:b,schema:{body:{type:"object",required:["queries"],properties:{queries:{type:"array",items:{type:"object"}}}}}},async(e,t)=>{try{const{queries:r}=e.body;if(!r||!Array.isArray(r))return t.status(400).send(o.formatErrorResponse('Request body must contain a "queries" array',400));if(r.length===0)return t.status(400).send(o.formatErrorResponse("Queries array cannot be empty",400));const a=await p(e);return await o.handleBatchRequest(r,a,i)}catch(r){return e.log.error(r,"Batch execution error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"Batch execution failed",500))}}),s.get(`${y}/meta`,async(e,t)=>{try{const r=i.getMetadata();return o.formatMetaResponse(r)}catch(r){return e.log.error(r,"Metadata error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"Failed to fetch metadata",500))}}),s.post(`${y}/sql`,{bodyLimit:b,schema:{body:{type:"object",additionalProperties:!0}}},async(e,t)=>{try{const r=e.body,a=await p(e),u=i.validateQuery(r);if(!u.isValid)return t.status(400).send(o.formatErrorResponse(`Query validation failed: ${u.errors.join(", ")}`,400));const c=r.measures?.[0]||r.dimensions?.[0];if(!c)return t.status(400).send(o.formatErrorResponse("No measures or dimensions specified",400));const l=c.split(".")[0],f=await i.generateSQL(l,r,a);return o.formatSqlResponse(r,f)}catch(r){return e.log.error(r,"SQL generation error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"SQL generation failed",500))}}),s.get(`${y}/sql`,{schema:{querystring:{type:"object",properties:{query:{type:"string"}},required:["query"]}}},async(e,t)=>{try{const{query:r}=e.query,a=JSON.parse(r),u=await p(e),c=i.validateQuery(a);if(!c.isValid)return t.status(400).send(o.formatErrorResponse(`Query validation failed: ${c.errors.join(", ")}`,400));const l=a.measures?.[0]||a.dimensions?.[0];if(!l)return t.status(400).send(o.formatErrorResponse("No measures or dimensions specified",400));const f=l.split(".")[0],Q=await i.generateSQL(f,a,u);return o.formatSqlResponse(a,Q)}catch(r){return e.log.error(r,"SQL generation error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"SQL generation failed",500))}}),s.post(`${y}/dry-run`,{bodyLimit:b,schema:{body:{type:"object",additionalProperties:!0}}},async(e,t)=>{try{const r=e.body,a=r.query||r,u=await p(e);return await o.handleDryRun(a,u,i)}catch(r){return e.log.error(r,"Dry-run error"),t.status(400).send({error:r instanceof Error?r.message:"Dry-run validation failed",valid:!1})}}),s.get(`${y}/dry-run`,{schema:{querystring:{type:"object",properties:{query:{type:"string"}},required:["query"]}}},async(e,t)=>{try{const{query:r}=e.query,a=JSON.parse(r),u=await p(e);return await o.handleDryRun(a,u,i)}catch(r){return e.log.error(r,"Dry-run error"),t.status(400).send({error:r instanceof Error?r.message:"Dry-run validation failed",valid:!1})}}),s.setErrorHandler(async(e,t,r)=>{t.log.error(e,"Fastify cube adapter error"),r.statusCode<400&&r.status(500);const a=e instanceof Error?e:String(e);return o.formatErrorResponse(a,r.statusCode)}),g()};async function M(n,s){await n.register(h,s)}function N(n){const s=require("fastify")({logger:!0});return s.register(h,n),s}exports.createCubeApp=N;exports.cubePlugin=h;exports.registerCubeRoutes=M;
1
+ "use strict";var S=Object.create;var q=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var $=(n,s,m,g)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of x(s))!P.call(n,d)&&d!==m&&q(n,d,{get:()=>s[d],enumerable:!(g=w(s,d))||g.enumerable});return n};var L=(n,s,m)=>(m=n!=null?S(j(n)):{},$(s||!n||!n.__esModule?q(m,"default",{value:n,enumerable:!0}):m,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../compiler-A-Mz5Rzh.cjs"),h=function(s,m,g){const{cubes:d,drizzle:E,schema:v,extractSecurityContext:p,engineType:C,cors:R,basePath:y="/cubejs-api/v1",bodyLimit:b=10485760}=m;if(!d||d.length===0)return g(new Error("At least one cube must be provided in the cubes array"));R&&s.register(import("@fastify/cors"),R),s.addHook("onRequest",async(e,t)=>{e.method==="POST"&&(e.body=void 0)});const i=new o.SemanticLayerCompiler({drizzle:E,schema:v,engineType:C});d.forEach(e=>{i.registerCube(e)}),s.post(`${y}/load`,{bodyLimit:b,schema:{body:{type:"object",additionalProperties:!0}}},async(e,t)=>{try{const r=e.body,a=r.query||r,u=await p(e),c=i.validateQuery(a);if(!c.isValid)return t.status(400).send(o.formatErrorResponse(`Query validation failed: ${c.errors.join(", ")}`,400));const l=await i.executeMultiCubeQuery(a,u);return o.formatCubeResponse(a,l,i)}catch(r){return e.log.error(r,"Query execution error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"Query execution failed",500))}}),s.get(`${y}/load`,{schema:{querystring:{type:"object",properties:{query:{type:"string"}},required:["query"]}}},async(e,t)=>{try{const{query:r}=e.query;let a;try{a=JSON.parse(r)}catch{return t.status(400).send(o.formatErrorResponse("Invalid JSON in query parameter",400))}const u=await p(e),c=i.validateQuery(a);if(!c.isValid)return t.status(400).send(o.formatErrorResponse(`Query validation failed: ${c.errors.join(", ")}`,400));const l=await i.executeMultiCubeQuery(a,u);return o.formatCubeResponse(a,l,i)}catch(r){return e.log.error(r,"Query execution error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"Query execution failed",500))}}),s.post(`${y}/batch`,{bodyLimit:b,schema:{body:{type:"object",required:["queries"],properties:{queries:{type:"array",items:{type:"object"}}}}}},async(e,t)=>{try{const{queries:r}=e.body;if(!r||!Array.isArray(r))return t.status(400).send(o.formatErrorResponse('Request body must contain a "queries" array',400));if(r.length===0)return t.status(400).send(o.formatErrorResponse("Queries array cannot be empty",400));const a=await p(e);return await o.handleBatchRequest(r,a,i)}catch(r){return e.log.error(r,"Batch execution error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"Batch execution failed",500))}}),s.get(`${y}/meta`,async(e,t)=>{try{const r=i.getMetadata();return o.formatMetaResponse(r)}catch(r){return e.log.error(r,"Metadata error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"Failed to fetch metadata",500))}}),s.post(`${y}/sql`,{bodyLimit:b,schema:{body:{type:"object",additionalProperties:!0}}},async(e,t)=>{try{const r=e.body,a=await p(e),u=i.validateQuery(r);if(!u.isValid)return t.status(400).send(o.formatErrorResponse(`Query validation failed: ${u.errors.join(", ")}`,400));const c=r.measures?.[0]||r.dimensions?.[0];if(!c)return t.status(400).send(o.formatErrorResponse("No measures or dimensions specified",400));const l=c.split(".")[0],f=await i.generateSQL(l,r,a);return o.formatSqlResponse(r,f)}catch(r){return e.log.error(r,"SQL generation error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"SQL generation failed",500))}}),s.get(`${y}/sql`,{schema:{querystring:{type:"object",properties:{query:{type:"string"}},required:["query"]}}},async(e,t)=>{try{const{query:r}=e.query,a=JSON.parse(r),u=await p(e),c=i.validateQuery(a);if(!c.isValid)return t.status(400).send(o.formatErrorResponse(`Query validation failed: ${c.errors.join(", ")}`,400));const l=a.measures?.[0]||a.dimensions?.[0];if(!l)return t.status(400).send(o.formatErrorResponse("No measures or dimensions specified",400));const f=l.split(".")[0],Q=await i.generateSQL(f,a,u);return o.formatSqlResponse(a,Q)}catch(r){return e.log.error(r,"SQL generation error"),t.status(500).send(o.formatErrorResponse(r instanceof Error?r.message:"SQL generation failed",500))}}),s.post(`${y}/dry-run`,{bodyLimit:b,schema:{body:{type:"object",additionalProperties:!0}}},async(e,t)=>{try{const r=e.body,a=r.query||r,u=await p(e);return await o.handleDryRun(a,u,i)}catch(r){return e.log.error(r,"Dry-run error"),t.status(400).send({error:r instanceof Error?r.message:"Dry-run validation failed",valid:!1})}}),s.get(`${y}/dry-run`,{schema:{querystring:{type:"object",properties:{query:{type:"string"}},required:["query"]}}},async(e,t)=>{try{const{query:r}=e.query,a=JSON.parse(r),u=await p(e);return await o.handleDryRun(a,u,i)}catch(r){return e.log.error(r,"Dry-run error"),t.status(400).send({error:r instanceof Error?r.message:"Dry-run validation failed",valid:!1})}}),s.setErrorHandler(async(e,t,r)=>{t.log.error(e,"Fastify cube adapter error"),r.statusCode<400&&r.status(500);const a=e instanceof Error?e:String(e);return o.formatErrorResponse(a,r.statusCode)}),g()};async function M(n,s){await n.register(h,s)}function N(n){const s=require("fastify")({logger:!0});return s.register(h,n),s}exports.createCubeApp=N;exports.cubePlugin=h;exports.registerCubeRoutes=M;
@@ -1,4 +1,4 @@
1
- import { S as E, d as o, f as h, h as R, a as $, b as q, c as Q } from "../compiler-DrkCCzf0.js";
1
+ import { S as E, d as o, f as h, h as R, a as $, b as q, c as Q } from "../compiler-CQq2_dSQ.js";
2
2
  const v = function(a, x, p) {
3
3
  const {
4
4
  cubes: g,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("hono"),y=require("../compiler-CMwSRhTS.cjs");var b=f=>{const u={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...f},h=(i=>typeof i=="string"?i==="*"?()=>i:o=>i===o?o:null:typeof i=="function"?i:o=>i.includes(o)?o:null)(u.origin),d=(i=>typeof i=="function"?i:Array.isArray(i)?()=>i:()=>[])(u.allowMethods);return async function(o,c){function n(r,e){o.res.headers.set(r,e)}const s=await h(o.req.header("origin")||"",o);if(s&&n("Access-Control-Allow-Origin",s),u.credentials&&n("Access-Control-Allow-Credentials","true"),u.exposeHeaders?.length&&n("Access-Control-Expose-Headers",u.exposeHeaders.join(",")),o.req.method==="OPTIONS"){u.origin!=="*"&&n("Vary","Origin"),u.maxAge!=null&&n("Access-Control-Max-Age",u.maxAge.toString());const r=await d(o.req.header("origin")||"",o);r.length&&n("Access-Control-Allow-Methods",r.join(","));let e=u.allowHeaders;if(!e?.length){const t=o.req.header("Access-Control-Request-Headers");t&&(e=t.split(/\s*,\s*/))}return e?.length&&(n("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,{headers:o.res.headers,status:204,statusText:"No Content"})}await c(),u.origin!=="*"&&o.header("Vary","Origin",{append:!0})}};function p(f){const{cubes:q,drizzle:u,schema:h,extractSecurityContext:d,engineType:i,cors:o,basePath:c="/cubejs-api/v1"}=f;if(!q||q.length===0)throw new Error("At least one cube must be provided in the cubes array");const n=new g.Hono;o&&n.use("/*",b(o));const s=new y.SemanticLayerCompiler({drizzle:u,schema:h,engineType:i});return q.forEach(r=>{s.registerCube(r)}),n.post(`${c}/load`,async r=>{try{const e=await r.req.json(),t=e.query||e,l=await d(r),a=s.validateQuery(t);if(!a.isValid)return r.json({error:`Query validation failed: ${a.errors.join(", ")}`},400);const m=await s.executeMultiCubeQuery(t,l);return r.json(y.formatCubeResponse(t,m,s))}catch(e){return console.error("Query execution error:",e),r.json({error:e instanceof Error?e.message:"Query execution failed"},500)}}),n.get(`${c}/load`,async r=>{try{const e=r.req.query("query");if(!e)return r.json({error:"Query parameter is required"},400);let t;try{t=JSON.parse(e)}catch{return r.json({error:"Invalid JSON in query parameter"},400)}const l=await d(r),a=s.validateQuery(t);if(!a.isValid)return r.json({error:`Query validation failed: ${a.errors.join(", ")}`},400);const m=await s.executeMultiCubeQuery(t,l);return r.json(y.formatCubeResponse(t,m,s))}catch(e){return console.error("Query execution error:",e),r.json({error:e instanceof Error?e.message:"Query execution failed"},500)}}),n.post(`${c}/batch`,async r=>{try{const e=await r.req.json(),{queries:t}=e;if(!t||!Array.isArray(t))return r.json({error:'Request body must contain a "queries" array'},400);if(t.length===0)return r.json({error:"Queries array cannot be empty"},400);const l=await d(r),a=await y.handleBatchRequest(t,l,s);return r.json(a)}catch(e){return console.error("Batch execution error:",e),r.json({error:e instanceof Error?e.message:"Batch execution failed"},500)}}),n.get(`${c}/meta`,r=>{try{const e=s.getMetadata();return r.json(y.formatMetaResponse(e))}catch(e){return console.error("Metadata error:",e),r.json({error:e instanceof Error?e.message:"Failed to fetch metadata"},500)}}),n.post(`${c}/sql`,async r=>{try{const e=await r.req.json(),t=await d(r),l=s.validateQuery(e);if(!l.isValid)return r.json({error:`Query validation failed: ${l.errors.join(", ")}`},400);const a=e.measures?.[0]||e.dimensions?.[0];if(!a)return r.json({error:"No measures or dimensions specified"},400);const m=a.split(".")[0],j=await s.generateSQL(m,e,t);return r.json(y.formatSqlResponse(e,j))}catch(e){return console.error("SQL generation error:",e),r.json({error:e instanceof Error?e.message:"SQL generation failed"},500)}}),n.get(`${c}/sql`,async r=>{try{const e=r.req.query("query");if(!e)return r.json({error:"Query parameter is required"},400);const t=JSON.parse(e),l=await d(r),a=s.validateQuery(t);if(!a.isValid)return r.json({error:`Query validation failed: ${a.errors.join(", ")}`},400);const m=t.measures?.[0]||t.dimensions?.[0];if(!m)return r.json({error:"No measures or dimensions specified"},400);const j=m.split(".")[0],C=await s.generateSQL(j,t,l);return r.json(y.formatSqlResponse(t,C))}catch(e){return console.error("SQL generation error:",e),r.json({error:e instanceof Error?e.message:"SQL generation failed"},500)}}),n.post(`${c}/dry-run`,async r=>{try{const e=await r.req.json(),t=e.query||e,l=await d(r),a=await y.handleDryRun(t,l,s);return r.json(a)}catch(e){return console.error("Dry-run error:",e),r.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},400)}}),n.get(`${c}/dry-run`,async r=>{try{const e=r.req.query("query");if(!e)return r.json({error:"Query parameter is required",valid:!1},400);const t=JSON.parse(e),l=await d(r),a=await y.handleDryRun(t,l,s);return r.json(a)}catch(e){return console.error("Dry-run error:",e),r.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},400)}}),n}function w(f,q){const u=p(q);return f.route("/",u),f}function x(f){const q=new g.Hono;return w(q,f)}exports.createCubeApp=x;exports.createCubeRoutes=p;exports.mountCubeRoutes=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("hono"),y=require("../compiler-A-Mz5Rzh.cjs");var b=f=>{const u={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...f},h=(i=>typeof i=="string"?i==="*"?()=>i:o=>i===o?o:null:typeof i=="function"?i:o=>i.includes(o)?o:null)(u.origin),d=(i=>typeof i=="function"?i:Array.isArray(i)?()=>i:()=>[])(u.allowMethods);return async function(o,c){function n(r,e){o.res.headers.set(r,e)}const s=await h(o.req.header("origin")||"",o);if(s&&n("Access-Control-Allow-Origin",s),u.credentials&&n("Access-Control-Allow-Credentials","true"),u.exposeHeaders?.length&&n("Access-Control-Expose-Headers",u.exposeHeaders.join(",")),o.req.method==="OPTIONS"){u.origin!=="*"&&n("Vary","Origin"),u.maxAge!=null&&n("Access-Control-Max-Age",u.maxAge.toString());const r=await d(o.req.header("origin")||"",o);r.length&&n("Access-Control-Allow-Methods",r.join(","));let e=u.allowHeaders;if(!e?.length){const t=o.req.header("Access-Control-Request-Headers");t&&(e=t.split(/\s*,\s*/))}return e?.length&&(n("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,{headers:o.res.headers,status:204,statusText:"No Content"})}await c(),u.origin!=="*"&&o.header("Vary","Origin",{append:!0})}};function p(f){const{cubes:q,drizzle:u,schema:h,extractSecurityContext:d,engineType:i,cors:o,basePath:c="/cubejs-api/v1"}=f;if(!q||q.length===0)throw new Error("At least one cube must be provided in the cubes array");const n=new g.Hono;o&&n.use("/*",b(o));const s=new y.SemanticLayerCompiler({drizzle:u,schema:h,engineType:i});return q.forEach(r=>{s.registerCube(r)}),n.post(`${c}/load`,async r=>{try{const e=await r.req.json(),t=e.query||e,l=await d(r),a=s.validateQuery(t);if(!a.isValid)return r.json({error:`Query validation failed: ${a.errors.join(", ")}`},400);const m=await s.executeMultiCubeQuery(t,l);return r.json(y.formatCubeResponse(t,m,s))}catch(e){return console.error("Query execution error:",e),r.json({error:e instanceof Error?e.message:"Query execution failed"},500)}}),n.get(`${c}/load`,async r=>{try{const e=r.req.query("query");if(!e)return r.json({error:"Query parameter is required"},400);let t;try{t=JSON.parse(e)}catch{return r.json({error:"Invalid JSON in query parameter"},400)}const l=await d(r),a=s.validateQuery(t);if(!a.isValid)return r.json({error:`Query validation failed: ${a.errors.join(", ")}`},400);const m=await s.executeMultiCubeQuery(t,l);return r.json(y.formatCubeResponse(t,m,s))}catch(e){return console.error("Query execution error:",e),r.json({error:e instanceof Error?e.message:"Query execution failed"},500)}}),n.post(`${c}/batch`,async r=>{try{const e=await r.req.json(),{queries:t}=e;if(!t||!Array.isArray(t))return r.json({error:'Request body must contain a "queries" array'},400);if(t.length===0)return r.json({error:"Queries array cannot be empty"},400);const l=await d(r),a=await y.handleBatchRequest(t,l,s);return r.json(a)}catch(e){return console.error("Batch execution error:",e),r.json({error:e instanceof Error?e.message:"Batch execution failed"},500)}}),n.get(`${c}/meta`,r=>{try{const e=s.getMetadata();return r.json(y.formatMetaResponse(e))}catch(e){return console.error("Metadata error:",e),r.json({error:e instanceof Error?e.message:"Failed to fetch metadata"},500)}}),n.post(`${c}/sql`,async r=>{try{const e=await r.req.json(),t=await d(r),l=s.validateQuery(e);if(!l.isValid)return r.json({error:`Query validation failed: ${l.errors.join(", ")}`},400);const a=e.measures?.[0]||e.dimensions?.[0];if(!a)return r.json({error:"No measures or dimensions specified"},400);const m=a.split(".")[0],j=await s.generateSQL(m,e,t);return r.json(y.formatSqlResponse(e,j))}catch(e){return console.error("SQL generation error:",e),r.json({error:e instanceof Error?e.message:"SQL generation failed"},500)}}),n.get(`${c}/sql`,async r=>{try{const e=r.req.query("query");if(!e)return r.json({error:"Query parameter is required"},400);const t=JSON.parse(e),l=await d(r),a=s.validateQuery(t);if(!a.isValid)return r.json({error:`Query validation failed: ${a.errors.join(", ")}`},400);const m=t.measures?.[0]||t.dimensions?.[0];if(!m)return r.json({error:"No measures or dimensions specified"},400);const j=m.split(".")[0],C=await s.generateSQL(j,t,l);return r.json(y.formatSqlResponse(t,C))}catch(e){return console.error("SQL generation error:",e),r.json({error:e instanceof Error?e.message:"SQL generation failed"},500)}}),n.post(`${c}/dry-run`,async r=>{try{const e=await r.req.json(),t=e.query||e,l=await d(r),a=await y.handleDryRun(t,l,s);return r.json(a)}catch(e){return console.error("Dry-run error:",e),r.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},400)}}),n.get(`${c}/dry-run`,async r=>{try{const e=r.req.query("query");if(!e)return r.json({error:"Query parameter is required",valid:!1},400);const t=JSON.parse(e),l=await d(r),a=await y.handleDryRun(t,l,s);return r.json(a)}catch(e){return console.error("Dry-run error:",e),r.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},400)}}),n}function w(f,q){const u=p(q);return f.route("/",u),f}function x(f){const q=new g.Hono;return w(q,f)}exports.createCubeApp=x;exports.createCubeRoutes=p;exports.mountCubeRoutes=w;
@@ -1,5 +1,5 @@
1
1
  import { Hono as w } from "hono";
2
- import { S as x, f as j, h as Q, a as b, b as g, c as p } from "../compiler-DrkCCzf0.js";
2
+ import { S as x, f as j, h as Q, a as b, b as g, c as p } from "../compiler-CQq2_dSQ.js";
3
3
  var A = (y) => {
4
4
  const u = {
5
5
  ...{
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("next/server"),c=require("../compiler-CMwSRhTS.cjs");function p(s){const{cubes:t,drizzle:o,schema:a,engineType:f}=s;if(!t||t.length===0)throw new Error("At least one cube must be provided in the cubes array");const r=new c.SemanticLayerCompiler({drizzle:o,schema:a,engineType:f});return t.forEach(i=>{r.registerCube(i)}),r}function m(s,t){const o=s.headers.get("origin"),a={};return t.origin&&(typeof t.origin=="string"?a["Access-Control-Allow-Origin"]=t.origin:Array.isArray(t.origin)?o&&t.origin.includes(o)&&(a["Access-Control-Allow-Origin"]=o):typeof t.origin=="function"&&o&&t.origin(o)&&(a["Access-Control-Allow-Origin"]=o)),t.methods&&(a["Access-Control-Allow-Methods"]=t.methods.join(", ")),t.allowedHeaders&&(a["Access-Control-Allow-Headers"]=t.allowedHeaders.join(", ")),t.credentials&&(a["Access-Control-Allow-Credentials"]="true"),a}function H(s){return async function(o){const a=m(o,s);return new Response(null,{status:200,headers:a})}}function x(s){const{extractSecurityContext:t,cors:o}=s,a=p(s);return async function(r,i){try{let e;if(r.method==="POST"){const y=await r.json();e=y.query||y}else if(r.method==="GET"){const y=r.nextUrl.searchParams.get("query");if(!y)return n.NextResponse.json(c.formatErrorResponse("Query parameter is required",400),{status:400});try{e=JSON.parse(y)}catch{return n.NextResponse.json(c.formatErrorResponse("Invalid JSON in query parameter",400),{status:400})}}else return n.NextResponse.json(c.formatErrorResponse("Method not allowed",405),{status:405});const u=await t(r,i),d=a.validateQuery(e);if(!d.isValid)return n.NextResponse.json(c.formatErrorResponse(`Query validation failed: ${d.errors.join(", ")}`,400),{status:400});const l=await a.executeMultiCubeQuery(e,u),R=c.formatCubeResponse(e,l,a);return n.NextResponse.json(R,{headers:o?m(r,o):{}})}catch(e){return process.env.NODE_ENV!=="test"&&console.error("Next.js load handler error:",e),n.NextResponse.json(c.formatErrorResponse(e instanceof Error?e.message:"Query execution failed",500),{status:500})}}}function N(s){const{cors:t}=s,o=p(s);return async function(f,r){try{const i=o.getMetadata(),e=c.formatMetaResponse(i);return n.NextResponse.json(e,{headers:t?m(f,t):{}})}catch(i){return process.env.NODE_ENV!=="test"&&console.error("Next.js meta handler error:",i),n.NextResponse.json(c.formatErrorResponse(i instanceof Error?i.message:"Failed to fetch metadata",500),{status:500})}}}function j(s){const{extractSecurityContext:t,cors:o}=s,a=p(s);return async function(r,i){try{let e;if(r.method==="POST"){const h=await r.json();e=h.query||h}else if(r.method==="GET"){const h=r.nextUrl.searchParams.get("query");if(!h)return n.NextResponse.json(c.formatErrorResponse("Query parameter is required",400),{status:400});try{e=JSON.parse(h)}catch{return n.NextResponse.json(c.formatErrorResponse("Invalid JSON in query parameter",400),{status:400})}}else return n.NextResponse.json(c.formatErrorResponse("Method not allowed",405),{status:405});const u=await t(r,i),d=a.validateQuery(e);if(!d.isValid)return n.NextResponse.json(c.formatErrorResponse(`Query validation failed: ${d.errors.join(", ")}`,400),{status:400});const l=e.measures?.[0]||e.dimensions?.[0];if(!l)return n.NextResponse.json(c.formatErrorResponse("No measures or dimensions specified",400),{status:400});const R=l.split(".")[0],y=await a.generateSQL(R,e,u),w=c.formatSqlResponse(e,y);return n.NextResponse.json(w,{headers:o?m(r,o):{}})}catch(e){return process.env.NODE_ENV!=="test"&&console.error("Next.js SQL handler error:",e),n.NextResponse.json(c.formatErrorResponse(e instanceof Error?e.message:"SQL generation failed",500),{status:500})}}}function E(s){const{extractSecurityContext:t,cors:o}=s,a=p(s);return async function(r,i){try{let e;if(r.method==="POST"){const l=await r.json();e=l.query||l}else if(r.method==="GET"){const l=r.nextUrl.searchParams.get("query");if(!l)return n.NextResponse.json({error:"Query parameter is required",valid:!1},{status:400});try{e=JSON.parse(l)}catch{return n.NextResponse.json({error:"Invalid JSON in query parameter",valid:!1},{status:400})}}else return n.NextResponse.json({error:"Method not allowed",valid:!1},{status:405});const u=await t(r,i),d=await c.handleDryRun(e,u,a);return n.NextResponse.json(d,{headers:o?m(r,o):{}})}catch(e){return process.env.NODE_ENV!=="test"&&console.error("Next.js dry-run handler error:",e),n.NextResponse.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},{status:400})}}}function g(s){const{extractSecurityContext:t,cors:o}=s,a=p(s);return async function(r,i){try{if(r.method!=="POST")return n.NextResponse.json(c.formatErrorResponse("Method not allowed - use POST",405),{status:405});const e=await r.json(),{queries:u}=e;if(!u||!Array.isArray(u))return n.NextResponse.json(c.formatErrorResponse('Request body must contain a "queries" array',400),{status:400});if(u.length===0)return n.NextResponse.json(c.formatErrorResponse("Queries array cannot be empty",400),{status:400});const d=await t(r,i),l=await c.handleBatchRequest(u,d,a);return n.NextResponse.json(l,{headers:o?m(r,o):{}})}catch(e){return process.env.NODE_ENV!=="test"&&console.error("Next.js batch handler error:",e),n.NextResponse.json(c.formatErrorResponse(e instanceof Error?e.message:"Batch execution failed",500),{status:500})}}}function S(s){return{load:x(s),meta:N(s),sql:j(s),dryRun:E(s),batch:g(s)}}exports.createBatchHandler=g;exports.createCubeHandlers=S;exports.createDryRunHandler=E;exports.createLoadHandler=x;exports.createMetaHandler=N;exports.createOptionsHandler=H;exports.createSqlHandler=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("next/server"),c=require("../compiler-A-Mz5Rzh.cjs");function p(s){const{cubes:t,drizzle:o,schema:a,engineType:f}=s;if(!t||t.length===0)throw new Error("At least one cube must be provided in the cubes array");const r=new c.SemanticLayerCompiler({drizzle:o,schema:a,engineType:f});return t.forEach(i=>{r.registerCube(i)}),r}function m(s,t){const o=s.headers.get("origin"),a={};return t.origin&&(typeof t.origin=="string"?a["Access-Control-Allow-Origin"]=t.origin:Array.isArray(t.origin)?o&&t.origin.includes(o)&&(a["Access-Control-Allow-Origin"]=o):typeof t.origin=="function"&&o&&t.origin(o)&&(a["Access-Control-Allow-Origin"]=o)),t.methods&&(a["Access-Control-Allow-Methods"]=t.methods.join(", ")),t.allowedHeaders&&(a["Access-Control-Allow-Headers"]=t.allowedHeaders.join(", ")),t.credentials&&(a["Access-Control-Allow-Credentials"]="true"),a}function H(s){return async function(o){const a=m(o,s);return new Response(null,{status:200,headers:a})}}function x(s){const{extractSecurityContext:t,cors:o}=s,a=p(s);return async function(r,i){try{let e;if(r.method==="POST"){const y=await r.json();e=y.query||y}else if(r.method==="GET"){const y=r.nextUrl.searchParams.get("query");if(!y)return n.NextResponse.json(c.formatErrorResponse("Query parameter is required",400),{status:400});try{e=JSON.parse(y)}catch{return n.NextResponse.json(c.formatErrorResponse("Invalid JSON in query parameter",400),{status:400})}}else return n.NextResponse.json(c.formatErrorResponse("Method not allowed",405),{status:405});const u=await t(r,i),d=a.validateQuery(e);if(!d.isValid)return n.NextResponse.json(c.formatErrorResponse(`Query validation failed: ${d.errors.join(", ")}`,400),{status:400});const l=await a.executeMultiCubeQuery(e,u),R=c.formatCubeResponse(e,l,a);return n.NextResponse.json(R,{headers:o?m(r,o):{}})}catch(e){return process.env.NODE_ENV!=="test"&&console.error("Next.js load handler error:",e),n.NextResponse.json(c.formatErrorResponse(e instanceof Error?e.message:"Query execution failed",500),{status:500})}}}function N(s){const{cors:t}=s,o=p(s);return async function(f,r){try{const i=o.getMetadata(),e=c.formatMetaResponse(i);return n.NextResponse.json(e,{headers:t?m(f,t):{}})}catch(i){return process.env.NODE_ENV!=="test"&&console.error("Next.js meta handler error:",i),n.NextResponse.json(c.formatErrorResponse(i instanceof Error?i.message:"Failed to fetch metadata",500),{status:500})}}}function j(s){const{extractSecurityContext:t,cors:o}=s,a=p(s);return async function(r,i){try{let e;if(r.method==="POST"){const h=await r.json();e=h.query||h}else if(r.method==="GET"){const h=r.nextUrl.searchParams.get("query");if(!h)return n.NextResponse.json(c.formatErrorResponse("Query parameter is required",400),{status:400});try{e=JSON.parse(h)}catch{return n.NextResponse.json(c.formatErrorResponse("Invalid JSON in query parameter",400),{status:400})}}else return n.NextResponse.json(c.formatErrorResponse("Method not allowed",405),{status:405});const u=await t(r,i),d=a.validateQuery(e);if(!d.isValid)return n.NextResponse.json(c.formatErrorResponse(`Query validation failed: ${d.errors.join(", ")}`,400),{status:400});const l=e.measures?.[0]||e.dimensions?.[0];if(!l)return n.NextResponse.json(c.formatErrorResponse("No measures or dimensions specified",400),{status:400});const R=l.split(".")[0],y=await a.generateSQL(R,e,u),w=c.formatSqlResponse(e,y);return n.NextResponse.json(w,{headers:o?m(r,o):{}})}catch(e){return process.env.NODE_ENV!=="test"&&console.error("Next.js SQL handler error:",e),n.NextResponse.json(c.formatErrorResponse(e instanceof Error?e.message:"SQL generation failed",500),{status:500})}}}function E(s){const{extractSecurityContext:t,cors:o}=s,a=p(s);return async function(r,i){try{let e;if(r.method==="POST"){const l=await r.json();e=l.query||l}else if(r.method==="GET"){const l=r.nextUrl.searchParams.get("query");if(!l)return n.NextResponse.json({error:"Query parameter is required",valid:!1},{status:400});try{e=JSON.parse(l)}catch{return n.NextResponse.json({error:"Invalid JSON in query parameter",valid:!1},{status:400})}}else return n.NextResponse.json({error:"Method not allowed",valid:!1},{status:405});const u=await t(r,i),d=await c.handleDryRun(e,u,a);return n.NextResponse.json(d,{headers:o?m(r,o):{}})}catch(e){return process.env.NODE_ENV!=="test"&&console.error("Next.js dry-run handler error:",e),n.NextResponse.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},{status:400})}}}function g(s){const{extractSecurityContext:t,cors:o}=s,a=p(s);return async function(r,i){try{if(r.method!=="POST")return n.NextResponse.json(c.formatErrorResponse("Method not allowed - use POST",405),{status:405});const e=await r.json(),{queries:u}=e;if(!u||!Array.isArray(u))return n.NextResponse.json(c.formatErrorResponse('Request body must contain a "queries" array',400),{status:400});if(u.length===0)return n.NextResponse.json(c.formatErrorResponse("Queries array cannot be empty",400),{status:400});const d=await t(r,i),l=await c.handleBatchRequest(u,d,a);return n.NextResponse.json(l,{headers:o?m(r,o):{}})}catch(e){return process.env.NODE_ENV!=="test"&&console.error("Next.js batch handler error:",e),n.NextResponse.json(c.formatErrorResponse(e instanceof Error?e.message:"Batch execution failed",500),{status:500})}}}function S(s){return{load:x(s),meta:N(s),sql:j(s),dryRun:E(s),batch:g(s)}}exports.createBatchHandler=g;exports.createCubeHandlers=S;exports.createDryRunHandler=E;exports.createLoadHandler=x;exports.createMetaHandler=N;exports.createOptionsHandler=H;exports.createSqlHandler=j;
@@ -1,5 +1,5 @@
1
1
  import { NextResponse as a } from "next/server";
2
- import { d as i, f as x, a as N, b as S, c as b, h as C, S as E } from "../compiler-DrkCCzf0.js";
2
+ import { d as i, f as x, a as N, b as S, c as b, h as C, S as E } from "../compiler-CQq2_dSQ.js";
3
3
  function j(n) {
4
4
  const { cubes: t, drizzle: s, schema: o, engineType: y } = n;
5
5
  if (!t || t.length === 0)
@@ -1,41 +1,32 @@
1
- import { L as t, r as e, f as s, g as o, k as C, l as h, m as f, i as l, q as p, p as d, n as i, o as R, a as c, u as m } from "./chunks/charts-CHzWeaY1.js";
2
- import { a as n, C as x, N as u, P as A } from "./chunks/chart-activitygridchart-CUGN9Xq9.js";
3
- import { default as L } from "./chunks/chart-barchart-D_op06r-.js";
4
- import { default as y } from "./chunks/chart-linechart-DqFmLbRe.js";
5
- import { A as I } from "./chunks/chart-areachart-B4tknnsY.js";
6
- import { default as E } from "./chunks/chart-piechart-CrXFd9pE.js";
7
- import { default as P } from "./chunks/chart-scatterchart-BP06BeU5.js";
8
- import { default as b } from "./chunks/chart-radarchart-tar2GBkO.js";
9
- import { default as D } from "./chunks/chart-radialbarchart-ab8Swtal.js";
10
- import { default as H } from "./chunks/chart-treemapchart-DAiixITm.js";
11
- import { default as k } from "./chunks/chart-datatable-C7MS9q4Y.js";
1
+ import { L as s, r as t, f as C, g as e, k as h, l as o, m as R, i, q as l, p as c, n as f, o as g, a as n, u as d } from "./chunks/charts-amt7VOyw.js";
2
+ import { H as A, J as T, G as L, N as O, I as S, A as y, B as I, z as m, P as E, R as _, E as B, S as G, F as H } from "./chunks/charts-B8YMw1mi.js";
12
3
  export {
13
- n as CHART_COLORS,
14
- x as CHART_MARGINS,
15
- k as DataTable,
16
- t as LazyChart,
17
- u as NEGATIVE_COLOR,
18
- A as POSITIVE_COLOR,
19
- I as RechartsAreaChart,
20
- L as RechartsBarChart,
21
- y as RechartsLineChart,
4
+ A as CHART_COLORS,
5
+ T as CHART_MARGINS,
6
+ L as DataTable,
7
+ s as LazyChart,
8
+ O as NEGATIVE_COLOR,
9
+ S as POSITIVE_COLOR,
10
+ y as RechartsAreaChart,
11
+ I as RechartsBarChart,
12
+ m as RechartsLineChart,
22
13
  E as RechartsPieChart,
23
- b as RechartsRadarChart,
24
- D as RechartsRadialBarChart,
25
- P as RechartsScatterChart,
14
+ _ as RechartsRadarChart,
15
+ B as RechartsRadialBarChart,
16
+ G as RechartsScatterChart,
26
17
  H as RechartsTreeMapChart,
27
- e as clearChartConfigCache,
28
- s as formatChartData,
29
- o as getAvailableChartTypes,
30
- C as getChartConfigAsync,
31
- h as getChartConfigSync,
32
- f as isChartConfigLoaded,
33
- l as isValidChartType,
34
- p as loadAllChartConfigs,
35
- d as preloadChart,
36
- i as preloadChartConfig,
37
- R as preloadChartConfigs,
38
- c as preloadCharts,
39
- m as useChartConfig
18
+ t as clearChartConfigCache,
19
+ C as formatChartData,
20
+ e as getAvailableChartTypes,
21
+ h as getChartConfigAsync,
22
+ o as getChartConfigSync,
23
+ R as isChartConfigLoaded,
24
+ i as isValidChartType,
25
+ l as loadAllChartConfigs,
26
+ c as preloadChart,
27
+ f as preloadChartConfig,
28
+ g as preloadChartConfigs,
29
+ n as preloadCharts,
30
+ d as useChartConfig
40
31
  };
41
32
  //# sourceMappingURL=charts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"charts.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"charts.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}