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.
@@ -81,9 +81,9 @@ const dR = {
81
81
  startActiveSpan(T, E) {
82
82
  return E();
83
83
  }
84
- }, SE = Symbol.for("drizzle:ViewBaseConfig"), aE = Symbol.for("drizzle:Schema"), TT = Symbol.for("drizzle:Columns"), RT = Symbol.for("drizzle:ExtraConfigColumns"), PE = Symbol.for("drizzle:OriginalName"), oE = Symbol.for("drizzle:BaseName"), CE = Symbol.for("drizzle:IsAlias"), AT = Symbol.for("drizzle:ExtraConfigBuilder"), fR = Symbol.for("drizzle:IsDrizzleTable");
84
+ }, SE = Symbol.for("drizzle:ViewBaseConfig"), aE = Symbol.for("drizzle:Schema"), TT = Symbol.for("drizzle:Columns"), RT = Symbol.for("drizzle:ExtraConfigColumns"), oE = Symbol.for("drizzle:OriginalName"), PE = Symbol.for("drizzle:BaseName"), CE = Symbol.for("drizzle:IsAlias"), AT = Symbol.for("drizzle:ExtraConfigBuilder"), fR = Symbol.for("drizzle:IsDrizzleTable");
85
85
  var wT, xT, vT, QT, ZT, qT, jT, kT, zT, ER;
86
- ER = X, zT = DE, kT = PE, jT = aE, qT = TT, ZT = RT, QT = oE, vT = CE, xT = fR, wT = AT;
86
+ ER = X, zT = DE, kT = oE, jT = aE, qT = TT, ZT = RT, QT = PE, vT = CE, xT = fR, wT = AT;
87
87
  class W {
88
88
  constructor(E, R, A) {
89
89
  /**
@@ -113,17 +113,17 @@ class W {
113
113
  l(this, xT, !0);
114
114
  /** @internal */
115
115
  l(this, wT);
116
- this[DE] = this[PE] = E, this[aE] = R, this[oE] = A;
116
+ this[DE] = this[oE] = E, this[aE] = R, this[PE] = A;
117
117
  }
118
118
  }
119
119
  l(W, ER, "Table"), /** @internal */
120
120
  l(W, "Symbol", {
121
121
  Name: DE,
122
122
  Schema: aE,
123
- OriginalName: PE,
123
+ OriginalName: oE,
124
124
  Columns: TT,
125
125
  ExtraConfigColumns: RT,
126
- BaseName: oE,
126
+ BaseName: PE,
127
127
  IsAlias: CE,
128
128
  ExtraConfigBuilder: AT
129
129
  });
