drizzle-cube 0.4.15 → 0.4.16

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.
@@ -32591,13 +32591,13 @@ function vT() {
32591
32591
  properties: {
32592
32592
  measures: {
32593
32593
  type: "array",
32594
- items: { type: "string" },
32595
- description: 'Aggregation measures (e.g., ["Employees.count"])'
32594
+ items: { type: "string", pattern: "^[A-Z][a-zA-Z0-9]*\\.[a-zA-Z][a-zA-Z0-9]*$" },
32595
+ description: 'Aggregation measures — MUST be "CubeName.measureName" format (e.g., ["PullRequests.count", "Issues.openCount"]). NEVER use just the cube name.'
32596
32596
  },
32597
32597
  dimensions: {
32598
32598
  type: "array",
32599
- items: { type: "string" },
32600
- description: 'Grouping dimensions (e.g., ["Employees.name"])'
32599
+ items: { type: "string", pattern: "^[A-Z][a-zA-Z0-9]*\\.[a-zA-Z][a-zA-Z0-9]*$" },
32600
+ description: 'Grouping dimensions — MUST be "CubeName.dimensionName" format (e.g., ["Teams.name", "Employees.department"]). NEVER use just the cube name.'
32601
32601
  },
32602
32602
  filters: {
32603
32603
  type: "array",
@@ -32867,8 +32867,17 @@ function $T(r) {
32867
32867
  return { result: JSON.stringify(n, null, 2) };
32868
32868
  }), s.set("execute_query", async (n) => {
32869
32869
  try {
32870
- let i;
32871
- n.funnel ? i = { funnel: n.funnel } : n.flow ? i = { flow: n.flow } : n.retention ? i = { retention: n.retention } : i = {
32870
+ const i = (A, o) => {
32871
+ if (!Array.isArray(A)) return;
32872
+ const R = A.filter((S) => typeof S == "string" && !S.includes("."));
32873
+ if (R.length > 0)
32874
+ throw new Error(
32875
+ `Invalid ${o}: ${R.map((S) => `"${S}"`).join(", ")}. All ${o} must use "CubeName.fieldName" format (e.g., "PullRequests.count", "Teams.name"). Use discover_cubes or get_cube_metadata to find valid field names.`
32876
+ );
32877
+ };
32878
+ i(n.measures, "measures"), i(n.dimensions, "dimensions");
32879
+ let E;
32880
+ n.funnel ? E = { funnel: n.funnel } : n.flow ? E = { flow: n.flow } : n.retention ? E = { retention: n.retention } : E = {
32872
32881
  measures: n.measures,
32873
32882
  dimensions: n.dimensions,
32874
32883
  filters: n.filters,
@@ -32876,12 +32885,12 @@ function $T(r) {
32876
32885
  order: n.order,
32877
32886
  limit: n.limit
32878
32887
  };
32879
- const E = await jo(e, t, { query: i });
32888
+ const a = await jo(e, t, { query: E });
32880
32889
  return {
32881
32890
  result: JSON.stringify({
32882
- rowCount: E.data.length,
32883
- data: E.data,
32884
- annotation: E.annotation
32891
+ rowCount: a.data.length,
32892
+ data: a.data,
32893
+ annotation: a.annotation
32885
32894
  }, null, 2)
32886
32895
  };
32887
32896
  } catch (i) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-cube",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "description": "Drizzle ORM-first semantic layer with Cube.js compatibility. Type-safe analytics and dashboards with SQL injection protection.",
5
5
  "main": "./dist/server/index.js",
6
6
  "types": "./dist/server/index.d.ts",