drizzle-cube 0.1.15 → 0.1.17

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.
@@ -1000,16 +1000,16 @@ class AR {
1000
1000
  const [e, s] = t.split("."), i = C.get(e);
1001
1001
  if (i && i.dimensions && i.dimensions[s])
1002
1002
  if ((r = S == null ? void 0 : S.preAggregationCTEs) == null ? void 0 : r.some((M) => M.cube.name === e)) {
1003
- const M = S.preAggregationCTEs.find((G) => G.cube.name === e), P = M.joinKeys.find((G) => G.targetColumn === s);
1004
- if (P && P.sourceColumnObj)
1005
- I.push(P.sourceColumnObj);
1003
+ const M = S.preAggregationCTEs.find((G) => G.cube.name === e), o = M.joinKeys.find((G) => G.targetColumn === s);
1004
+ if (o && o.sourceColumnObj)
1005
+ I.push(o.sourceColumnObj);
1006
1006
  else {
1007
1007
  const G = n`${n.identifier(M.cteAlias)}.${n.identifier(s)}`;
1008
1008
  I.push(G);
1009
1009
  }
1010
1010
  } else {
1011
- const M = i.dimensions[s], P = K(M.sql, A);
1012
- I.push(P);
1011
+ const M = i.dimensions[s], o = K(M.sql, A);
1012
+ I.push(o);
1013
1013
  }
1014
1014
  }
1015
1015
  if (R.timeDimensions)
