drizzle-cube 0.2.23 → 0.2.25
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.
- package/dist/adapters/compiler-C6JQHGrF.cjs +22 -0
- package/dist/adapters/{compiler-DDXMrb9d.js → compiler-Ddwn99Ja.js} +1434 -1289
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.d.ts +6 -1
- package/dist/adapters/express/index.js +22 -20
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.d.ts +6 -1
- package/dist/adapters/fastify/index.js +18 -16
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.d.ts +6 -1
- package/dist/adapters/hono/index.js +87 -85
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.d.ts +6 -1
- package/dist/adapters/nextjs/index.js +64 -63
- package/dist/adapters/utils.d.ts +18 -0
- package/dist/client/charts.js +2 -2
- package/dist/client/chunks/{charts-DboFPJFN.js → charts-BsXrHSCm.js} +32 -32
- package/dist/client/chunks/{charts-DboFPJFN.js.map → charts-BsXrHSCm.js.map} +1 -1
- package/dist/client/chunks/{charts--hFH-bsu.js → charts-BvLb1eub.js} +710 -703
- package/dist/client/chunks/charts-BvLb1eub.js.map +1 -0
- package/dist/client/chunks/{components-D7wTB56l.js → components-DhA8GIUY.js} +6019 -5299
- package/dist/client/chunks/components-DhA8GIUY.js.map +1 -0
- package/dist/client/chunks/core-DcwgBEzv.js +6 -0
- package/dist/client/chunks/core-DcwgBEzv.js.map +1 -0
- package/dist/client/chunks/{index-yc7cf-yE.js → index-9x0R-Fme.js} +2 -2
- package/dist/client/chunks/{index-yc7cf-yE.js.map → index-9x0R-Fme.js.map} +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisQueryPanel.d.ts +3 -2
- package/dist/client/components/AnalysisBuilder/types.d.ts +63 -15
- package/dist/client/components/DashboardPortletCard.d.ts +12 -0
- package/dist/client/components/DebugModal.d.ts +7 -1
- package/dist/client/components.js +2 -2
- package/dist/client/hooks/useMultiCubeQuery.d.ts +36 -0
- package/dist/client/hooks.js +2 -2
- package/dist/client/icons.js +1 -1
- package/dist/client/index.d.ts +7 -1
- package/dist/client/index.js +70 -52
- package/dist/client/providers.js +1 -1
- package/dist/client/styles.css +1 -1
- package/dist/client/types.d.ts +32 -0
- package/dist/client/utils/multiQueryUtils.d.ts +86 -0
- package/dist/client/utils/multiQueryValidation.d.ts +69 -0
- package/dist/client/utils/shareUtils.d.ts +3 -3
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +17 -17
- package/dist/server/index.d.ts +326 -1
- package/dist/server/index.js +2441 -2147
- package/package.json +1 -1
- package/dist/adapters/compiler-S2NEGW7Q.cjs +0 -22
- package/dist/client/chunks/charts--hFH-bsu.js.map +0 -1
- package/dist/client/chunks/components-D7wTB56l.js.map +0 -1
- package/dist/client/chunks/core-PxWXpBbW.js +0 -6
- package/dist/client/chunks/core-PxWXpBbW.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("express"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("express"),x=require("cors"),o=require("../compiler-C6JQHGrF.cjs");function E(d){const{cubes:y,drizzle:p,schema:q,extractSecurityContext:l,engineType:g,cors:R,basePath:c="/cubejs-api/v1",jsonLimit:b="10mb",cache:Q}=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(x(R)),i.use(m.json({limit:b})),i.use(m.urlencoded({extended:!0,limit:b}));const a=new o.SemanticLayerCompiler({drizzle:p,schema:q,engineType:g,cache:Q});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],v=await a.generateSQL(j,s,n);r.json(o.formatSqlResponse(s,v))}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 h(d,y){const p=E(y);return d.use("/",p),d}function C(d){const y=m();return h(y,d)}exports.createCubeApp=C;exports.createCubeRouter=E;exports.mountCubeRoutes=h;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Router, Request, Response, Express } from 'express';
|
|
2
2
|
import { CorsOptions } from 'cors';
|
|
3
|
-
import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube } from '../../server';
|
|
3
|
+
import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube, CacheConfig } from '../../server';
|
|
4
4
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
5
5
|
import { MySql2Database } from 'drizzle-orm/mysql2';
|
|
6
6
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
@@ -61,6 +61,11 @@ export interface ExpressAdapterOptions {
|
|
|
61
61
|
* JSON body parser limit (default: '10mb')
|
|
62
62
|
*/
|
|
63
63
|
jsonLimit?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Cache configuration for query result caching
|
|
66
|
+
* When provided, query results will be cached using the specified provider
|
|
67
|
+
*/
|
|
68
|
+
cache?: CacheConfig;
|
|
64
69
|
}
|
|
65
70
|
/**
|
|
66
71
|
* Create Express router for Cube.js-compatible API
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import p, { Router as
|
|
2
|
-
import
|
|
3
|
-
import { S as
|
|
4
|
-
function
|
|
1
|
+
import p, { Router as S } from "express";
|
|
2
|
+
import R from "cors";
|
|
3
|
+
import { S as E, d as o, f as g, h as $, a as L, b as Q, c as q } from "../compiler-Ddwn99Ja.js";
|
|
4
|
+
function N(d) {
|
|
5
5
|
const {
|
|
6
6
|
cubes: y,
|
|
7
7
|
drizzle: m,
|
|
@@ -10,16 +10,18 @@ function L(d) {
|
|
|
10
10
|
engineType: v,
|
|
11
11
|
cors: b,
|
|
12
12
|
basePath: c = "/cubejs-api/v1",
|
|
13
|
-
jsonLimit: h = "10mb"
|
|
13
|
+
jsonLimit: h = "10mb",
|
|
14
|
+
cache: w
|
|
14
15
|
} = d;
|
|
15
16
|
if (!y || y.length === 0)
|
|
16
17
|
throw new Error("At least one cube must be provided in the cubes array");
|
|
17
|
-
const i =
|
|
18
|
-
b && i.use(
|
|
19
|
-
const a = new
|
|
18
|
+
const i = S();
|
|
19
|
+
b && i.use(R(b)), i.use(p.json({ limit: h })), i.use(p.urlencoded({ extended: !0, limit: h }));
|
|
20
|
+
const a = new E({
|
|
20
21
|
drizzle: m,
|
|
21
22
|
schema: x,
|
|
22
|
-
engineType: v
|
|
23
|
+
engineType: v,
|
|
24
|
+
cache: w
|
|
23
25
|
});
|
|
24
26
|
return y.forEach((t) => {
|
|
25
27
|
a.registerCube(t);
|
|
@@ -83,7 +85,7 @@ function L(d) {
|
|
|
83
85
|
"Queries array cannot be empty",
|
|
84
86
|
400
|
|
85
87
|
));
|
|
86
|
-
const s = await l(t, r), n = await
|
|
88
|
+
const s = await l(t, r), n = await $(e, s, a);
|
|
87
89
|
r.json(n);
|
|
88
90
|
} catch (e) {
|
|
89
91
|
console.error("Batch execution error:", e), r.status(500).json(o(
|
|
@@ -94,7 +96,7 @@ function L(d) {
|
|
|
94
96
|
}), i.get(`${c}/meta`, (t, r) => {
|
|
95
97
|
try {
|
|
96
98
|
const e = a.getMetadata();
|
|
97
|
-
r.json(
|
|
99
|
+
r.json(L(e));
|
|
98
100
|
} catch (e) {
|
|
99
101
|
console.error("Metadata error:", e), r.status(500).json(o(
|
|
100
102
|
e instanceof Error ? e.message : "Failed to fetch metadata",
|
|
@@ -143,8 +145,8 @@ function L(d) {
|
|
|
143
145
|
"No measures or dimensions specified",
|
|
144
146
|
400
|
|
145
147
|
));
|
|
146
|
-
const j = f.split(".")[0],
|
|
147
|
-
r.json(Q(s,
|
|
148
|
+
const j = f.split(".")[0], C = await a.generateSQL(j, s, n);
|
|
149
|
+
r.json(Q(s, C));
|
|
148
150
|
} catch (e) {
|
|
149
151
|
console.error("SQL generation error:", e), r.status(500).json(o(
|
|
150
152
|
e instanceof Error ? e.message : "SQL generation failed",
|
|
@@ -181,16 +183,16 @@ function L(d) {
|
|
|
181
183
|
console.error("Express adapter error:", t), e.headersSent || e.status(500).json(o(t, 500));
|
|
182
184
|
}), i;
|
|
183
185
|
}
|
|
184
|
-
function
|
|
185
|
-
const m =
|
|
186
|
+
function M(d, y) {
|
|
187
|
+
const m = N(y);
|
|
186
188
|
return d.use("/", m), d;
|
|
187
189
|
}
|
|
188
|
-
function
|
|
190
|
+
function O(d) {
|
|
189
191
|
const y = p();
|
|
190
|
-
return
|
|
192
|
+
return M(y, d);
|
|
191
193
|
}
|
|
192
194
|
export {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
O as createCubeApp,
|
|
196
|
+
N as createCubeRouter,
|
|
197
|
+
M as mountCubeRoutes
|
|
196
198
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var w=Object.create;var q=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var L=(n,s,m,g)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of j(s))!$.call(n,d)&&d!==m&&q(n,d,{get:()=>s[d],enumerable:!(g=x(s,d))||g.enumerable});return n};var M=(n,s,m)=>(m=n!=null?w(P(n)):{},L(s||!n||!n.__esModule?q(m,"default",{value:n,enumerable:!0}):m,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../compiler-C6JQHGrF.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,cache:Q}=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,cache:Q});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],S=await i.generateSQL(f,a,u);return o.formatSqlResponse(a,S)}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 N(n,s){await n.register(h,s)}function A(n){const s=require("fastify")({logger:!0});return s.register(h,n),s}exports.createCubeApp=A;exports.cubePlugin=h;exports.registerCubeRoutes=N;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FastifyPluginCallback, FastifyRequest, FastifyInstance } from 'fastify';
|
|
2
2
|
import { FastifyCorsOptions } from '@fastify/cors';
|
|
3
|
-
import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube } from '../../server';
|
|
3
|
+
import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube, CacheConfig } from '../../server';
|
|
4
4
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
5
5
|
import { MySql2Database } from 'drizzle-orm/mysql2';
|
|
6
6
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
@@ -60,6 +60,11 @@ export interface FastifyAdapterOptions {
|
|
|
60
60
|
* JSON body parser limit (default: 10485760 - 10MB)
|
|
61
61
|
*/
|
|
62
62
|
bodyLimit?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Cache configuration for query result caching
|
|
65
|
+
* When provided, query results will be cached using the specified provider
|
|
66
|
+
*/
|
|
67
|
+
cache?: CacheConfig;
|
|
63
68
|
}
|
|
64
69
|
/**
|
|
65
70
|
* Fastify plugin for Cube.js-compatible API
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as
|
|
1
|
+
import { S as R, d as o, f, h as $, a as P, b as q, c as Q } from "../compiler-Ddwn99Ja.js";
|
|
2
2
|
const v = function(a, x, p) {
|
|
3
3
|
const {
|
|
4
4
|
cubes: g,
|
|
@@ -6,20 +6,22 @@ const v = function(a, x, p) {
|
|
|
6
6
|
schema: w,
|
|
7
7
|
extractSecurityContext: y,
|
|
8
8
|
engineType: S,
|
|
9
|
-
cors:
|
|
9
|
+
cors: h,
|
|
10
10
|
basePath: c = "/cubejs-api/v1",
|
|
11
|
-
bodyLimit: m = 10485760
|
|
11
|
+
bodyLimit: m = 10485760,
|
|
12
12
|
// 10MB
|
|
13
|
+
cache: j
|
|
13
14
|
} = x;
|
|
14
15
|
if (!g || g.length === 0)
|
|
15
16
|
return p(new Error("At least one cube must be provided in the cubes array"));
|
|
16
|
-
|
|
17
|
+
h && a.register(import("@fastify/cors"), h), a.addHook("onRequest", async (r, t) => {
|
|
17
18
|
r.method === "POST" && (r.body = void 0);
|
|
18
19
|
});
|
|
19
|
-
const n = new
|
|
20
|
+
const n = new R({
|
|
20
21
|
drizzle: C,
|
|
21
22
|
schema: w,
|
|
22
|
-
engineType: S
|
|
23
|
+
engineType: S,
|
|
24
|
+
cache: j
|
|
23
25
|
});
|
|
24
26
|
g.forEach((r) => {
|
|
25
27
|
n.registerCube(r);
|
|
@@ -40,7 +42,7 @@ const v = function(a, x, p) {
|
|
|
40
42
|
400
|
|
41
43
|
));
|
|
42
44
|
const d = await n.executeMultiCubeQuery(s, i);
|
|
43
|
-
return
|
|
45
|
+
return f(s, d, n);
|
|
44
46
|
} catch (e) {
|
|
45
47
|
return r.log.error(e, "Query execution error"), t.status(500).send(o(
|
|
46
48
|
e instanceof Error ? e.message : "Query execution failed",
|
|
@@ -76,7 +78,7 @@ const v = function(a, x, p) {
|
|
|
76
78
|
400
|
|
77
79
|
));
|
|
78
80
|
const d = await n.executeMultiCubeQuery(s, i);
|
|
79
|
-
return
|
|
81
|
+
return f(s, d, n);
|
|
80
82
|
} catch (e) {
|
|
81
83
|
return r.log.error(e, "Query execution error"), t.status(500).send(o(
|
|
82
84
|
e instanceof Error ? e.message : "Query execution failed",
|
|
@@ -111,7 +113,7 @@ const v = function(a, x, p) {
|
|
|
111
113
|
400
|
|
112
114
|
));
|
|
113
115
|
const s = await y(r);
|
|
114
|
-
return await
|
|
116
|
+
return await $(e, s, n);
|
|
115
117
|
} catch (e) {
|
|
116
118
|
return r.log.error(e, "Batch execution error"), t.status(500).send(o(
|
|
117
119
|
e instanceof Error ? e.message : "Batch execution failed",
|
|
@@ -121,7 +123,7 @@ const v = function(a, x, p) {
|
|
|
121
123
|
}), a.get(`${c}/meta`, async (r, t) => {
|
|
122
124
|
try {
|
|
123
125
|
const e = n.getMetadata();
|
|
124
|
-
return
|
|
126
|
+
return P(e);
|
|
125
127
|
} catch (e) {
|
|
126
128
|
return r.log.error(e, "Metadata error"), t.status(500).send(o(
|
|
127
129
|
e instanceof Error ? e.message : "Failed to fetch metadata",
|
|
@@ -182,8 +184,8 @@ const v = function(a, x, p) {
|
|
|
182
184
|
"No measures or dimensions specified",
|
|
183
185
|
400
|
|
184
186
|
));
|
|
185
|
-
const b = d.split(".")[0],
|
|
186
|
-
return q(s,
|
|
187
|
+
const b = d.split(".")[0], E = await n.generateSQL(b, s, i);
|
|
188
|
+
return q(s, E);
|
|
187
189
|
} catch (e) {
|
|
188
190
|
return r.log.error(e, "SQL generation error"), t.status(500).send(o(
|
|
189
191
|
e instanceof Error ? e.message : "SQL generation failed",
|
|
@@ -234,17 +236,17 @@ const v = function(a, x, p) {
|
|
|
234
236
|
return o(s, e.statusCode);
|
|
235
237
|
}), p();
|
|
236
238
|
};
|
|
237
|
-
async function
|
|
239
|
+
async function N(l, a) {
|
|
238
240
|
await l.register(v, a);
|
|
239
241
|
}
|
|
240
|
-
function
|
|
242
|
+
function M(l) {
|
|
241
243
|
const a = require("fastify")({
|
|
242
244
|
logger: !0
|
|
243
245
|
});
|
|
244
246
|
return a.register(v, l), a;
|
|
245
247
|
}
|
|
246
248
|
export {
|
|
247
|
-
|
|
249
|
+
M as createCubeApp,
|
|
248
250
|
v as cubePlugin,
|
|
249
|
-
|
|
251
|
+
N as registerCubeRoutes
|
|
250
252
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("hono"),f=require("../compiler-C6JQHGrF.cjs");var x=q=>{const i={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...q},j=(a=>typeof a=="string"?a==="*"?()=>a:o=>a===o?o:null:typeof a=="function"?a:o=>a.includes(o)?o:null)(i.origin),d=(a=>typeof a=="function"?a:Array.isArray(a)?()=>a:()=>[])(i.allowMethods);return async function(o,c){function y(n,r){o.res.headers.set(n,r)}const l=await j(o.req.header("origin")||"",o);if(l&&y("Access-Control-Allow-Origin",l),i.credentials&&y("Access-Control-Allow-Credentials","true"),i.exposeHeaders?.length&&y("Access-Control-Expose-Headers",i.exposeHeaders.join(",")),o.req.method==="OPTIONS"){i.origin!=="*"&&y("Vary","Origin"),i.maxAge!=null&&y("Access-Control-Max-Age",i.maxAge.toString());const n=await d(o.req.header("origin")||"",o);n.length&&y("Access-Control-Allow-Methods",n.join(","));let r=i.allowHeaders;if(!r?.length){const e=o.req.header("Access-Control-Request-Headers");e&&(r=e.split(/\s*,\s*/))}return r?.length&&(y("Access-Control-Allow-Headers",r.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(),i.origin!=="*"&&o.header("Vary","Origin",{append:!0})}};function w(q){const{cubes:m,drizzle:i,schema:j,extractSecurityContext:d,engineType:a,cors:o,basePath:c="/cubejs-api/v1",cache:y}=q;if(!m||m.length===0)throw new Error("At least one cube must be provided in the cubes array");const l=new p.Hono;o&&l.use("/*",x(o));const n=new f.SemanticLayerCompiler({drizzle:i,schema:j,engineType:a,cache:y});return m.forEach(r=>{n.registerCube(r)}),l.post(`${c}/load`,async r=>{try{const e=await r.req.json(),t=e.query||e,u=await d(r),s=n.validateQuery(t);if(!s.isValid)return r.json({error:`Query validation failed: ${s.errors.join(", ")}`},400);const h=await n.executeMultiCubeQuery(t,u);return r.json(f.formatCubeResponse(t,h,n))}catch(e){return console.error("Query execution error:",e),r.json({error:e instanceof Error?e.message:"Query execution failed"},500)}}),l.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 u=await d(r),s=n.validateQuery(t);if(!s.isValid)return r.json({error:`Query validation failed: ${s.errors.join(", ")}`},400);const h=await n.executeMultiCubeQuery(t,u);return r.json(f.formatCubeResponse(t,h,n))}catch(e){return console.error("Query execution error:",e),r.json({error:e instanceof Error?e.message:"Query execution failed"},500)}}),l.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 u=await d(r),s=await f.handleBatchRequest(t,u,n);return r.json(s)}catch(e){return console.error("Batch execution error:",e),r.json({error:e instanceof Error?e.message:"Batch execution failed"},500)}}),l.get(`${c}/meta`,r=>{try{const e=n.getMetadata();return r.json(f.formatMetaResponse(e))}catch(e){return console.error("Metadata error:",e),r.json({error:e instanceof Error?e.message:"Failed to fetch metadata"},500)}}),l.post(`${c}/sql`,async r=>{try{const e=await r.req.json(),t=await d(r),u=n.validateQuery(e);if(!u.isValid)return r.json({error:`Query validation failed: ${u.errors.join(", ")}`},400);const s=e.measures?.[0]||e.dimensions?.[0];if(!s)return r.json({error:"No measures or dimensions specified"},400);const h=s.split(".")[0],g=await n.generateSQL(h,e,t);return r.json(f.formatSqlResponse(e,g))}catch(e){return console.error("SQL generation error:",e),r.json({error:e instanceof Error?e.message:"SQL generation failed"},500)}}),l.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),u=await d(r),s=n.validateQuery(t);if(!s.isValid)return r.json({error:`Query validation failed: ${s.errors.join(", ")}`},400);const h=t.measures?.[0]||t.dimensions?.[0];if(!h)return r.json({error:"No measures or dimensions specified"},400);const g=h.split(".")[0],b=await n.generateSQL(g,t,u);return r.json(f.formatSqlResponse(t,b))}catch(e){return console.error("SQL generation error:",e),r.json({error:e instanceof Error?e.message:"SQL generation failed"},500)}}),l.post(`${c}/dry-run`,async r=>{try{const e=await r.req.json(),t=e.query||e,u=await d(r),s=await f.handleDryRun(t,u,n);return r.json(s)}catch(e){return console.error("Dry-run error:",e),r.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},400)}}),l.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),u=await d(r),s=await f.handleDryRun(t,u,n);return r.json(s)}catch(e){return console.error("Dry-run error:",e),r.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},400)}}),l}function C(q,m){const i=w(m);return q.route("/",i),q}function Q(q){const m=new p.Hono;return C(m,q)}exports.createCubeApp=Q;exports.createCubeRoutes=w;exports.mountCubeRoutes=C;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
-
import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube } from '../../server';
|
|
2
|
+
import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube, CacheConfig } from '../../server';
|
|
3
3
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
4
4
|
import { MySql2Database } from 'drizzle-orm/mysql2';
|
|
5
5
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
@@ -60,6 +60,11 @@ export interface HonoAdapterOptions {
|
|
|
60
60
|
* API base path (default: '/cubejs-api/v1')
|
|
61
61
|
*/
|
|
62
62
|
basePath?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Cache configuration for query result caching
|
|
65
|
+
* When provided, query results will be cached using the specified provider
|
|
66
|
+
*/
|
|
67
|
+
cache?: CacheConfig;
|
|
63
68
|
}
|
|
64
69
|
/**
|
|
65
70
|
* Create Hono routes for Cube.js-compatible API
|
|
@@ -1,74 +1,76 @@
|
|
|
1
|
-
import { Hono as
|
|
2
|
-
import { S as
|
|
3
|
-
var
|
|
4
|
-
const
|
|
1
|
+
import { Hono as C } from "hono";
|
|
2
|
+
import { S as Q, f as g, h as b, a as A, b as p, c as w } from "../compiler-Ddwn99Ja.js";
|
|
3
|
+
var v = (f) => {
|
|
4
|
+
const i = {
|
|
5
5
|
...{
|
|
6
6
|
origin: "*",
|
|
7
7
|
allowMethods: ["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH"],
|
|
8
8
|
allowHeaders: [],
|
|
9
9
|
exposeHeaders: []
|
|
10
10
|
},
|
|
11
|
-
...
|
|
12
|
-
},
|
|
11
|
+
...f
|
|
12
|
+
}, h = /* @__PURE__ */ ((a) => typeof a == "string" ? a === "*" ? () => a : (o) => a === o ? o : null : typeof a == "function" ? a : (o) => a.includes(o) ? o : null)(i.origin), d = ((a) => typeof a == "function" ? a : Array.isArray(a) ? () => a : () => [])(i.allowMethods);
|
|
13
13
|
return async function(o, c) {
|
|
14
|
-
function n
|
|
15
|
-
o.res.headers.set(
|
|
14
|
+
function y(n, r) {
|
|
15
|
+
o.res.headers.set(n, r);
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
if (!
|
|
24
|
-
const
|
|
25
|
-
|
|
17
|
+
const l = await h(o.req.header("origin") || "", o);
|
|
18
|
+
if (l && y("Access-Control-Allow-Origin", l), i.credentials && y("Access-Control-Allow-Credentials", "true"), i.exposeHeaders?.length && y("Access-Control-Expose-Headers", i.exposeHeaders.join(",")), o.req.method === "OPTIONS") {
|
|
19
|
+
i.origin !== "*" && y("Vary", "Origin"), i.maxAge != null && y("Access-Control-Max-Age", i.maxAge.toString());
|
|
20
|
+
const n = await d(o.req.header("origin") || "", o);
|
|
21
|
+
n.length && y("Access-Control-Allow-Methods", n.join(","));
|
|
22
|
+
let r = i.allowHeaders;
|
|
23
|
+
if (!r?.length) {
|
|
24
|
+
const e = o.req.header("Access-Control-Request-Headers");
|
|
25
|
+
e && (r = e.split(/\s*,\s*/));
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return r?.length && (y("Access-Control-Allow-Headers", r.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, {
|
|
28
28
|
headers: o.res.headers,
|
|
29
29
|
status: 204,
|
|
30
30
|
statusText: "No Content"
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
await c(),
|
|
33
|
+
await c(), i.origin !== "*" && o.header("Vary", "Origin", { append: !0 });
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
function
|
|
36
|
+
function S(f) {
|
|
37
37
|
const {
|
|
38
|
-
cubes:
|
|
39
|
-
drizzle:
|
|
40
|
-
schema:
|
|
38
|
+
cubes: m,
|
|
39
|
+
drizzle: i,
|
|
40
|
+
schema: h,
|
|
41
41
|
extractSecurityContext: d,
|
|
42
|
-
engineType:
|
|
42
|
+
engineType: a,
|
|
43
43
|
cors: o,
|
|
44
|
-
basePath: c = "/cubejs-api/v1"
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
basePath: c = "/cubejs-api/v1",
|
|
45
|
+
cache: y
|
|
46
|
+
} = f;
|
|
47
|
+
if (!m || m.length === 0)
|
|
47
48
|
throw new Error("At least one cube must be provided in the cubes array");
|
|
48
|
-
const
|
|
49
|
-
o &&
|
|
50
|
-
const
|
|
51
|
-
drizzle:
|
|
52
|
-
schema:
|
|
53
|
-
engineType:
|
|
49
|
+
const l = new C();
|
|
50
|
+
o && l.use("/*", v(o));
|
|
51
|
+
const n = new Q({
|
|
52
|
+
drizzle: i,
|
|
53
|
+
schema: h,
|
|
54
|
+
engineType: a,
|
|
55
|
+
cache: y
|
|
54
56
|
});
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
}),
|
|
57
|
+
return m.forEach((r) => {
|
|
58
|
+
n.registerCube(r);
|
|
59
|
+
}), l.post(`${c}/load`, async (r) => {
|
|
58
60
|
try {
|
|
59
|
-
const e = await r.req.json(), t = e.query || e,
|
|
60
|
-
if (!
|
|
61
|
+
const e = await r.req.json(), t = e.query || e, u = await d(r), s = n.validateQuery(t);
|
|
62
|
+
if (!s.isValid)
|
|
61
63
|
return r.json({
|
|
62
|
-
error: `Query validation failed: ${
|
|
64
|
+
error: `Query validation failed: ${s.errors.join(", ")}`
|
|
63
65
|
}, 400);
|
|
64
|
-
const
|
|
65
|
-
return r.json(
|
|
66
|
+
const q = await n.executeMultiCubeQuery(t, u);
|
|
67
|
+
return r.json(g(t, q, n));
|
|
66
68
|
} catch (e) {
|
|
67
69
|
return console.error("Query execution error:", e), r.json({
|
|
68
70
|
error: e instanceof Error ? e.message : "Query execution failed"
|
|
69
71
|
}, 500);
|
|
70
72
|
}
|
|
71
|
-
}),
|
|
73
|
+
}), l.get(`${c}/load`, async (r) => {
|
|
72
74
|
try {
|
|
73
75
|
const e = r.req.query("query");
|
|
74
76
|
if (!e)
|
|
@@ -83,19 +85,19 @@ function v(y) {
|
|
|
83
85
|
error: "Invalid JSON in query parameter"
|
|
84
86
|
}, 400);
|
|
85
87
|
}
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
88
|
+
const u = await d(r), s = n.validateQuery(t);
|
|
89
|
+
if (!s.isValid)
|
|
88
90
|
return r.json({
|
|
89
|
-
error: `Query validation failed: ${
|
|
91
|
+
error: `Query validation failed: ${s.errors.join(", ")}`
|
|
90
92
|
}, 400);
|
|
91
|
-
const
|
|
92
|
-
return r.json(
|
|
93
|
+
const q = await n.executeMultiCubeQuery(t, u);
|
|
94
|
+
return r.json(g(t, q, n));
|
|
93
95
|
} catch (e) {
|
|
94
96
|
return console.error("Query execution error:", e), r.json({
|
|
95
97
|
error: e instanceof Error ? e.message : "Query execution failed"
|
|
96
98
|
}, 500);
|
|
97
99
|
}
|
|
98
|
-
}),
|
|
100
|
+
}), l.post(`${c}/batch`, async (r) => {
|
|
99
101
|
try {
|
|
100
102
|
const e = await r.req.json(), { queries: t } = e;
|
|
101
103
|
if (!t || !Array.isArray(t))
|
|
@@ -106,76 +108,76 @@ function v(y) {
|
|
|
106
108
|
return r.json({
|
|
107
109
|
error: "Queries array cannot be empty"
|
|
108
110
|
}, 400);
|
|
109
|
-
const
|
|
110
|
-
return r.json(
|
|
111
|
+
const u = await d(r), s = await b(t, u, n);
|
|
112
|
+
return r.json(s);
|
|
111
113
|
} catch (e) {
|
|
112
114
|
return console.error("Batch execution error:", e), r.json({
|
|
113
115
|
error: e instanceof Error ? e.message : "Batch execution failed"
|
|
114
116
|
}, 500);
|
|
115
117
|
}
|
|
116
|
-
}),
|
|
118
|
+
}), l.get(`${c}/meta`, (r) => {
|
|
117
119
|
try {
|
|
118
|
-
const e =
|
|
119
|
-
return r.json(
|
|
120
|
+
const e = n.getMetadata();
|
|
121
|
+
return r.json(A(e));
|
|
120
122
|
} catch (e) {
|
|
121
123
|
return console.error("Metadata error:", e), r.json({
|
|
122
124
|
error: e instanceof Error ? e.message : "Failed to fetch metadata"
|
|
123
125
|
}, 500);
|
|
124
126
|
}
|
|
125
|
-
}),
|
|
127
|
+
}), l.post(`${c}/sql`, async (r) => {
|
|
126
128
|
try {
|
|
127
|
-
const e = await r.req.json(), t = await d(r),
|
|
128
|
-
if (!
|
|
129
|
+
const e = await r.req.json(), t = await d(r), u = n.validateQuery(e);
|
|
130
|
+
if (!u.isValid)
|
|
129
131
|
return r.json({
|
|
130
|
-
error: `Query validation failed: ${
|
|
132
|
+
error: `Query validation failed: ${u.errors.join(", ")}`
|
|
131
133
|
}, 400);
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
134
|
+
const s = e.measures?.[0] || e.dimensions?.[0];
|
|
135
|
+
if (!s)
|
|
134
136
|
return r.json({
|
|
135
137
|
error: "No measures or dimensions specified"
|
|
136
138
|
}, 400);
|
|
137
|
-
const
|
|
138
|
-
return r.json(
|
|
139
|
+
const q = s.split(".")[0], j = await n.generateSQL(q, e, t);
|
|
140
|
+
return r.json(p(e, j));
|
|
139
141
|
} catch (e) {
|
|
140
142
|
return console.error("SQL generation error:", e), r.json({
|
|
141
143
|
error: e instanceof Error ? e.message : "SQL generation failed"
|
|
142
144
|
}, 500);
|
|
143
145
|
}
|
|
144
|
-
}),
|
|
146
|
+
}), l.get(`${c}/sql`, async (r) => {
|
|
145
147
|
try {
|
|
146
148
|
const e = r.req.query("query");
|
|
147
149
|
if (!e)
|
|
148
150
|
return r.json({
|
|
149
151
|
error: "Query parameter is required"
|
|
150
152
|
}, 400);
|
|
151
|
-
const t = JSON.parse(e),
|
|
152
|
-
if (!
|
|
153
|
+
const t = JSON.parse(e), u = await d(r), s = n.validateQuery(t);
|
|
154
|
+
if (!s.isValid)
|
|
153
155
|
return r.json({
|
|
154
|
-
error: `Query validation failed: ${
|
|
156
|
+
error: `Query validation failed: ${s.errors.join(", ")}`
|
|
155
157
|
}, 400);
|
|
156
|
-
const
|
|
157
|
-
if (!
|
|
158
|
+
const q = t.measures?.[0] || t.dimensions?.[0];
|
|
159
|
+
if (!q)
|
|
158
160
|
return r.json({
|
|
159
161
|
error: "No measures or dimensions specified"
|
|
160
162
|
}, 400);
|
|
161
|
-
const
|
|
162
|
-
return r.json(
|
|
163
|
+
const j = q.split(".")[0], x = await n.generateSQL(j, t, u);
|
|
164
|
+
return r.json(p(t, x));
|
|
163
165
|
} catch (e) {
|
|
164
166
|
return console.error("SQL generation error:", e), r.json({
|
|
165
167
|
error: e instanceof Error ? e.message : "SQL generation failed"
|
|
166
168
|
}, 500);
|
|
167
169
|
}
|
|
168
|
-
}),
|
|
170
|
+
}), l.post(`${c}/dry-run`, async (r) => {
|
|
169
171
|
try {
|
|
170
|
-
const e = await r.req.json(), t = e.query || e,
|
|
171
|
-
return r.json(
|
|
172
|
+
const e = await r.req.json(), t = e.query || e, u = await d(r), s = await w(t, u, n);
|
|
173
|
+
return r.json(s);
|
|
172
174
|
} catch (e) {
|
|
173
175
|
return console.error("Dry-run error:", e), r.json({
|
|
174
176
|
error: e instanceof Error ? e.message : "Dry-run validation failed",
|
|
175
177
|
valid: !1
|
|
176
178
|
}, 400);
|
|
177
179
|
}
|
|
178
|
-
}),
|
|
180
|
+
}), l.get(`${c}/dry-run`, async (r) => {
|
|
179
181
|
try {
|
|
180
182
|
const e = r.req.query("query");
|
|
181
183
|
if (!e)
|
|
@@ -183,26 +185,26 @@ function v(y) {
|
|
|
183
185
|
error: "Query parameter is required",
|
|
184
186
|
valid: !1
|
|
185
187
|
}, 400);
|
|
186
|
-
const t = JSON.parse(e),
|
|
187
|
-
return r.json(
|
|
188
|
+
const t = JSON.parse(e), u = await d(r), s = await w(t, u, n);
|
|
189
|
+
return r.json(s);
|
|
188
190
|
} catch (e) {
|
|
189
191
|
return console.error("Dry-run error:", e), r.json({
|
|
190
192
|
error: e instanceof Error ? e.message : "Dry-run validation failed",
|
|
191
193
|
valid: !1
|
|
192
194
|
}, 400);
|
|
193
195
|
}
|
|
194
|
-
}),
|
|
196
|
+
}), l;
|
|
195
197
|
}
|
|
196
|
-
function
|
|
197
|
-
const
|
|
198
|
-
return
|
|
198
|
+
function E(f, m) {
|
|
199
|
+
const i = S(m);
|
|
200
|
+
return f.route("/", i), f;
|
|
199
201
|
}
|
|
200
|
-
function
|
|
201
|
-
const
|
|
202
|
-
return
|
|
202
|
+
function $(f) {
|
|
203
|
+
const m = new C();
|
|
204
|
+
return E(m, f);
|
|
203
205
|
}
|
|
204
206
|
export {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
$ as createCubeApp,
|
|
208
|
+
S as createCubeRoutes,
|
|
209
|
+
E as mountCubeRoutes
|
|
208
210
|
};
|