drizzle-cube 0.1.39 → 0.1.41

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.
@@ -450,8 +450,11 @@ declare interface Measure {
450
450
  title?: string;
451
451
  description?: string;
452
452
  type: MeasureType;
453
- /** Column to aggregate or SQL expression */
454
- sql: AnyColumn | SQL | ((ctx: QueryContext) => AnyColumn | SQL);
453
+ /**
454
+ * Column to aggregate or SQL expression
455
+ * Optional for calculated measures (type: 'calculated') which use calculatedSql instead
456
+ */
457
+ sql?: AnyColumn | SQL | ((ctx: QueryContext) => AnyColumn | SQL);
455
458
  /** Display format */
456
459
  format?: string;
457
460
  /** Whether to show in UI */
@@ -1252,6 +1252,10 @@ class sR {
1252
1252
  throw new Error(
1253
1253
  `Cannot build calculated measure '${E.name}' directly. Use buildCalculatedMeasure instead.`
1254
1254
  );
1255
+ if (!E.sql)
1256
+ throw new Error(
1257
+ `Measure '${E.name}' of type '${E.type}' is missing required 'sql' property. Only calculated measures can omit 'sql'.`
1258
+ );
1255
1259
  let A = X(E.sql, T);
1256
1260
  if (E.filters && E.filters.length > 0) {
1257
1261
  const e = E.filters.map((S) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-cube",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
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",