@@ -1017,10 +1017,10 @@ class AR {
1017
1017
  const [e, s] = t.dimension.split("."), i = C.get(e);
1018
1018
  if (i && i.dimensions && i.dimensions[s])
1019
1019
  if ((O = S == null ? void 0 : S.preAggregationCTEs) == null ? void 0 : O.some((M) => M.cube.name === e)) {
1020
- const M = S.preAggregationCTEs.find((G) => G.cube.name === e), P = M.joinKeys.find((G) => G.targetColumn === s);
1021
- if (P && P.sourceColumnObj) {
1020
+ const M = S.preAggregationCTEs.find((G) => G.cube.name === e), o = M.joinKeys.find((G) => G.targetColumn === s);
1021
+ if (o && o.sourceColumnObj) {
1022
1022
  const G = this.buildTimeDimensionExpression(
1023
- P.sourceColumnObj,
1023
+ o.sourceColumnObj,
1024
1024
  t.granularity,
1025
1025
  A
1026
1026
  );
@@ -1030,12 +1030,12 @@ class AR {
1030
1030
  I.push(G);
1031
1031
  }
1032
1032
  } else {
1033
- const M = i.dimensions[s], P = this.buildTimeDimensionExpression(
1033
+ const M = i.dimensions[s], o = this.buildTimeDimensionExpression(
1034
1034
  M.sql,
1035
1035
  t.granularity,
1036
1036
  A
1037
1037
  );
1038
- I.push(P);
1038
+ I.push(o);
1039
1039
  }
1040
1040
  }
1041
1041
  return I;
@@ -1395,7 +1395,7 @@ class IE {
1395
1395
  if (a.dimension in i) {
1396
1396
  let M = i[a.dimension];
1397
1397
  if (typeof M == "string" && M.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)) {
1398
- const P = M.replace(" ", "T"), G = !P.endsWith("Z") && !P.includes("+") ? P + "Z" : P;
1398
+ const o = M.replace(" ", "T"), G = !o.endsWith("Z") && !o.includes("+") ? o + "Z" : o;
1399
1399
  M = new Date(G);
1400
1400
  }
1401
1401
  M = this.databaseAdapter.convertTimeDimensionResult(M), i[a.dimension] = M;
@@ -1424,34 +1424,34 @@ class IE {
1424
1424
  buildPreAggregationCTE(E, R, A, S) {
1425
1425
  var M;
1426
1426
  const I = E.cube, N = I.sql(A), C = {};
1427
- for (const P of E.joinKeys)
1428
- if (P.targetColumnObj) {
1429
- C[P.targetColumn] = P.targetColumnObj;
1430
- for (const [G, o] of Object.entries(I.dimensions || {}))
1431
- o.sql === P.targetColumnObj && G !== P.targetColumn && (C[G] = n`${P.targetColumnObj}`.as(G));
1427
+ for (const o of E.joinKeys)
1428
+ if (o.targetColumnObj) {
1429
+ C[o.targetColumn] = o.targetColumnObj;
1430
+ for (const [G, P] of Object.entries(I.dimensions || {}))
1431
+ P.sql === o.targetColumnObj && G !== o.targetColumn && (C[G] = n`${o.targetColumnObj}`.as(G));
1432
1432
  }
1433
- for (const P of E.measures) {
1434
- const [, G] = P.split(".");
1433
+ for (const o of E.measures) {
1434
+ const [, G] = o.split(".");
1435
1435
  if (I.measures && I.measures[G]) {
1436
- const o = I.measures[G], l = this.queryBuilder.buildMeasureExpression(o, A);
1437
- C[G] = n`${l}`.as(G);
1436
+ const P = I.measures[G], H = this.queryBuilder.buildMeasureExpression(P, A);
1437
+ C[G] = n`${H}`.as(G);
1438
1438
  }
1439
1439
  }
1440
1440
  const r = I.name;
1441
1441
  if (R.dimensions)
1442
- for (const P of R.dimensions) {
1443
- const [G, o] = P.split(".");
1444
- if (G === r && I.dimensions && I.dimensions[o]) {
1445
- const l = I.dimensions[o], H = this.queryBuilder.buildMeasureExpression({ sql: l.sql, type: "number" }, A);
1446
- C[o] = n`${H}`.as(o);
1442
+ for (const o of R.dimensions) {
1443
+ const [G, P] = o.split(".");
1444
+ if (G === r && I.dimensions && I.dimensions[P]) {
1445
+ const H = I.dimensions[P], l = this.queryBuilder.buildMeasureExpression({ sql: H.sql, type: "number" }, A);
1446
+ C[P] = n`${l}`.as(P);
1447
1447
  }
1448
1448
  }
1449
1449
  if (R.timeDimensions)
1450
- for (const P of R.timeDimensions) {
1451
- const [G, o] = P.dimension.split(".");
1452
- if (G === r && I.dimensions && I.dimensions[o]) {
1453
- const l = I.dimensions[o], H = this.queryBuilder.buildTimeDimensionExpression(l.sql, P.granularity, A);
1454
- C[o] = n`${H}`.as(o);
1450
+ for (const o of R.timeDimensions) {
1451
+ const [G, P] = o.dimension.split(".");
1452
+ if (G === r && I.dimensions && I.dimensions[P]) {
1453
+ const H = I.dimensions[P], l = this.queryBuilder.buildTimeDimensionExpression(H.sql, o.granularity, A);
1454
+ C[P] = n`${l}`.as(P);
1455
1455
  }
1456
1456
  }
1457
1457
  if (Object.keys(C).length === 0)
@@ -1459,24 +1459,24 @@ class IE {
1459
1459
  let O = A.db.select(C).from(N.from);
1460
1460
  const t = S ? {
1461
1461
  ...S,
1462
- preAggregationCTEs: (M = S.preAggregationCTEs) == null ? void 0 : M.filter((P) => P.cube.name !== I.name)
1462
+ preAggregationCTEs: (M = S.preAggregationCTEs) == null ? void 0 : M.filter((o) => o.cube.name !== I.name)
1463
1463
  } : void 0, e = this.queryBuilder.buildWhereConditions(I, R, A, t), s = [];
1464
1464
  if (R.timeDimensions)
1465
- for (const P of R.timeDimensions) {
1466
- const [G, o] = P.dimension.split(".");
1467
- if (G === r && I.dimensions && I.dimensions[o] && P.dateRange) {
1468
- const l = I.dimensions[o], H = this.queryBuilder.buildMeasureExpression({ sql: l.sql, type: "number" }, A), B = this.queryBuilder.buildDateRangeCondition(H, P.dateRange);
1465
+ for (const o of R.timeDimensions) {
1466
+ const [G, P] = o.dimension.split(".");
1467
+ if (G === r && I.dimensions && I.dimensions[P] && o.dateRange) {
1468
+ const H = I.dimensions[P], l = this.queryBuilder.buildMeasureExpression({ sql: H.sql, type: "number" }, A), B = this.queryBuilder.buildDateRangeCondition(l, o.dateRange);
1469
1469
  B && s.push(B);
1470
1470
  }
1471
1471
  }
1472
1472
  if (R.filters) {
1473
- for (const P of R.filters)
1474
- if (!("and" in P) && !("or" in P) && "member" in P && "operator" in P) {
1475
- const G = P, [o, l] = G.member.split(".");
1476
- if (o === r && I.dimensions && I.dimensions[l]) {
1477
- const H = I.dimensions[l];
1473
+ for (const o of R.filters)
1474
+ if (!("and" in o) && !("or" in o) && "member" in o && "operator" in o) {
1475
+ const G = o, [P, H] = G.member.split(".");
1476
+ if (P === r && I.dimensions && I.dimensions[H]) {
1477
+ const l = I.dimensions[H];
1478
1478
  if (G.operator === "inDateRange") {
1479
- const B = this.queryBuilder.buildMeasureExpression({ sql: H.sql, type: "number" }, A), u = this.queryBuilder.buildDateRangeCondition(B, G.values);
1479
+ const B = this.queryBuilder.buildMeasureExpression({ sql: l.sql, type: "number" }, A), u = this.queryBuilder.buildDateRangeCondition(B, G.values);
1480
1480
  u && s.push(u);
1481
1481
  }
1482
1482
  }
@@ -1484,26 +1484,26 @@ class IE {
1484
1484
  }
1485
1485
  const i = [];
1486
1486
  if (N.where && i.push(N.where), i.push(...e, ...s), i.length > 0) {
1487
- const P = i.length === 1 ? i[0] : d(...i);
1488
- O = O.where(P);
1487
+ const o = i.length === 1 ? i[0] : d(...i);
1488
+ O = O.where(o);
1489
1489
  }
1490
1490
  const a = [];
1491
- for (const P of E.joinKeys)
1492
- P.targetColumnObj && a.push(P.targetColumnObj);
1491
+ for (const o of E.joinKeys)
1492
+ o.targetColumnObj && a.push(o.targetColumnObj);
1493
1493
  if (R.dimensions)
1494
- for (const P of R.dimensions) {
1495
- const [G, o] = P.split(".");
1496
- if (G === r && I.dimensions && I.dimensions[o]) {
1497
- const l = I.dimensions[o], H = K(l.sql, A);
1498
- a.push(H);
1494
+ for (const o of R.dimensions) {
1495
+ const [G, P] = o.split(".");
1496
+ if (G === r && I.dimensions && I.dimensions[P]) {
1497
+ const H = I.dimensions[P], l = K(H.sql, A);
1498
+ a.push(l);
1499
1499
  }
1500
1500
  }
1501
1501
  if (R.timeDimensions)
1502
- for (const P of R.timeDimensions) {
1503
- const [G, o] = P.dimension.split(".");
1504
- if (G === r && I.dimensions && I.dimensions[o]) {
1505
- const l = I.dimensions[o], H = this.queryBuilder.buildTimeDimensionExpression(l.sql, P.granularity, A);
1506
- a.push(H);
1502
+ for (const o of R.timeDimensions) {
1503
+ const [G, P] = o.dimension.split(".");
1504
+ if (G === r && I.dimensions && I.dimensions[P]) {
1505
+ const H = I.dimensions[P], l = this.queryBuilder.buildTimeDimensionExpression(H.sql, o.granularity, A);
1506
+ a.push(l);
1507
1507
  }
1508
1508
  }
1509
1509
  return a.length > 0 && (O = O.groupBy(...a)), A.db.$with(E.cteAlias).as(O);
@@ -1528,12 +1528,12 @@ class IE {
1528
1528
  * Build unified query that works for both single and multi-cube queries
1529
1529
  */
1530
1530
  buildUnifiedQuery(E, R, A) {
1531
- var M, P, G;
1531
+ var M, o, G;
1532
1532
  const S = [], I = /* @__PURE__ */ new Map();
1533
1533
  if (E.preAggregationCTEs && E.preAggregationCTEs.length > 0)
1534
- for (const o of E.preAggregationCTEs) {
1535
- const l = this.buildPreAggregationCTE(o, R, A, E);
1536
- l && (S.push(l), I.set(o.cube.name, o.cteAlias));
1534
+ for (const P of E.preAggregationCTEs) {
1535
+ const H = this.buildPreAggregationCTE(P, R, A, E);
1536
+ H && (S.push(H), I.set(P.cube.name, P.cteAlias));
1537
1537
  }
1538
1538
  const N = E.primaryCube.sql(A), r = { ...this.queryBuilder.buildSelections(
1539
1539
  E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
@@ -1542,13 +1542,13 @@ class IE {
1542
1542
  A
1543
1543
  ) };
1544
1544
  if (E.preAggregationCTEs)
1545
- for (const o of E.preAggregationCTEs) {
1546
- const l = o.cube.name;
1547
- for (const H of o.measures)
1548
- if (r[H]) {
1549
- const [, B] = H.split("."), u = this.getCubesFromPlan(E).get(l);
1545
+ for (const P of E.preAggregationCTEs) {
1546
+ const H = P.cube.name;
1547
+ for (const l of P.measures)
1548
+ if (r[l]) {
1549
+ const [, B] = l.split("."), u = this.getCubesFromPlan(E).get(H);
1550
1550
  if (u && u.measures && u.measures[B]) {
1551
- const p = u.measures[B], W = n`${n.identifier(o.cteAlias)}.${n.identifier(B)}`;
1551
+ const p = u.measures[B], W = n`${n.identifier(P.cteAlias)}.${n.identifier(B)}`;
1552
1552
  let h;
1553
1553
  switch (p.type) {
1554
1554
  case "count":
@@ -1571,66 +1571,72 @@ class IE {
1571
1571
  default:
1572
1572
  h = y(W);
1573
1573
  }
1574
- r[H] = n`${h}`.as(H);
1574
+ r[l] = n`${h}`.as(l);
1575
1575
  }
1576
1576
  }
1577
- for (const H in r) {
1578
- const [B, u] = H.split(".");
1579
- if (B === l) {
1580
- const p = this.getCubesFromPlan(E).get(l), W = p && ((M = p.dimensions) == null ? void 0 : M[u]), h = H.startsWith(l + ".");
1577
+ for (const l in r) {
1578
+ const [B, u] = l.split(".");
1579
+ if (B === H) {
1580
+ const p = this.getCubesFromPlan(E).get(H), W = p && ((M = p.dimensions) == null ? void 0 : M[u]), h = l.startsWith(H + ".");
1581
1581
  if (W || h) {
1582
- let RE = o.joinKeys.find((AE) => AE.targetColumn === u);
1583
- if (!RE && ((P = p == null ? void 0 : p.dimensions) != null && P[u])) {
1582
+ let RE = P.joinKeys.find((AE) => AE.targetColumn === u);
1583
+ if (!RE && ((o = p == null ? void 0 : p.dimensions) != null && o[u])) {
1584
1584
  const AE = p.dimensions[u].sql;
1585
- RE = o.joinKeys.find((WT) => WT.targetColumnObj === AE);
1585
+ RE = P.joinKeys.find((WT) => WT.targetColumnObj === AE);
1586
1586
  }
1587
- RE ? r[H] = n`${n.identifier(o.cteAlias)}.${n.identifier(u)}`.as(H) : h && ((G = p == null ? void 0 : p.dimensions) != null && G[u]) && (r[H] = n`${n.identifier(o.cteAlias)}.${n.identifier(u)}`.as(H));
1587
+ RE ? r[l] = n`${n.identifier(P.cteAlias)}.${n.identifier(u)}`.as(l) : h && ((G = p == null ? void 0 : p.dimensions) != null && G[u]) && (r[l] = n`${n.identifier(P.cteAlias)}.${n.identifier(u)}`.as(l));
1588
1588
  }
1589
1589
  }
1590
1590
  }
1591
1591
  }
1592
1592
  let O = A.db.select(r).from(N.from);
1593
1593
  if (S.length > 0 && (O = A.db.with(...S).select(r).from(N.from)), N.joins)
1594
- for (const o of N.joins)
1595
- switch (o.type || "left") {
1594
+ for (const P of N.joins)
1595
+ switch (P.type || "left") {
1596
1596
  case "left":
1597
- O = O.leftJoin(o.table, o.on);
1597
+ O = O.leftJoin(P.table, P.on);
1598
1598
  break;
1599
1599
  case "inner":
1600
- O = O.innerJoin(o.table, o.on);
1600
+ O = O.innerJoin(P.table, P.on);
1601
1601
  break;
1602
1602
  case "right":
1603
- O = O.rightJoin(o.table, o.on);
1603
+ O = O.rightJoin(P.table, P.on);
1604
1604
  break;
1605
1605
  case "full":
1606
- O = O.fullJoin(o.table, o.on);
1606
+ O = O.fullJoin(P.table, P.on);
1607
1607
  break;
1608
1608
  }
1609
1609
  if (E.joinCubes && E.joinCubes.length > 0)
1610
- for (const o of E.joinCubes) {
1611
- const l = I.get(o.cube.name);
1612
- let H, B;
1613
- l ? (H = n`${n.identifier(l)}`, B = this.buildCTEJoinCondition(o, l, E)) : (H = o.cube.sql(A).from, B = o.joinCondition);
1610
+ for (const P of E.joinCubes) {
1611
+ const H = I.get(P.cube.name);
1612
+ let l, B;
1613
+ H ? (l = n`${n.identifier(H)}`, B = this.buildCTEJoinCondition(P, H, E)) : (l = P.cube.sql(A).from, B = P.joinCondition);
1614
1614
  try {
1615
- switch (o.joinType || "left") {
1615
+ switch (P.joinType || "left") {
1616
1616
  case "left":
1617
- O = O.leftJoin(H, B);
1617
+ O = O.leftJoin(l, B);
1618
1618
  break;
1619
1619
  case "inner":
1620
- O = O.innerJoin(H, B);
1620
+ O = O.innerJoin(l, B);
1621
1621
  break;
1622
1622
  case "right":
1623
- O = O.rightJoin(H, B);
1623
+ O = O.rightJoin(l, B);
1624
1624
  break;
1625
1625
  case "full":
1626
- O = O.fullJoin(H, B);
1626
+ O = O.fullJoin(l, B);
1627
1627
  break;
1628
1628
  }
1629
1629
  } catch {
1630
1630
  }
1631
1631
  }
1632
1632
  const t = [];
1633
- N.where && t.push(N.where);
1633
+ if (N.where && t.push(N.where), E.joinCubes && E.joinCubes.length > 0)
1634
+ for (const P of E.joinCubes) {
1635
+ if (I.get(P.cube.name))
1636
+ continue;
1637
+ const l = P.cube.sql(A);
1638
+ l.where && t.push(l.where);
1639
+ }
1634
1640
  const e = this.queryBuilder.buildWhereConditions(
1635
1641
  E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
1636
1642
  // Single cube
@@ -1640,8 +1646,8 @@ class IE {
1640
1646
  // Pass the queryPlan to handle CTE scenarios
1641
1647
  );
1642
1648
  if (e.length > 0 && t.push(...e), t.length > 0) {
1643
- const o = t.length === 1 ? t[0] : d(...t);
1644
- O = O.where(o);
1649
+ const P = t.length === 1 ? t[0] : d(...t);
1650
+ O = O.where(P);
1645
1651
  }
1646
1652
  const s = this.queryBuilder.buildGroupByFields(
1647
1653
  E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
@@ -1661,8 +1667,8 @@ class IE {
1661
1667
  // Pass the queryPlan to handle CTE scenarios
1662
1668
  );
1663
1669
  if (i.length > 0) {
1664
- const o = i.length === 1 ? i[0] : d(...i);
1665
- O = O.having(o);
1670
+ const P = i.length === 1 ? i[0] : d(...i);
1671
+ O = O.having(P);
1666
1672
  }
1667
1673
  const a = this.queryBuilder.buildOrderBy(R);
1668
1674
  return a.length > 0 && (O = O.orderBy(...a)), O = this.queryBuilder.applyLimitAndOffset(O, R), O;
@@ -17710,29 +17716,29 @@ var uT = { exports: {} };
17710
17716
  var a = t[i];
17711
17717
  if (a.isComplete) {
17712
17718
  if (a.finish(), a.data !== N.fail) {
17713
- for (var M = a.wantedBy, P = M.length; P--; ) {
17714
- var G = M[P];
17719
+ for (var M = a.wantedBy, o = M.length; o--; ) {
17720
+ var G = M[o];
17715
17721
  this.complete(G, a);
17716
17722
  }
17717
17723
  if (a.reference === this.index) {
17718
- var o = a.rule.name;
17719
- (this.completed[o] = this.completed[o] || []).push(a);
17724
+ var P = a.rule.name;
17725
+ (this.completed[P] = this.completed[P] || []).push(a);
17720
17726
  }
17721
17727
  }
17722
17728
  } else {
17723
- var o = a.rule.symbols[a.dot];
17724
- if (typeof o != "string") {
17729
+ var P = a.rule.symbols[a.dot];
17730
+ if (typeof P != "string") {
17725
17731
  this.scannable.push(a);
17726
17732
  continue;
17727
17733
  }
17728
- if (e[o]) {
17729
- if (e[o].push(a), s.hasOwnProperty(o))
17730
- for (var l = s[o], P = 0; P < l.length; P++) {
17731
- var H = l[P];
17732
- this.complete(a, H);
17734
+ if (e[P]) {
17735
+ if (e[P].push(a), s.hasOwnProperty(P))
17736
+ for (var H = s[P], o = 0; o < H.length; o++) {
17737
+ var l = H[o];
17738
+ this.complete(a, l);
17733
17739
  }
17734
17740
  } else
17735
- e[o] = [a], this.predict(o);
17741
+ e[P] = [a], this.predict(P);
17736
17742
  }
17737
17743
  }
17738
17744
  }, A.prototype.predict = function(O) {
@@ -17788,17 +17794,17 @@ var uT = { exports: {} };
17788
17794
  var a = this.index - this.lastLineBreak, M = String(this.line).length;
17789
17795
  return t += " at line " + this.line + " col " + a + `:
17790
17796
 
17791
- `, t += s.map(function(G, o) {
17792
- return P(this.line - s.length + o + 1, M) + " " + G;
17797
+ `, t += s.map(function(G, P) {
17798
+ return o(this.line - s.length + P + 1, M) + " " + G;
17793
17799
  }, this).join(`
17794
17800
  `), t += `
17795
- ` + P("", M + a) + `^
17801
+ ` + o("", M + a) + `^
17796
17802
  `, t;
17797
17803
  } else
17798
17804
  return t + " at index " + (this.index - 1);
17799
- function P(G, o) {
17800
- var l = String(G);
17801
- return Array(o - l.length + 1).join(" ") + l;
17805
+ function o(G, P) {
17806
+ var H = String(G);
17807
+ return Array(P - H.length + 1).join(" ") + H;
17802
17808
  }
17803
17809
  };
17804
17810
  function N(O, t, e) {
@@ -17833,10 +17839,10 @@ var uT = { exports: {} };
17833
17839
  this.options.keepHistory || delete this.table[this.current - 1];
17834
17840
  var a = this.current + 1, M = new A(this.grammar, a);
17835
17841
  this.table.push(M);
17836
- for (var P = e.text !== void 0 ? e.text : e.value, G = t.constructor === I ? e.value : e, o = i.scannable, l = o.length; l--; ) {
17837
- var H = o[l], B = H.rule.symbols[H.dot];
17838
- if (B.test ? B.test(G) : B.type ? B.type === e.type : B.literal === P) {
17839
- var u = H.nextState({ data: G, token: e, isToken: !0, reference: a - 1 });
17842
+ for (var o = e.text !== void 0 ? e.text : e.value, G = t.constructor === I ? e.value : e, P = i.scannable, H = P.length; H--; ) {
17843
+ var l = P[H], B = l.rule.symbols[l.dot];
17844
+ if (B.test ? B.test(G) : B.type ? B.type === e.type : B.literal === o) {
17845
+ var u = l.nextState({ data: G, token: e, isToken: !0, reference: a - 1 });
17840
17846
  M.states.push(u);
17841
17847
  }
17842
17848
  }
@@ -17856,8 +17862,8 @@ var uT = { exports: {} };
17856
17862
  }, N.prototype.reportErrorCommon = function(O, t) {
17857
17863
  var e = [];
17858
17864
  e.push(O);
17859
- var s = this.table.length - 2, i = this.table[s], a = i.states.filter(function(P) {
17860
- var G = P.rule.symbols[P.dot];
17865
+ var s = this.table.length - 2, i = this.table[s], a = i.states.filter(function(o) {
17866
+ var G = o.rule.symbols[o.dot];
17861
17867
  return G && typeof G != "string";
17862
17868
  });
17863
17869
  if (a.length === 0)
@@ -17866,12 +17872,12 @@ var uT = { exports: {} };
17866
17872
  else {
17867
17873
  e.push("Unexpected " + t + `. Instead, I was expecting to see one of the following:
17868
17874
  `);
17869
- var M = a.map(function(P) {
17870
- return this.buildFirstStateStack(P, []) || [P];
17875
+ var M = a.map(function(o) {
17876
+ return this.buildFirstStateStack(o, []) || [o];
17871
17877
  }, this);
17872
- M.forEach(function(P) {
17873
- var G = P[0], o = G.rule.symbols[G.dot], l = this.getSymbolDisplay(o);
17874
- e.push("A " + l + " based on:"), this.displayStateStack(P, e);
17878
+ M.forEach(function(o) {
17879
+ var G = o[0], P = G.rule.symbols[G.dot], H = this.getSymbolDisplay(P);
17880
+ e.push("A " + H + " based on:"), this.displayStateStack(o, e);
17875
17881
  }, this);
17876
17882
  }
17877
17883
  return e.push(""), e.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-cube",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
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",
@@ -58,17 +58,17 @@
58
58
  "LICENSE"
59
59
  ],
60
60
  "scripts": {
61
- "dev": "concurrently \"npm run dev:server\" \"npm run dev:client\" \"npm run dev:examples\" \"npm run dev:help\"",
62
- "dev:server": "vite build src/server --watch --mode development",
63
- "dev:client": "vite build src/client --watch --mode development",
64
- "dev:examples": "cd examples/hono-app && npm run dev",
65
- "dev:help": "cd help-site && npm run dev",
66
- "build": "npm run build:server && npm run build:client && npm run build:adapters && npm run build:help",
61
+ "dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",
62
+ "dev:server": "tsx watch dev/server/index.ts",
63
+ "dev:client": "cd dev/client && vite",
64
+ "dev:build": "concurrently \"npm run dev:build-server\" \"npm run dev:build-client\"",
65
+ "dev:build-server": "vite build src/server --watch --mode development",
66
+ "dev:build-client": "vite build src/client --watch --mode development",
67
+ "build": "npm run build:server && npm run build:client && npm run build:adapters",
67
68
  "build:server": "vite build --config vite.config.server.ts",
68
69
  "build:client": "vite build --config vite.config.client.ts",
69
70
  "analyze:client": "vite build --config vite.config.client.ts && open dist/client-bundle-stats.html",
70
71
  "build:adapters": "vite build --config vite.config.adapters.ts",
71
- "build:help": "cd help-site && npm run build",
72
72
  "test": "vitest run",
73
73
  "test:watch": "vitest --watch",
74
74
  "test:postgres": "vitest run",
@@ -80,7 +80,12 @@
80
80
  "typecheck": "tsc --noEmit",
81
81
  "lint": "eslint src/**/*.ts",
82
82
  "lint:fix": "eslint src/**/*.ts --fix",
83
- "prepublishOnly": "npm run build && npm run test && npm run typecheck"
83
+ "prepublishOnly": "npm run build && npm run test && npm run typecheck",
84
+ "dev:db:up": "cd dev && docker-compose up -d",
85
+ "dev:db:down": "cd dev && docker-compose down",
86
+ "dev:db:migrate": "cd dev && tsx scripts/migrate.ts",
87
+ "dev:db:seed": "cd dev && tsx scripts/seed.ts",
88
+ "dev:setup": "npm run dev:db:up && sleep 5 && npm run dev:db:migrate && npm run dev:db:seed"
84
89
  },
85
90
  "keywords": [
86
91
  "drizzle-orm",
@@ -112,22 +117,28 @@
112
117
  "peerDependencies": {
113
118
  "@neondatabase/serverless": "^1.0.1",
114
119
  "cors": "^2.8.5",
120
+ "d3": "^7.9.0",
115
121
  "drizzle-orm": "^0.44.4",
116
122
  "express": "^5.0.0",
117
123
  "fastify": "^5.0.0",
118
124
  "hono": "^4.0.0",
119
125
  "react": "^18.0.0",
120
- "react-dom": "^18.0.0"
126
+ "react-dom": "^18.0.0",
127
+ "react-grid-layout": "^1.4.0",
128
+ "recharts": "^2.8.0"
121
129
  },
122
130
  "peerDependenciesMeta": {
123
131
  "react": {
124
- "optional": false
132
+ "optional": true
125
133
  },
126
134
  "react-dom": {
127
- "optional": false
135
+ "optional": true
136
+ },
137
+ "react-grid-layout": {
138
+ "optional": true
128
139
  },
129
140
  "drizzle-orm": {
130
- "optional": false
141
+ "optional": true
131
142
  },
132
143
  "hono": {
133
144
  "optional": true
@@ -150,8 +161,13 @@
150
161
  },
151
162
  "devDependencies": {
152
163
  "@fastify/cors": "^11.1.0",
164
+ "@heroicons/react": "^2.2.0",
165
+ "@hono/node-server": "^1.19.0",
166
+ "@iconify-icons/tabler": "^1.2.95",
167
+ "@iconify/react": "^6.0.0",
153
168
  "@types/better-sqlite3": "^7.6.0",
154
169
  "@types/cors": "^2.8.17",
170
+ "@types/d3": "^7.4.3",
155
171
  "@types/express": "^5.0.0",
156
172
  "@types/node": "^20.0.0",
157
173
  "@types/react": "^18.0.0",
@@ -175,25 +191,20 @@
175
191
  "next": "^15.0.0",
176
192
  "postcss": "^8.5.6",
177
193
  "postgres": "^3.4.7",
194
+ "react-hook-form": "^7.47.0",
178
195
  "rollup-plugin-visualizer": "^6.0.3",
196
+ "sql-formatter": "^15.6.6",
179
197
  "supertest": "^7.0.0",
180
198
  "tailwindcss": "^3.4.15",
199
+ "tsx": "^4.20.5",
181
200
  "typescript": "^5.0.0",
182
201
  "vite": "^5.0.0",
183
202
  "vite-plugin-dts": "^4.0.0",
184
- "vitest": "^2.0.0"
203
+ "vitest": "^2.0.0",
204
+ "zod": "^3.22.0"
185
205
  },
186
206
  "dependencies": {
187
- "@heroicons/react": "^2.2.0",
188
- "@iconify-icons/tabler": "^1.2.95",
189
- "@iconify/react": "^6.0.0",
190
- "@types/d3": "^7.4.3",
191
- "d3": "^7.9.0",
192
- "react-grid-layout": "^1.4.0",
193
- "react-hook-form": "^7.47.0",
194
- "recharts": "^2.8.0",
195
- "sql-formatter": "^15.6.6",
196
- "yaml": "^2.8.1",
197
- "zod": "^3.22.0"
207
+ "@tanstack/react-query": "^5.85.5",
208
+ "react-router-dom": "^7.8.2"
198
209
  }
199
210
  }