@@ -201,8 +201,8 @@ const v = class v {
201
201
  return { sql: "", params: [] };
202
202
  if (Array.isArray(N)) {
203
203
  const t = [new h("(")];
204
- for (const [n, o] of N.entries())
205
- t.push(o), n < N.length - 1 && t.push(new h(", "));
204
+ for (const [n, P] of N.entries())
205
+ t.push(P), n < N.length - 1 && t.push(new h(", "));
206
206
  return t.push(new h(")")), this.buildQueryFromSourceParams(t, A);
207
207
  }
208
208
  if (F(N, v))
@@ -1241,12 +1241,12 @@ class EA {
1241
1241
  if ("and" in E || "or" in E) {
1242
1242
  const n = E;
1243
1243
  if (n.and) {
1244
- const o = n.and.map((M) => this.processFilter(M, R, A, S, e)).filter((M) => M !== null);
1245
- return o.length > 0 ? b(...o) : null;
1244
+ const P = n.and.map((M) => this.processFilter(M, R, A, S, e)).filter((M) => M !== null);
1245
+ return P.length > 0 ? b(...P) : null;
1246
1246
  }
1247
1247
  if (n.or) {
1248
- const o = n.or.map((M) => this.processFilter(M, R, A, S, e)).filter((M) => M !== null);
1249
- return o.length > 0 ? bR(...o) : null;
1248
+ const P = n.or.map((M) => this.processFilter(M, R, A, S, e)).filter((M) => M !== null);
1249
+ return P.length > 0 ? bR(...P) : null;
1250
1250
  }
1251
1251
  }
1252
1252
  const O = E, [C, _] = O.member.split("."), I = R.get(C);
@@ -1420,8 +1420,8 @@ class EA {
1420
1420
  return { start: s, end: t };
1421
1421
  }
1422
1422
  if (A === "last quarter") {
1423
- const s = Math.floor(e / 3), t = s === 0 ? 3 : s - 1, n = s === 0 ? S - 1 : S, o = new Date(Date.UTC(n, t * 3, 1, 0, 0, 0, 0)), M = new Date(Date.UTC(n, t * 3 + 3, 0, 23, 59, 59, 999));
1424
- return { start: o, end: M };
1423
+ const s = Math.floor(e / 3), t = s === 0 ? 3 : s - 1, n = s === 0 ? S - 1 : S, P = new Date(Date.UTC(n, t * 3, 1, 0, 0, 0, 0)), M = new Date(Date.UTC(n, t * 3 + 3, 0, 23, 59, 59, 999));
1424
+ return { start: P, end: M };
1425
1425
  }
1426
1426
  if (A === "last year") {
1427
1427
  const s = new Date(Date.UTC(S - 1, 0, 1, 0, 0, 0, 0)), t = new Date(Date.UTC(S - 1, 11, 31, 23, 59, 59, 999));
@@ -1478,16 +1478,16 @@ class EA {
1478
1478
  const [s, t] = N.split("."), n = C.get(s);
1479
1479
  if (n && n.dimensions && n.dimensions[t])
1480
1480
  if ((_ = S == null ? void 0 : S.preAggregationCTEs) == null ? void 0 : _.some((M) => M.cube.name === s)) {
1481
- const M = S.preAggregationCTEs.find((G) => G.cube.name === s), a = M.joinKeys.find((G) => G.targetColumn === t);
1482
- if (a && a.sourceColumnObj)
1483
- e.push(a.sourceColumnObj);
1481
+ const M = S.preAggregationCTEs.find((G) => G.cube.name === s), o = M.joinKeys.find((G) => G.targetColumn === t);
1482
+ if (o && o.sourceColumnObj)
1483
+ e.push(o.sourceColumnObj);
1484
1484
  else {
1485
1485
  const G = L`${L.identifier(M.cteAlias)}.${L.identifier(t)}`;
1486
1486
  e.push(G);
1487
1487
  }
1488
1488
  } else {
1489
- const M = n.dimensions[t], a = x(M.sql, A);
1490
- e.push(a);
1489
+ const M = n.dimensions[t], o = x(M.sql, A);
1490
+ e.push(o);
1491
1491
  }
1492
1492
  }
1493
1493
  if (R.timeDimensions)
@@ -1495,10 +1495,10 @@ class EA {
1495
1495
  const [s, t] = N.dimension.split("."), n = C.get(s);
1496
1496
  if (n && n.dimensions && n.dimensions[t])
1497
1497
  if ((I = S == null ? void 0 : S.preAggregationCTEs) == null ? void 0 : I.some((M) => M.cube.name === s)) {
1498
- const M = S.preAggregationCTEs.find((G) => G.cube.name === s), a = M.joinKeys.find((G) => G.targetColumn === t);
1499
- if (a && a.sourceColumnObj) {
1498
+ const M = S.preAggregationCTEs.find((G) => G.cube.name === s), o = M.joinKeys.find((G) => G.targetColumn === t);
1499
+ if (o && o.sourceColumnObj) {
1500
1500
  const G = this.buildTimeDimensionExpression(
1501
- a.sourceColumnObj,
1501
+ o.sourceColumnObj,
1502
1502
  N.granularity,
1503
1503
  A
1504
1504
  );
@@ -1508,12 +1508,12 @@ class EA {
1508
1508
  e.push(G);
1509
1509
  }
1510
1510
  } else {
1511
- const M = n.dimensions[t], a = this.buildTimeDimensionExpression(
1511
+ const M = n.dimensions[t], o = this.buildTimeDimensionExpression(
1512
1512
  M.sql,
1513
1513
  N.granularity,
1514
1514
  A
1515
1515
  );
1516
- e.push(a);
1516
+ e.push(o);
1517
1517
  }
1518
1518
  }
1519
1519
  return e;
@@ -1743,7 +1743,7 @@ class TA {
1743
1743
  const n = E.get(s);
1744
1744
  if (!n)
1745
1745
  throw new Error(`Cube '${s}' not found`);
1746
- const o = this.buildJoinCondition(
1746
+ const P = this.buildJoinCondition(
1747
1747
  t,
1748
1748
  null,
1749
1749
  // No source alias needed - use the actual column
@@ -1755,7 +1755,7 @@ class TA {
1755
1755
  cube: n,
1756
1756
  alias: `${s.toLowerCase()}_cube`,
1757
1757
  joinType: M,
1758
- joinCondition: o
1758
+ joinCondition: P
1759
1759
  }), O.add(s);
1760
1760
  }
1761
1761
  }
@@ -1789,14 +1789,14 @@ class TA {
1789
1789
  const n = CT(s.targetCube).name;
1790
1790
  if (O.has(n))
1791
1791
  continue;
1792
- const o = [..._, {
1792
+ const P = [..._, {
1793
1793
  fromCube: C,
1794
1794
  toCube: n,
1795
1795
  joinDef: s
1796
1796
  }];
1797
1797
  if (n === A)
1798
- return o;
1799
- O.add(n), e.push({ cube: n, path: o });
1798
+ return P;
1799
+ O.add(n), e.push({ cube: n, path: P });
1800
1800
  }
1801
1801
  }
1802
1802
  return null;
@@ -1869,14 +1869,14 @@ class UE {
1869
1869
  }, O = this.queryPlanner.createQueryPlan(E, R, e), C = this.buildUnifiedQuery(O, R, e), _ = this.queryBuilder.collectNumericFields(E, R), I = await this.dbExecutor.execute(C, _), N = Array.isArray(I) ? I.map((t) => {
1870
1870
  const n = { ...t };
1871
1871
  if (R.timeDimensions) {
1872
- for (const o of R.timeDimensions)
1873
- if (o.dimension in n) {
1874
- let M = n[o.dimension];
1872
+ for (const P of R.timeDimensions)
1873
+ if (P.dimension in n) {
1874
+ let M = n[P.dimension];
1875
1875
  if (typeof M == "string" && M.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)) {
1876
- const a = M.replace(" ", "T"), G = !a.endsWith("Z") && !a.includes("+") ? a + "Z" : a;
1876
+ const o = M.replace(" ", "T"), G = !o.endsWith("Z") && !o.includes("+") ? o + "Z" : o;
1877
1877
  M = new Date(G);
1878
1878
  }
1879
- M = this.databaseAdapter.convertTimeDimensionResult(M), n[o.dimension] = M;
1879
+ M = this.databaseAdapter.convertTimeDimensionResult(M), n[P.dimension] = M;
1880
1880
  }
1881
1881
  }
1882
1882
  return n;
@@ -1902,34 +1902,34 @@ class UE {
1902
1902
  buildPreAggregationCTE(E, R, A, S) {
1903
1903
  var M;
1904
1904
  const e = E.cube, O = e.sql(A), C = {};
1905
- for (const a of E.joinKeys)
1906
- if (a.targetColumnObj) {
1907
- C[a.targetColumn] = a.targetColumnObj;
1908
- for (const [G, P] of Object.entries(e.dimensions || {}))
1909
- P.sql === a.targetColumnObj && G !== a.targetColumn && (C[G] = L`${a.targetColumnObj}`.as(G));
1905
+ for (const o of E.joinKeys)
1906
+ if (o.targetColumnObj) {
1907
+ C[o.targetColumn] = o.targetColumnObj;
1908
+ for (const [G, a] of Object.entries(e.dimensions || {}))
1909
+ a.sql === o.targetColumnObj && G !== o.targetColumn && (C[G] = L`${o.targetColumnObj}`.as(G));
1910
1910
  }
1911
- for (const a of E.measures) {
1912
- const [, G] = a.split(".");
1911
+ for (const o of E.measures) {
1912
+ const [, G] = o.split(".");
1913
1913
  if (e.measures && e.measures[G]) {
1914
- const P = e.measures[G], u = this.queryBuilder.buildMeasureExpression(P, A);
1915
- C[G] = L`${u}`.as(G);
1914
+ const a = e.measures[G], H = this.queryBuilder.buildMeasureExpression(a, A);
1915
+ C[G] = L`${H}`.as(G);
1916
1916
  }
1917
1917
  }
1918
1918
  const _ = e.name;
1919
1919
  if (R.dimensions)
1920
- for (const a of R.dimensions) {
1921
- const [G, P] = a.split(".");
1922
- if (G === _ && e.dimensions && e.dimensions[P]) {
1923
- const u = e.dimensions[P], H = this.queryBuilder.buildMeasureExpression({ sql: u.sql, type: "number" }, A);
1924
- C[P] = L`${H}`.as(P);
1920
+ for (const o of R.dimensions) {
1921
+ const [G, a] = o.split(".");
1922
+ if (G === _ && e.dimensions && e.dimensions[a]) {
1923
+ const H = e.dimensions[a], u = this.queryBuilder.buildMeasureExpression({ sql: H.sql, type: "number" }, A);
1924
+ C[a] = L`${u}`.as(a);
1925
1925
  }
1926
1926
  }
1927
1927
  if (R.timeDimensions)
1928
- for (const a of R.timeDimensions) {
1929
- const [G, P] = a.dimension.split(".");
1930
- if (G === _ && e.dimensions && e.dimensions[P]) {
1931
- const u = e.dimensions[P], H = this.queryBuilder.buildTimeDimensionExpression(u.sql, a.granularity, A);
1932
- C[P] = L`${H}`.as(P);
1928
+ for (const o of R.timeDimensions) {
1929
+ const [G, a] = o.dimension.split(".");
1930
+ if (G === _ && e.dimensions && e.dimensions[a]) {
1931
+ const H = e.dimensions[a], u = this.queryBuilder.buildTimeDimensionExpression(H.sql, o.granularity, A);
1932
+ C[a] = L`${u}`.as(a);
1933
1933
  }
1934
1934
  }
1935
1935
  if (Object.keys(C).length === 0)
@@ -1937,24 +1937,24 @@ class UE {
1937
1937
  let I = A.db.select(C).from(O.from);
1938
1938
  const N = S ? {
1939
1939
  ...S,
1940
- preAggregationCTEs: (M = S.preAggregationCTEs) == null ? void 0 : M.filter((a) => a.cube.name !== e.name)
1940
+ preAggregationCTEs: (M = S.preAggregationCTEs) == null ? void 0 : M.filter((o) => o.cube.name !== e.name)
1941
1941
  } : void 0, s = this.queryBuilder.buildWhereConditions(e, R, A, N), t = [];
1942
1942
  if (R.timeDimensions)
1943
- for (const a of R.timeDimensions) {
1944
- const [G, P] = a.dimension.split(".");
1945
- if (G === _ && e.dimensions && e.dimensions[P] && a.dateRange) {
1946
- const u = e.dimensions[P], H = this.queryBuilder.buildMeasureExpression({ sql: u.sql, type: "number" }, A), B = this.queryBuilder.buildDateRangeCondition(H, a.dateRange);
1943
+ for (const o of R.timeDimensions) {
1944
+ const [G, a] = o.dimension.split(".");
1945
+ if (G === _ && e.dimensions && e.dimensions[a] && o.dateRange) {
1946
+ const H = e.dimensions[a], u = this.queryBuilder.buildMeasureExpression({ sql: H.sql, type: "number" }, A), B = this.queryBuilder.buildDateRangeCondition(u, o.dateRange);
1947
1947
  B && t.push(B);
1948
1948
  }
1949
1949
  }
1950
1950
  if (R.filters) {
1951
- for (const a of R.filters)
1952
- if (!("and" in a) && !("or" in a) && "member" in a && "operator" in a) {
1953
- const G = a, [P, u] = G.member.split(".");
1954
- if (P === _ && e.dimensions && e.dimensions[u]) {
1955
- const H = e.dimensions[u];
1951
+ for (const o of R.filters)
1952
+ if (!("and" in o) && !("or" in o) && "member" in o && "operator" in o) {
1953
+ const G = o, [a, H] = G.member.split(".");
1954
+ if (a === _ && e.dimensions && e.dimensions[H]) {
1955
+ const u = e.dimensions[H];
1956
1956
  if (G.operator === "inDateRange") {
1957
- const B = this.queryBuilder.buildMeasureExpression({ sql: H.sql, type: "number" }, A), Y = this.queryBuilder.buildDateRangeCondition(B, G.values);
1957
+ const B = this.queryBuilder.buildMeasureExpression({ sql: u.sql, type: "number" }, A), Y = this.queryBuilder.buildDateRangeCondition(B, G.values);
1958
1958
  Y && t.push(Y);
1959
1959
  }
1960
1960
  }
@@ -1962,29 +1962,29 @@ class UE {
1962
1962
  }
1963
1963
  const n = [];
1964
1964
  if (O.where && n.push(O.where), n.push(...s, ...t), n.length > 0) {
1965
- const a = n.length === 1 ? n[0] : b(...n);
1966
- I = I.where(a);
1965
+ const o = n.length === 1 ? n[0] : b(...n);
1966
+ I = I.where(o);
1967
1967
  }
1968
- const o = [];
1969
- for (const a of E.joinKeys)
1970
- a.targetColumnObj && o.push(a.targetColumnObj);
1968
+ const P = [];
1969
+ for (const o of E.joinKeys)
1970
+ o.targetColumnObj && P.push(o.targetColumnObj);
1971
1971
  if (R.dimensions)
1972
- for (const a of R.dimensions) {
1973
- const [G, P] = a.split(".");
1974
- if (G === _ && e.dimensions && e.dimensions[P]) {
1975
- const u = e.dimensions[P], H = x(u.sql, A);
1976
- o.push(H);
1972
+ for (const o of R.dimensions) {
1973
+ const [G, a] = o.split(".");
1974
+ if (G === _ && e.dimensions && e.dimensions[a]) {
1975
+ const H = e.dimensions[a], u = x(H.sql, A);
1976
+ P.push(u);
1977
1977
  }
1978
1978
  }
1979
1979
  if (R.timeDimensions)
1980
- for (const a of R.timeDimensions) {
1981
- const [G, P] = a.dimension.split(".");
1982
- if (G === _ && e.dimensions && e.dimensions[P]) {
1983
- const u = e.dimensions[P], H = this.queryBuilder.buildTimeDimensionExpression(u.sql, a.granularity, A);
1984
- o.push(H);
1980
+ for (const o of R.timeDimensions) {
1981
+ const [G, a] = o.dimension.split(".");
1982
+ if (G === _ && e.dimensions && e.dimensions[a]) {
1983
+ const H = e.dimensions[a], u = this.queryBuilder.buildTimeDimensionExpression(H.sql, o.granularity, A);
1984
+ P.push(u);
1985
1985
  }
1986
1986
  }
1987
- return o.length > 0 && (I = I.groupBy(...o)), A.db.$with(E.cteAlias).as(I);
1987
+ return P.length > 0 && (I = I.groupBy(...P)), A.db.$with(E.cteAlias).as(I);
1988
1988
  }
1989
1989
  // Removed unused getActualJoinTargetColumn method
1990
1990
  /**
@@ -2006,12 +2006,12 @@ class UE {
2006
2006
  * Build unified query that works for both single and multi-cube queries
2007
2007
  */
2008
2008
  buildUnifiedQuery(E, R, A) {
2009
- var M, a, G;
2009
+ var M, o, G;
2010
2010
  const S = [], e = /* @__PURE__ */ new Map();
2011
2011
  if (E.preAggregationCTEs && E.preAggregationCTEs.length > 0)
2012
- for (const P of E.preAggregationCTEs) {
2013
- const u = this.buildPreAggregationCTE(P, R, A, E);
2014
- u && (S.push(u), e.set(P.cube.name, P.cteAlias));
2012
+ for (const a of E.preAggregationCTEs) {
2013
+ const H = this.buildPreAggregationCTE(a, R, A, E);
2014
+ H && (S.push(H), e.set(a.cube.name, a.cteAlias));
2015
2015
  }
2016
2016
  const O = E.primaryCube.sql(A), _ = { ...this.queryBuilder.buildSelections(
2017
2017
  E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
@@ -2020,13 +2020,13 @@ class UE {
2020
2020
  A
2021
2021
  ) };
2022
2022
  if (E.preAggregationCTEs)
2023
- for (const P of E.preAggregationCTEs) {
2024
- const u = P.cube.name;
2025
- for (const H of P.measures)
2026
- if (_[H]) {
2027
- const [, B] = H.split("."), Y = this.getCubesFromPlan(E).get(u);
2023
+ for (const a of E.preAggregationCTEs) {
2024
+ const H = a.cube.name;
2025
+ for (const u of a.measures)
2026
+ if (_[u]) {
2027
+ const [, B] = u.split("."), Y = this.getCubesFromPlan(E).get(H);
2028
2028
  if (Y && Y.measures && Y.measures[B]) {
2029
- const V = Y.measures[B], g = L`${L.identifier(P.cteAlias)}.${L.identifier(B)}`;
2029
+ const V = Y.measures[B], g = L`${L.identifier(a.cteAlias)}.${L.identifier(B)}`;
2030
2030
  let K;
2031
2031
  switch (V.type) {
2032
2032
  case "count":
@@ -2049,66 +2049,72 @@ class UE {
2049
2049
  default:
2050
2050
  K = Q(g);
2051
2051
  }
2052
- _[H] = L`${K}`.as(H);
2052
+ _[u] = L`${K}`.as(u);
2053
2053
  }
2054
2054
  }
2055
- for (const H in _) {
2056
- const [B, Y] = H.split(".");
2057
- if (B === u) {
2058
- const V = this.getCubesFromPlan(E).get(u), g = V && ((M = V.dimensions) == null ? void 0 : M[Y]), K = H.startsWith(u + ".");
2055
+ for (const u in _) {
2056
+ const [B, Y] = u.split(".");
2057
+ if (B === H) {
2058
+ const V = this.getCubesFromPlan(E).get(H), g = V && ((M = V.dimensions) == null ? void 0 : M[Y]), K = u.startsWith(H + ".");
2059
2059
  if (g || K) {
2060
- let nE = P.joinKeys.find((iE) => iE.targetColumn === Y);
2061
- if (!nE && ((a = V == null ? void 0 : V.dimensions) != null && a[Y])) {
2060
+ let nE = a.joinKeys.find((iE) => iE.targetColumn === Y);
2061
+ if (!nE && ((o = V == null ? void 0 : V.dimensions) != null && o[Y])) {
2062
2062
  const iE = V.dimensions[Y].sql;
2063
- nE = P.joinKeys.find((mR) => mR.targetColumnObj === iE);
2063
+ nE = a.joinKeys.find((mR) => mR.targetColumnObj === iE);
2064
2064
  }
2065
- nE ? _[H] = L`${L.identifier(P.cteAlias)}.${L.identifier(Y)}`.as(H) : K && ((G = V == null ? void 0 : V.dimensions) != null && G[Y]) && (_[H] = L`${L.identifier(P.cteAlias)}.${L.identifier(Y)}`.as(H));
2065
+ nE ? _[u] = L`${L.identifier(a.cteAlias)}.${L.identifier(Y)}`.as(u) : K && ((G = V == null ? void 0 : V.dimensions) != null && G[Y]) && (_[u] = L`${L.identifier(a.cteAlias)}.${L.identifier(Y)}`.as(u));
2066
2066
  }
2067
2067
  }
2068
2068
  }
2069
2069
  }
2070
2070
  let I = A.db.select(_).from(O.from);
2071
2071
  if (S.length > 0 && (I = A.db.with(...S).select(_).from(O.from)), O.joins)
2072
- for (const P of O.joins)
2073
- switch (P.type || "left") {
2072
+ for (const a of O.joins)
2073
+ switch (a.type || "left") {
2074
2074
  case "left":
2075
- I = I.leftJoin(P.table, P.on);
2075
+ I = I.leftJoin(a.table, a.on);
2076
2076
  break;
2077
2077
  case "inner":
2078
- I = I.innerJoin(P.table, P.on);
2078
+ I = I.innerJoin(a.table, a.on);
2079
2079
  break;
2080
2080
  case "right":
2081
- I = I.rightJoin(P.table, P.on);
2081
+ I = I.rightJoin(a.table, a.on);
2082
2082
  break;
2083
2083
  case "full":
2084
- I = I.fullJoin(P.table, P.on);
2084
+ I = I.fullJoin(a.table, a.on);
2085
2085
  break;
2086
2086
  }
2087
2087
  if (E.joinCubes && E.joinCubes.length > 0)
2088
- for (const P of E.joinCubes) {
2089
- const u = e.get(P.cube.name);
2090
- let H, B;
2091
- u ? (H = L`${L.identifier(u)}`, B = this.buildCTEJoinCondition(P, u, E)) : (H = P.cube.sql(A).from, B = P.joinCondition);
2088
+ for (const a of E.joinCubes) {
2089
+ const H = e.get(a.cube.name);
2090
+ let u, B;
2091
+ H ? (u = L`${L.identifier(H)}`, B = this.buildCTEJoinCondition(a, H, E)) : (u = a.cube.sql(A).from, B = a.joinCondition);
2092
2092
  try {
2093
- switch (P.joinType || "left") {
2093
+ switch (a.joinType || "left") {
2094
2094
  case "left":
2095
- I = I.leftJoin(H, B);
2095
+ I = I.leftJoin(u, B);
2096
2096
  break;
2097
2097
  case "inner":
2098
- I = I.innerJoin(H, B);
2098
+ I = I.innerJoin(u, B);
2099
2099
  break;
2100
2100
  case "right":
2101
- I = I.rightJoin(H, B);
2101
+ I = I.rightJoin(u, B);
2102
2102
  break;
2103
2103
  case "full":
2104
- I = I.fullJoin(H, B);
2104
+ I = I.fullJoin(u, B);
2105
2105
  break;
2106
2106
  }
2107
2107
  } catch {
2108
2108
  }
2109
2109
  }
2110
2110
  const N = [];
2111
- O.where && N.push(O.where);
2111
+ if (O.where && N.push(O.where), E.joinCubes && E.joinCubes.length > 0)
2112
+ for (const a of E.joinCubes) {
2113
+ if (e.get(a.cube.name))
2114
+ continue;
2115
+ const u = a.cube.sql(A);
2116
+ u.where && N.push(u.where);
2117
+ }
2112
2118
  const s = this.queryBuilder.buildWhereConditions(
2113
2119
  E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
2114
2120
  // Single cube
@@ -2118,8 +2124,8 @@ class UE {
2118
2124
  // Pass the queryPlan to handle CTE scenarios
2119
2125
  );
2120
2126
  if (s.length > 0 && N.push(...s), N.length > 0) {
2121
- const P = N.length === 1 ? N[0] : b(...N);
2122
- I = I.where(P);
2127
+ const a = N.length === 1 ? N[0] : b(...N);
2128
+ I = I.where(a);
2123
2129
  }
2124
2130
  const t = this.queryBuilder.buildGroupByFields(
2125
2131
  E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
@@ -2139,11 +2145,11 @@ class UE {
2139
2145
  // Pass the queryPlan to handle CTE scenarios
2140
2146
  );
2141
2147
  if (n.length > 0) {
2142
- const P = n.length === 1 ? n[0] : b(...n);
2143
- I = I.having(P);
2148
+ const a = n.length === 1 ? n[0] : b(...n);
2149
+ I = I.having(a);
2144
2150
  }
2145
- const o = this.queryBuilder.buildOrderBy(R);
2146
- return o.length > 0 && (I = I.orderBy(...o)), I = this.queryBuilder.applyLimitAndOffset(I, R), I;
2151
+ const P = this.queryBuilder.buildOrderBy(R);
2152
+ return P.length > 0 && (I = I.orderBy(...P)), I = this.queryBuilder.applyLimitAndOffset(I, R), I;
2147
2153
  }
2148
2154
  /**
2149
2155
  * Convert query plan to cube map for QueryBuilder methods
@@ -3128,7 +3134,7 @@ const _R = (T) => ({
3128
3134
  "{ROWS | RANGE} BETWEEN",
3129
3135
  // comparison operator
3130
3136
  "IS [NOT] DISTINCT FROM"
3131
- ]), PA = {
3137
+ ]), oA = {
3132
3138
  name: "bigquery",
3133
3139
  tokenizerOptions: {
3134
3140
  reservedSelect: rA,
@@ -3156,14 +3162,14 @@ const _R = (T) => ({
3156
3162
  variableTypes: [{ regex: String.raw`@@\w+` }],
3157
3163
  lineCommentTypes: ["--", "#"],
3158
3164
  operators: ["&", "|", "^", "~", ">>", "<<", "||", "=>"],
3159
- postProcess: oA
3165
+ postProcess: PA
3160
3166
  },
3161
3167
  formatOptions: {
3162
3168
  onelineClauses: [...LT, ...GE],
3163
3169
  tabularOnelineClauses: GE
3164
3170
  }
3165
3171
  };
3166
- function oA(T) {
3172
+ function PA(T) {
3167
3173
  return MA(UA(T));
3168
3174
  }
3169
3175
  function MA(T) {
@@ -8451,7 +8457,7 @@ const IS = [
8451
8457
  // 'XOR',
8452
8458
  "YEAR",
8453
8459
  "YEARWEEK"
8454
- ], aS = r(["SELECT [ALL | DISTINCT | DISTINCTROW]"]), PS = r([
8460
+ ], aS = r(["SELECT [ALL | DISTINCT | DISTINCTROW]"]), oS = r([
8455
8461
  // queries
8456
8462
  "WITH [RECURSIVE]",
8457
8463
  "FROM",
@@ -8471,7 +8477,7 @@ const IS = [
8471
8477
  "ON DUPLICATE KEY UPDATE",
8472
8478
  // - update:
8473
8479
  "SET"
8474
- ]), PT = r(["CREATE [TEMPORARY] TABLE [IF NOT EXISTS]"]), mE = r([
8480
+ ]), oT = r(["CREATE [TEMPORARY] TABLE [IF NOT EXISTS]"]), mE = r([
8475
8481
  // - create:
8476
8482
  "CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]",
8477
8483
  // - update:
@@ -8652,7 +8658,7 @@ const IS = [
8652
8658
  "REPEAT",
8653
8659
  "RETURN",
8654
8660
  "WHILE"
8655
- ]), oS = r(["UNION [ALL | DISTINCT]"]), MS = r([
8661
+ ]), PS = r(["UNION [ALL | DISTINCT]"]), MS = r([
8656
8662
  "JOIN",
8657
8663
  "{LEFT | RIGHT} [OUTER] JOIN",
8658
8664
  "{INNER | CROSS} JOIN",
@@ -8669,8 +8675,8 @@ const IS = [
8669
8675
  name: "mysql",
8670
8676
  tokenizerOptions: {
8671
8677
  reservedSelect: aS,
8672
- reservedClauses: [...PS, ...PT, ...mE],
8673
- reservedSetOperations: oS,
8678
+ reservedClauses: [...oS, ...oT, ...mE],
8679
+ reservedSetOperations: PS,
8674
8680
  reservedJoins: MS,
8675
8681
  reservedPhrases: US,
8676
8682
  supportsXor: !0,
@@ -8714,7 +8720,7 @@ const IS = [
8714
8720
  postProcess: rE
8715
8721
  },
8716
8722
  formatOptions: {
8717
- onelineClauses: [...PT, ...mE],
8723
+ onelineClauses: [...oT, ...mE],
8718
8724
  tabularOnelineClauses: mE
8719
8725
  }
8720
8726
  }, lS = [
@@ -9302,7 +9308,7 @@ const IS = [
9302
9308
  "ON DUPLICATE KEY UPDATE",
9303
9309
  // - update:
9304
9310
  "SET"
9305
- ]), oT = r(["CREATE [TEMPORARY] TABLE [IF NOT EXISTS]"]), FE = r([
9311
+ ]), PT = r(["CREATE [TEMPORARY] TABLE [IF NOT EXISTS]"]), FE = r([
9306
9312
  // https://docs.pingcap.com/tidb/stable/sql-statement-create-view
9307
9313
  "CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]",
9308
9314
  // https://docs.pingcap.com/tidb/stable/sql-statement-update
@@ -9434,7 +9440,7 @@ const IS = [
9434
9440
  name: "tidb",
9435
9441
  tokenizerOptions: {
9436
9442
  reservedSelect: HS,
9437
- reservedClauses: [...BS, ...oT, ...FE],
9443
+ reservedClauses: [...BS, ...PT, ...FE],
9438
9444
  reservedSetOperations: mS,
9439
9445
  reservedJoins: FS,
9440
9446
  reservedPhrases: YS,
@@ -9479,7 +9485,7 @@ const IS = [
9479
9485
  postProcess: rE
9480
9486
  },
9481
9487
  formatOptions: {
9482
- onelineClauses: [...oT, ...FE],
9488
+ onelineClauses: [...PT, ...FE],
9483
9489
  tabularOnelineClauses: FE
9484
9490
  }
9485
9491
  }, dS = [
@@ -13283,7 +13289,7 @@ const kS = [
13283
13289
  // Shorthand functions to use in place of CASE expression
13284
13290
  "COALESCE",
13285
13291
  "NULLIF"
13286
- ], Pe = r(["SELECT [ALL | DISTINCT]"]), oe = r([
13292
+ ], oe = r(["SELECT [ALL | DISTINCT]"]), Pe = r([
13287
13293
  // queries
13288
13294
  "WITH",
13289
13295
  "FROM",
@@ -13385,8 +13391,8 @@ const kS = [
13385
13391
  ]), le = {
13386
13392
  name: "spark",
13387
13393
  tokenizerOptions: {
13388
- reservedSelect: Pe,
13389
- reservedClauses: [...oe, ...cT, ...fE],
13394
+ reservedSelect: oe,
13395
+ reservedClauses: [...Pe, ...cT, ...fE],
13390
13396
  reservedSetOperations: Me,
13391
13397
  reservedJoins: Ue,
13392
13398
  reservedPhrases: Ge,
@@ -17344,7 +17350,7 @@ const ue = [
17344
17350
  "WITH",
17345
17351
  // These are definitely keywords, but haven't found a definite list in the docs
17346
17352
  "COMMENT"
17347
- ], PI = [
17353
+ ], oI = [
17348
17354
  "NUMBER",
17349
17355
  "DECIMAL",
17350
17356
  "NUMERIC",
@@ -17381,7 +17387,7 @@ const ue = [
17381
17387
  "ARRAY",
17382
17388
  "GEOGRAPHY",
17383
17389
  "GEOMETRY"
17384
- ], oI = r(["SELECT [ALL | DISTINCT]"]), MI = r([
17390
+ ], PI = r(["SELECT [ALL | DISTINCT]"]), MI = r([
17385
17391
  // queries
17386
17392
  "WITH [RECURSIVE]",
17387
17393
  "FROM",
@@ -17663,13 +17669,13 @@ const ue = [
17663
17669
  ]), cI = {
17664
17670
  name: "snowflake",
17665
17671
  tokenizerOptions: {
17666
- reservedSelect: oI,
17672
+ reservedSelect: PI,
17667
17673
  reservedClauses: [...MI, ...YT, ...yE],
17668
17674
  reservedSetOperations: UI,
17669
17675
  reservedJoins: GI,
17670
17676
  reservedPhrases: lI,
17671
17677
  reservedKeywords: aI,
17672
- reservedDataTypes: PI,
17678
+ reservedDataTypes: oI,
17673
17679
  reservedFunctionNames: DI,
17674
17680
  stringTypes: ["$$", "''-qq-bs"],
17675
17681
  identTypes: ['""-qq'],
@@ -17705,7 +17711,7 @@ const ue = [
17705
17711
  }
17706
17712
  }, uI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
17707
17713
  __proto__: null,
17708
- bigquery: PA,
17714
+ bigquery: oA,
17709
17715
  db2: pA,
17710
17716
  db2i: KA,
17711
17717
  duckdb: qA,
@@ -17776,7 +17782,7 @@ const ue = [
17776
17782
  const S = "\\p{Alphabetic}\\p{Mark}_", e = "\\p{Decimal_Number}", O = y(T ?? ""), C = y(E ?? ""), _ = A ? `[${S}${e}${O}][${S}${e}${C}]*` : `[${S}${O}][${S}${e}${C}]*`;
17777
17783
  return R ? BI(_) : _;
17778
17784
  };
17779
- function PR(T, E) {
17785
+ function oR(T, E) {
17780
17786
  const R = T.slice(0, E).split(/\n/);
17781
17787
  return { line: R.length, col: R[R.length - 1].length + 1 };
17782
17788
  }
@@ -17806,7 +17812,7 @@ class hI {
17806
17812
  return R;
17807
17813
  }
17808
17814
  createParseError() {
17809
- const E = this.input.slice(this.index, this.index + 10), { line: R, col: A } = PR(this.input, this.index);
17815
+ const E = this.input.slice(this.index, this.index + 10), { line: R, col: A } = oR(this.input, this.index);
17810
17816
  return new Error(`Parse error: Unexpected "${E}" at line ${R} column ${A}.
17811
17817
  ${this.dialectInfo()}`);
17812
17818
  }
@@ -18151,7 +18157,7 @@ var wI = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
18151
18157
  function xI(T) {
18152
18158
  return T && T.__esModule && Object.prototype.hasOwnProperty.call(T, "default") ? T.default : T;
18153
18159
  }
18154
- var oR = { exports: {} };
18160
+ var PR = { exports: {} };
18155
18161
  (function(T) {
18156
18162
  (function(E, R) {
18157
18163
  T.exports ? T.exports = R() : E.nearley = R();
@@ -18185,38 +18191,38 @@ var oR = { exports: {} };
18185
18191
  }
18186
18192
  A.prototype.process = function(I) {
18187
18193
  for (var N = this.states, s = this.wants, t = this.completed, n = 0; n < N.length; n++) {
18188
- var o = N[n];
18189
- if (o.isComplete) {
18190
- if (o.finish(), o.data !== O.fail) {
18191
- for (var M = o.wantedBy, a = M.length; a--; ) {
18192
- var G = M[a];
18193
- this.complete(G, o);
18194
+ var P = N[n];
18195
+ if (P.isComplete) {
18196
+ if (P.finish(), P.data !== O.fail) {
18197
+ for (var M = P.wantedBy, o = M.length; o--; ) {
18198
+ var G = M[o];
18199
+ this.complete(G, P);
18194
18200
  }
18195
- if (o.reference === this.index) {
18196
- var P = o.rule.name;
18197
- (this.completed[P] = this.completed[P] || []).push(o);
18201
+ if (P.reference === this.index) {
18202
+ var a = P.rule.name;
18203
+ (this.completed[a] = this.completed[a] || []).push(P);
18198
18204
  }
18199
18205
  }
18200
18206
  } else {
18201
- var P = o.rule.symbols[o.dot];
18202
- if (typeof P != "string") {
18203
- this.scannable.push(o);
18207
+ var a = P.rule.symbols[P.dot];
18208
+ if (typeof a != "string") {
18209
+ this.scannable.push(P);
18204
18210
  continue;
18205
18211
  }
18206
- if (s[P]) {
18207
- if (s[P].push(o), t.hasOwnProperty(P))
18208
- for (var u = t[P], a = 0; a < u.length; a++) {
18209
- var H = u[a];
18210
- this.complete(o, H);
18212
+ if (s[a]) {
18213
+ if (s[a].push(P), t.hasOwnProperty(a))
18214
+ for (var H = t[a], o = 0; o < H.length; o++) {
18215
+ var u = H[o];
18216
+ this.complete(P, u);
18211
18217
  }
18212
18218
  } else
18213
- s[P] = [o], this.predict(P);
18219
+ s[a] = [P], this.predict(a);
18214
18220
  }
18215
18221
  }
18216
18222
  }, A.prototype.predict = function(I) {
18217
18223
  for (var N = this.grammar.byName[I] || [], s = 0; s < N.length; s++) {
18218
- var t = N[s], n = this.wants[I], o = new R(t, 0, this.index, n);
18219
- this.states.push(o);
18224
+ var t = N[s], n = this.wants[I], P = new R(t, 0, this.index, n);
18225
+ this.states.push(P);
18220
18226
  }
18221
18227
  }, A.prototype.complete = function(I, N) {
18222
18228
  var s = I.nextState(N);
@@ -18232,8 +18238,8 @@ var oR = { exports: {} };
18232
18238
  S.fromCompiled = function(t, N) {
18233
18239
  var s = t.Lexer;
18234
18240
  t.ParserStart && (N = t.ParserStart, t = t.ParserRules);
18235
- var t = t.map(function(o) {
18236
- return new E(o.name, o.symbols, o.postprocess);
18241
+ var t = t.map(function(P) {
18242
+ return new E(P.name, P.symbols, P.postprocess);
18237
18243
  }), n = new S(t, N);
18238
18244
  return n.lexer = s, n;
18239
18245
  };
@@ -18263,20 +18269,20 @@ var oR = { exports: {} };
18263
18269
  ), n = s.indexOf(`
18264
18270
  `, this.index);
18265
18271
  n === -1 && (n = s.length);
18266
- var o = this.index - this.lastLineBreak, M = String(this.line).length;
18267
- return N += " at line " + this.line + " col " + o + `:
18272
+ var P = this.index - this.lastLineBreak, M = String(this.line).length;
18273
+ return N += " at line " + this.line + " col " + P + `:
18268
18274
 
18269
- `, N += t.map(function(G, P) {
18270
- return a(this.line - t.length + P + 1, M) + " " + G;
18275
+ `, N += t.map(function(G, a) {
18276
+ return o(this.line - t.length + a + 1, M) + " " + G;
18271
18277
  }, this).join(`
18272
18278
  `), N += `
18273
- ` + a("", M + o) + `^
18279
+ ` + o("", M + P) + `^
18274
18280
  `, N;
18275
18281
  } else
18276
18282
  return N + " at index " + (this.index - 1);
18277
- function a(G, P) {
18278
- var u = String(G);
18279
- return Array(P - u.length + 1).join(" ") + u;
18283
+ function o(G, a) {
18284
+ var H = String(G);
18285
+ return Array(a - H.length + 1).join(" ") + H;
18280
18286
  }
18281
18287
  };
18282
18288
  function O(I, N, s) {
@@ -18291,8 +18297,8 @@ var oR = { exports: {} };
18291
18297
  for (var n in s || {})
18292
18298
  this.options[n] = s[n];
18293
18299
  this.lexer = this.options.lexer, this.lexerState = void 0;
18294
- var o = new A(t, 0);
18295
- this.table = [o], o.wants[t.start] = [], o.predict(t.start), o.process(), this.current = 0;
18300
+ var P = new A(t, 0);
18301
+ this.table = [P], P.wants[t.start] = [], P.predict(t.start), P.process(), this.current = 0;
18296
18302
  }
18297
18303
  O.fail = {}, O.prototype.feed = function(I) {
18298
18304
  var N = this.lexer;
@@ -18309,12 +18315,12 @@ var oR = { exports: {} };
18309
18315
  }
18310
18316
  var n = this.table[this.current];
18311
18317
  this.options.keepHistory || delete this.table[this.current - 1];
18312
- var o = this.current + 1, M = new A(this.grammar, o);
18318
+ var P = this.current + 1, M = new A(this.grammar, P);
18313
18319
  this.table.push(M);
18314
- for (var a = s.text !== void 0 ? s.text : s.value, G = N.constructor === e ? s.value : s, P = n.scannable, u = P.length; u--; ) {
18315
- var H = P[u], B = H.rule.symbols[H.dot];
18316
- if (B.test ? B.test(G) : B.type ? B.type === s.type : B.literal === a) {
18317
- var Y = H.nextState({ data: G, token: s, isToken: !0, reference: o - 1 });
18320
+ for (var o = s.text !== void 0 ? s.text : s.value, G = N.constructor === e ? s.value : s, a = n.scannable, H = a.length; H--; ) {
18321
+ var u = a[H], B = u.rule.symbols[u.dot];
18322
+ if (B.test ? B.test(G) : B.type ? B.type === s.type : B.literal === o) {
18323
+ var Y = u.nextState({ data: G, token: s, isToken: !0, reference: P - 1 });
18318
18324
  M.states.push(Y);
18319
18325
  }
18320
18326
  }
@@ -18334,29 +18340,29 @@ var oR = { exports: {} };
18334
18340
  }, O.prototype.reportErrorCommon = function(I, N) {
18335
18341
  var s = [];
18336
18342
  s.push(I);
18337
- var t = this.table.length - 2, n = this.table[t], o = n.states.filter(function(a) {
18338
- var G = a.rule.symbols[a.dot];
18343
+ var t = this.table.length - 2, n = this.table[t], P = n.states.filter(function(o) {
18344
+ var G = o.rule.symbols[o.dot];
18339
18345
  return G && typeof G != "string";
18340
18346
  });
18341
- if (o.length === 0)
18347
+ if (P.length === 0)
18342
18348
  s.push("Unexpected " + N + `. I did not expect any more input. Here is the state of my parse table:
18343
18349
  `), this.displayStateStack(n.states, s);
18344
18350
  else {
18345
18351
  s.push("Unexpected " + N + `. Instead, I was expecting to see one of the following:
18346
18352
  `);
18347
- var M = o.map(function(a) {
18348
- return this.buildFirstStateStack(a, []) || [a];
18353
+ var M = P.map(function(o) {
18354
+ return this.buildFirstStateStack(o, []) || [o];
18349
18355
  }, this);
18350
- M.forEach(function(a) {
18351
- var G = a[0], P = G.rule.symbols[G.dot], u = this.getSymbolDisplay(P);
18352
- s.push("A " + u + " based on:"), this.displayStateStack(a, s);
18356
+ M.forEach(function(o) {
18357
+ var G = o[0], a = G.rule.symbols[G.dot], H = this.getSymbolDisplay(a);
18358
+ s.push("A " + H + " based on:"), this.displayStateStack(o, s);
18353
18359
  }, this);
18354
18360
  }
18355
18361
  return s.push(""), s.join(`
18356
18362
  `);
18357
18363
  }, O.prototype.displayStateStack = function(I, N) {
18358
18364
  for (var s, t = 0, n = 0; n < I.length; n++) {
18359
- var o = I[n], M = o.rule.toString(o.dot);
18365
+ var P = I[n], M = P.rule.toString(P.dot);
18360
18366
  M === s ? t++ : (t > 0 && N.push(" ^ " + t + " more lines identical to this"), t = 0, N.push(" " + M)), s = M;
18361
18367
  }
18362
18368
  }, O.prototype.getSymbolDisplay = function(I) {
@@ -18424,8 +18430,8 @@ var oR = { exports: {} };
18424
18430
  Rule: E
18425
18431
  };
18426
18432
  });
18427
- })(oR);
18428
- var vI = oR.exports;
18433
+ })(PR);
18434
+ var vI = PR.exports;
18429
18435
  const QI = /* @__PURE__ */ xI(vI);
18430
18436
  function ZI(T) {
18431
18437
  return T.map(qI).map(jI).map(kI).map(zI).map(EO);
@@ -18487,7 +18493,7 @@ class GR {
18487
18493
  save() {
18488
18494
  }
18489
18495
  formatError(E) {
18490
- const { line: R, col: A } = PR(this.input, E.start);
18496
+ const { line: R, col: A } = oR(this.input, E.start);
18491
18497
  return `Parse error at token: ${E.text} at line ${R} column ${A}`;
18492
18498
  }
18493
18499
  has(E) {
@@ -19512,12 +19518,12 @@ const uR = {
19512
19518
  linesBetweenQueries: 1,
19513
19519
  denseOperators: !1,
19514
19520
  newlineBeforeSemicolon: !1
19515
- }, PO = (T, E = {}) => {
19521
+ }, oO = (T, E = {}) => {
19516
19522
  if (typeof E.language == "string" && !DO.includes(E.language))
19517
19523
  throw new sE(`Unsupported SQL dialect: ${E.language}`);
19518
19524
  const R = uR[E.language || "sql"];
19519
- return oO(T, Object.assign(Object.assign({}, E), { dialect: uI[R] }));
19520
- }, oO = (T, E) => {
19525
+ return PO(T, Object.assign(Object.assign({}, E), { dialect: uI[R] }));
19526
+ }, PO = (T, E) => {
19521
19527
  var { dialect: R } = E, A = iO(E, ["dialect"]);
19522
19528
  if (typeof T != "string")
19523
19529
  throw new Error("Invalid query argument. Expected string, instead got " + typeof T);
@@ -19596,12 +19602,12 @@ async function HO(T, E, R) {
19596
19602
  O = await R.generateSQL(t, T, E);
19597
19603
  }
19598
19604
  const C = Array.from(S).map((t) => {
19599
- var n, o;
19605
+ var n, P;
19600
19606
  return {
19601
19607
  cube: t,
19602
19608
  query: {
19603
19609
  measures: ((n = T.measures) == null ? void 0 : n.filter((M) => M.startsWith(t + "."))) || [],
19604
- dimensions: ((o = T.dimensions) == null ? void 0 : o.filter((M) => M.startsWith(t + "."))) || [],
19610
+ dimensions: ((P = T.dimensions) == null ? void 0 : P.filter((M) => M.startsWith(t + "."))) || [],
19605
19611
  filters: T.filters || [],
19606
19612
  timeDimensions: T.timeDimensions || [],
19607
19613
  order: T.order || {},
@@ -19657,7 +19663,7 @@ function BO(T, E, R) {
19657
19663
  }
19658
19664
  function $T(T, E) {
19659
19665
  try {
19660
- return PO(T, {
19666
+ return oO(T, {
19661
19667
  language: {
19662
19668
  postgres: "postgresql",
19663
19669
  mysql: "mysql",