drizzle-cube 0.3.6 → 0.3.7
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-C_liaz7j.js → compiler-B5KtMyYK.js} +627 -622
- package/dist/adapters/{compiler-l0i37Jpx.cjs → compiler-SWMoS5wn.cjs} +15 -15
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +1 -1
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +1 -1
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/client/charts.js +2 -2
- package/dist/client/chunks/{charts-Bjt9nuto.js → charts-BO349mnR.js} +2 -6
- package/dist/client/chunks/{charts-Bjt9nuto.js.map → charts-BO349mnR.js.map} +1 -1
- package/dist/client/chunks/{charts-jVQFlYTz.js → charts-CZaYccyY.js} +40 -40
- package/dist/client/chunks/{charts-jVQFlYTz.js.map → charts-CZaYccyY.js.map} +1 -1
- package/dist/client/chunks/{components-ZkZLXPw3.js → components-mvHnQK4S.js} +329 -329
- package/dist/client/chunks/components-mvHnQK4S.js.map +1 -0
- package/dist/client/chunks/core-CNEZNDS5.js +6 -0
- package/dist/client/chunks/core-CNEZNDS5.js.map +1 -0
- package/dist/client/chunks/{hooks-B0no4-kB.js → hooks-C0hhnpea.js} +2 -2
- package/dist/client/chunks/{hooks-B0no4-kB.js.map → hooks-C0hhnpea.js.map} +1 -1
- package/dist/client/components.js +2 -2
- package/dist/client/hooks.js +2 -2
- package/dist/client/icons.js +1 -1
- package/dist/client/index.js +4 -4
- package/dist/client/providers.js +1 -1
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +16 -16
- package/dist/server/index.js +569 -564
- package/package.json +1 -1
- package/dist/client/chunks/components-ZkZLXPw3.js.map +0 -1
- package/dist/client/chunks/core-DgVWZ4dE.js +0 -6
- package/dist/client/chunks/core-DgVWZ4dE.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const
|
|
1
|
+
const w = /* @__PURE__ */ Symbol.for("drizzle:entityKind");
|
|
2
2
|
function b(T, e) {
|
|
3
3
|
if (!T || typeof T != "object")
|
|
4
4
|
return !1;
|
|
5
5
|
if (T instanceof e)
|
|
6
6
|
return !0;
|
|
7
|
-
if (!Object.prototype.hasOwnProperty.call(e,
|
|
7
|
+
if (!Object.prototype.hasOwnProperty.call(e, w))
|
|
8
8
|
throw new Error(
|
|
9
9
|
`Class "${e.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`
|
|
10
10
|
);
|
|
11
11
|
let E = Object.getPrototypeOf(T).constructor;
|
|
12
12
|
if (E)
|
|
13
13
|
for (; E; ) {
|
|
14
|
-
if (
|
|
14
|
+
if (w in E && E[w] === e[w])
|
|
15
15
|
return !0;
|
|
16
16
|
E = Object.getPrototypeOf(E);
|
|
17
17
|
}
|
|
@@ -21,7 +21,7 @@ class Se {
|
|
|
21
21
|
constructor(e, E) {
|
|
22
22
|
this.table = e, this.config = E, this.name = E.name, this.keyAsName = E.keyAsName, this.notNull = E.notNull, this.default = E.default, this.defaultFn = E.defaultFn, this.onUpdateFn = E.onUpdateFn, this.hasDefault = E.hasDefault, this.primary = E.primaryKey, this.isUnique = E.isUnique, this.uniqueName = E.uniqueName, this.uniqueType = E.uniqueType, this.dataType = E.dataType, this.columnType = E.columnType, this.generated = E.generated, this.generatedIdentity = E.generatedIdentity;
|
|
23
23
|
}
|
|
24
|
-
static [
|
|
24
|
+
static [w] = "Column";
|
|
25
25
|
name;
|
|
26
26
|
keyAsName;
|
|
27
27
|
primary;
|
|
@@ -55,7 +55,7 @@ function yt(T) {
|
|
|
55
55
|
return !!T && typeof T == "function" && uE in T && T[uE] === !0;
|
|
56
56
|
}
|
|
57
57
|
class It {
|
|
58
|
-
static [
|
|
58
|
+
static [w] = "Subquery";
|
|
59
59
|
constructor(e, E, t, s = !1, n = []) {
|
|
60
60
|
this._ = {
|
|
61
61
|
brand: "Subquery",
|
|
@@ -75,8 +75,8 @@ const Vt = {
|
|
|
75
75
|
return e();
|
|
76
76
|
}
|
|
77
77
|
}, re = /* @__PURE__ */ Symbol.for("drizzle:ViewBaseConfig"), Be = /* @__PURE__ */ Symbol.for("drizzle:Schema"), DE = /* @__PURE__ */ Symbol.for("drizzle:Columns"), cE = /* @__PURE__ */ Symbol.for("drizzle:ExtraConfigColumns"), Fe = /* @__PURE__ */ Symbol.for("drizzle:OriginalName"), He = /* @__PURE__ */ Symbol.for("drizzle:BaseName"), ce = /* @__PURE__ */ Symbol.for("drizzle:IsAlias"), PE = /* @__PURE__ */ Symbol.for("drizzle:ExtraConfigBuilder"), Wt = /* @__PURE__ */ Symbol.for("drizzle:IsDrizzleTable");
|
|
78
|
-
class
|
|
79
|
-
static [
|
|
78
|
+
class K {
|
|
79
|
+
static [w] = "Table";
|
|
80
80
|
/** @internal */
|
|
81
81
|
static Symbol = {
|
|
82
82
|
Name: Ge,
|
|
@@ -129,27 +129,27 @@ function $t(T) {
|
|
|
129
129
|
return e;
|
|
130
130
|
}
|
|
131
131
|
class V {
|
|
132
|
-
static [
|
|
132
|
+
static [w] = "StringChunk";
|
|
133
133
|
value;
|
|
134
134
|
constructor(e) {
|
|
135
135
|
this.value = Array.isArray(e) ? e : [e];
|
|
136
136
|
}
|
|
137
137
|
getSQL() {
|
|
138
|
-
return new
|
|
138
|
+
return new F([this]);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
class
|
|
141
|
+
class F {
|
|
142
142
|
constructor(e) {
|
|
143
143
|
this.queryChunks = e;
|
|
144
144
|
for (const E of e)
|
|
145
|
-
if (b(E,
|
|
146
|
-
const t = E[
|
|
145
|
+
if (b(E, K)) {
|
|
146
|
+
const t = E[K.Symbol.Schema];
|
|
147
147
|
this.usedTables.push(
|
|
148
|
-
t === void 0 ? E[
|
|
148
|
+
t === void 0 ? E[K.Symbol.Name] : t + "." + E[K.Symbol.Name]
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
static [
|
|
152
|
+
static [w] = "SQL";
|
|
153
153
|
/** @internal */
|
|
154
154
|
decoder = ot;
|
|
155
155
|
shouldInlineParams = !1;
|
|
@@ -192,13 +192,13 @@ class B {
|
|
|
192
192
|
O.push(a), I < N.length - 1 && O.push(new V(", "));
|
|
193
193
|
return O.push(new V(")")), this.buildQueryFromSourceParams(O, t);
|
|
194
194
|
}
|
|
195
|
-
if (b(N,
|
|
195
|
+
if (b(N, F))
|
|
196
196
|
return this.buildQueryFromSourceParams(N.queryChunks, {
|
|
197
197
|
...t,
|
|
198
198
|
inlineParams: i || N.shouldInlineParams
|
|
199
199
|
});
|
|
200
|
-
if (b(N,
|
|
201
|
-
const O = N[
|
|
200
|
+
if (b(N, K)) {
|
|
201
|
+
const O = N[K.Symbol.Schema], I = N[K.Symbol.Name];
|
|
202
202
|
return {
|
|
203
203
|
sql: O === void 0 || N[ce] ? n(I) : n(O) + "." + n(I),
|
|
204
204
|
params: []
|
|
@@ -208,9 +208,9 @@ class B {
|
|
|
208
208
|
const O = s.getColumnCasing(N);
|
|
209
209
|
if (E.invokeSource === "indexes")
|
|
210
210
|
return { sql: n(O), params: [] };
|
|
211
|
-
const I = N.table[
|
|
211
|
+
const I = N.table[K.Symbol.Schema];
|
|
212
212
|
return {
|
|
213
|
-
sql: N.table[ce] || I === void 0 ? n(N.table[
|
|
213
|
+
sql: N.table[ce] || I === void 0 ? n(N.table[K.Symbol.Name]) + "." + n(O) : n(I) + "." + n(N.table[K.Symbol.Name]) + "." + n(O),
|
|
214
214
|
params: []
|
|
215
215
|
};
|
|
216
216
|
}
|
|
@@ -225,14 +225,14 @@ class B {
|
|
|
225
225
|
if (b(N.value, de))
|
|
226
226
|
return { sql: R(S.value++, N), params: [N], typings: ["none"] };
|
|
227
227
|
const O = N.value === null ? null : N.encoder.mapToDriverValue(N.value);
|
|
228
|
-
if (b(O,
|
|
228
|
+
if (b(O, F))
|
|
229
229
|
return this.buildQueryFromSourceParams([O], t);
|
|
230
230
|
if (i)
|
|
231
231
|
return { sql: this.mapInlineParam(O, t), params: [] };
|
|
232
232
|
let I = ["none"];
|
|
233
233
|
return A && (I = [A(N.encoder)]), { sql: R(S.value++, O), params: [O], typings: I };
|
|
234
234
|
}
|
|
235
|
-
return b(N, de) ? { sql: R(S.value++, N), params: [N], typings: ["none"] } : b(N,
|
|
235
|
+
return b(N, de) ? { sql: R(S.value++, N), params: [N], typings: ["none"] } : b(N, F.Aliased) && N.fieldAlias !== void 0 ? { sql: n(N.fieldAlias), params: [] } : b(N, It) ? N._.isWith ? { sql: n(N._.alias), params: [] } : this.buildQueryFromSourceParams([
|
|
236
236
|
new V("("),
|
|
237
237
|
N._.sql,
|
|
238
238
|
new V(") "),
|
|
@@ -261,7 +261,7 @@ class B {
|
|
|
261
261
|
return this;
|
|
262
262
|
}
|
|
263
263
|
as(e) {
|
|
264
|
-
return e === void 0 ? this : new
|
|
264
|
+
return e === void 0 ? this : new F.Aliased(this, e);
|
|
265
265
|
}
|
|
266
266
|
mapWith(e) {
|
|
267
267
|
return this.decoder = typeof e == "function" ? { mapFromDriverValue: e } : e, this;
|
|
@@ -283,10 +283,10 @@ class AE {
|
|
|
283
283
|
constructor(e) {
|
|
284
284
|
this.value = e;
|
|
285
285
|
}
|
|
286
|
-
static [
|
|
286
|
+
static [w] = "Name";
|
|
287
287
|
brand;
|
|
288
288
|
getSQL() {
|
|
289
|
-
return new
|
|
289
|
+
return new F([this]);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
function wt(T) {
|
|
@@ -309,10 +309,10 @@ class Pe {
|
|
|
309
309
|
constructor(e, E = Ct) {
|
|
310
310
|
this.value = e, this.encoder = E;
|
|
311
311
|
}
|
|
312
|
-
static [
|
|
312
|
+
static [w] = "Param";
|
|
313
313
|
brand;
|
|
314
314
|
getSQL() {
|
|
315
|
-
return new
|
|
315
|
+
return new F([this]);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
function r(T, ...e) {
|
|
@@ -320,26 +320,26 @@ function r(T, ...e) {
|
|
|
320
320
|
(e.length > 0 || T.length > 0 && T[0] !== "") && E.push(new V(T[0]));
|
|
321
321
|
for (const [t, s] of e.entries())
|
|
322
322
|
E.push(s, new V(T[t + 1]));
|
|
323
|
-
return new
|
|
323
|
+
return new F(E);
|
|
324
324
|
}
|
|
325
325
|
((T) => {
|
|
326
326
|
function e() {
|
|
327
|
-
return new
|
|
327
|
+
return new F([]);
|
|
328
328
|
}
|
|
329
329
|
T.empty = e;
|
|
330
330
|
function E(i) {
|
|
331
|
-
return new
|
|
331
|
+
return new F(i);
|
|
332
332
|
}
|
|
333
333
|
T.fromList = E;
|
|
334
334
|
function t(i) {
|
|
335
|
-
return new
|
|
335
|
+
return new F([new V(i)]);
|
|
336
336
|
}
|
|
337
337
|
T.raw = t;
|
|
338
338
|
function s(i, S) {
|
|
339
339
|
const N = [];
|
|
340
340
|
for (const [O, I] of i.entries())
|
|
341
341
|
O > 0 && S !== void 0 && N.push(S), N.push(I);
|
|
342
|
-
return new
|
|
342
|
+
return new F(N);
|
|
343
343
|
}
|
|
344
344
|
T.join = s;
|
|
345
345
|
function n(i) {
|
|
@@ -360,7 +360,7 @@ function r(T, ...e) {
|
|
|
360
360
|
constructor(t, s) {
|
|
361
361
|
this.sql = t, this.fieldAlias = s;
|
|
362
362
|
}
|
|
363
|
-
static [
|
|
363
|
+
static [w] = "SQL.Aliased";
|
|
364
364
|
/** @internal */
|
|
365
365
|
isSelectionField = !1;
|
|
366
366
|
getSQL() {
|
|
@@ -372,19 +372,19 @@ function r(T, ...e) {
|
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
T.Aliased = e;
|
|
375
|
-
})(
|
|
375
|
+
})(F || (F = {}));
|
|
376
376
|
class de {
|
|
377
377
|
constructor(e) {
|
|
378
378
|
this.name = e;
|
|
379
379
|
}
|
|
380
|
-
static [
|
|
380
|
+
static [w] = "Placeholder";
|
|
381
381
|
getSQL() {
|
|
382
|
-
return new
|
|
382
|
+
return new F([this]);
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
const Xt = /* @__PURE__ */ Symbol.for("drizzle:IsDrizzleView");
|
|
386
386
|
class _t {
|
|
387
|
-
static [
|
|
387
|
+
static [w] = "View";
|
|
388
388
|
/** @internal */
|
|
389
389
|
[re];
|
|
390
390
|
/** @internal */
|
|
@@ -401,28 +401,28 @@ class _t {
|
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
getSQL() {
|
|
404
|
-
return new
|
|
404
|
+
return new F([this]);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
Se.prototype.getSQL = function() {
|
|
408
|
-
return new
|
|
408
|
+
return new F([this]);
|
|
409
409
|
};
|
|
410
|
-
|
|
411
|
-
return new
|
|
410
|
+
K.prototype.getSQL = function() {
|
|
411
|
+
return new F([this]);
|
|
412
412
|
};
|
|
413
413
|
It.prototype.getSQL = function() {
|
|
414
|
-
return new
|
|
414
|
+
return new F([this]);
|
|
415
415
|
};
|
|
416
|
-
function
|
|
417
|
-
return wt(e) && !at(T) && !b(T, Pe) && !b(T, de) && !b(T, Se) && !b(T,
|
|
416
|
+
function $(T, e) {
|
|
417
|
+
return wt(e) && !at(T) && !b(T, Pe) && !b(T, de) && !b(T, Se) && !b(T, K) && !b(T, _t) ? new Pe(T, e) : T;
|
|
418
418
|
}
|
|
419
|
-
const Q = (T, e) => r`${T} = ${
|
|
419
|
+
const Q = (T, e) => r`${T} = ${$(e, T)}`, dE = (T, e) => r`${T} <> ${$(e, T)}`;
|
|
420
420
|
function h(...T) {
|
|
421
421
|
const e = T.filter(
|
|
422
422
|
(E) => E !== void 0
|
|
423
423
|
);
|
|
424
424
|
if (e.length !== 0)
|
|
425
|
-
return e.length === 1 ? new
|
|
425
|
+
return e.length === 1 ? new F(e) : new F([
|
|
426
426
|
new V("("),
|
|
427
427
|
r.join(e, new V(" and ")),
|
|
428
428
|
new V(")")
|
|
@@ -433,18 +433,18 @@ function ae(...T) {
|
|
|
433
433
|
(E) => E !== void 0
|
|
434
434
|
);
|
|
435
435
|
if (e.length !== 0)
|
|
436
|
-
return e.length === 1 ? new
|
|
436
|
+
return e.length === 1 ? new F(e) : new F([
|
|
437
437
|
new V("("),
|
|
438
438
|
r.join(e, new V(" or ")),
|
|
439
439
|
new V(")")
|
|
440
440
|
]);
|
|
441
441
|
}
|
|
442
|
-
const be = (T, e) => r`${T} > ${
|
|
442
|
+
const be = (T, e) => r`${T} > ${$(e, T)}`, Te = (T, e) => r`${T} >= ${$(e, T)}`, Ye = (T, e) => r`${T} < ${$(e, T)}`, se = (T, e) => r`${T} <= ${$(e, T)}`;
|
|
443
443
|
function ge(T, e) {
|
|
444
|
-
return Array.isArray(e) ? e.length === 0 ? r`false` : r`${T} in ${e.map((E) =>
|
|
444
|
+
return Array.isArray(e) ? e.length === 0 ? r`false` : r`${T} in ${e.map((E) => $(E, T))}` : r`${T} in ${$(e, T)}`;
|
|
445
445
|
}
|
|
446
446
|
function ME(T, e) {
|
|
447
|
-
return Array.isArray(e) ? e.length === 0 ? r`true` : r`${T} not in ${e.map((E) =>
|
|
447
|
+
return Array.isArray(e) ? e.length === 0 ? r`true` : r`${T} not in ${e.map((E) => $(E, T))}` : r`${T} not in ${$(e, T)}`;
|
|
448
448
|
}
|
|
449
449
|
function UE(T) {
|
|
450
450
|
return r`${T} is null`;
|
|
@@ -456,28 +456,28 @@ function Kt(T, e) {
|
|
|
456
456
|
if (Array.isArray(e)) {
|
|
457
457
|
if (e.length === 0)
|
|
458
458
|
throw new Error("arrayContains requires at least one value");
|
|
459
|
-
const E = r`${
|
|
459
|
+
const E = r`${$(e, T)}`;
|
|
460
460
|
return r`${T} @> ${E}`;
|
|
461
461
|
}
|
|
462
|
-
return r`${T} @> ${
|
|
462
|
+
return r`${T} @> ${$(e, T)}`;
|
|
463
463
|
}
|
|
464
464
|
function vt(T, e) {
|
|
465
465
|
if (Array.isArray(e)) {
|
|
466
466
|
if (e.length === 0)
|
|
467
467
|
throw new Error("arrayContained requires at least one value");
|
|
468
|
-
const E = r`${
|
|
468
|
+
const E = r`${$(e, T)}`;
|
|
469
469
|
return r`${T} <@ ${E}`;
|
|
470
470
|
}
|
|
471
|
-
return r`${T} <@ ${
|
|
471
|
+
return r`${T} <@ ${$(e, T)}`;
|
|
472
472
|
}
|
|
473
473
|
function xt(T, e) {
|
|
474
474
|
if (Array.isArray(e)) {
|
|
475
475
|
if (e.length === 0)
|
|
476
476
|
throw new Error("arrayOverlaps requires at least one value");
|
|
477
|
-
const E = r`${
|
|
477
|
+
const E = r`${$(e, T)}`;
|
|
478
478
|
return r`${T} && ${E}`;
|
|
479
479
|
}
|
|
480
|
-
return r`${T} && ${
|
|
480
|
+
return r`${T} && ${$(e, T)}`;
|
|
481
481
|
}
|
|
482
482
|
function pE(T) {
|
|
483
483
|
return r`${T} asc`;
|
|
@@ -491,7 +491,7 @@ function rE(T) {
|
|
|
491
491
|
function Qt(T) {
|
|
492
492
|
return r`count(distinct ${T})`.mapWith(Number);
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function x(T) {
|
|
495
495
|
return r`sum(${T})`.mapWith(String);
|
|
496
496
|
}
|
|
497
497
|
function oe(T) {
|
|
@@ -763,8 +763,8 @@ class jt extends IE {
|
|
|
763
763
|
), r`, `)}` : r``;
|
|
764
764
|
let i = r``;
|
|
765
765
|
if (n?.frame) {
|
|
766
|
-
const { type: I, start: a, end: o } = n.frame, L = I.toUpperCase(),
|
|
767
|
-
i = r`${r.raw(L)} BETWEEN ${r.raw(
|
|
766
|
+
const { type: I, start: a, end: o } = n.frame, L = I.toUpperCase(), l = a === "unbounded" ? "UNBOUNDED PRECEDING" : typeof a == "number" ? `${a} PRECEDING` : "CURRENT ROW", C = o === "unbounded" ? "UNBOUNDED FOLLOWING" : o === "current" ? "CURRENT ROW" : typeof o == "number" ? `${o} FOLLOWING` : "CURRENT ROW";
|
|
767
|
+
i = r`${r.raw(L)} BETWEEN ${r.raw(l)} AND ${r.raw(C)}`;
|
|
768
768
|
}
|
|
769
769
|
const S = [];
|
|
770
770
|
t && t.length > 0 && S.push(R), s && s.length > 0 && S.push(A), n?.frame && S.push(i);
|
|
@@ -1017,8 +1017,8 @@ class Lt extends IE {
|
|
|
1017
1017
|
), r`, `)}` : r``;
|
|
1018
1018
|
let i = r``;
|
|
1019
1019
|
if (n?.frame) {
|
|
1020
|
-
const { type: I, start: a, end: o } = n.frame, L = I.toUpperCase(),
|
|
1021
|
-
i = r`${r.raw(L)} BETWEEN ${r.raw(
|
|
1020
|
+
const { type: I, start: a, end: o } = n.frame, L = I.toUpperCase(), l = a === "unbounded" ? "UNBOUNDED PRECEDING" : typeof a == "number" ? `${a} PRECEDING` : "CURRENT ROW", C = o === "unbounded" ? "UNBOUNDED FOLLOWING" : o === "current" ? "CURRENT ROW" : typeof o == "number" ? `${o} FOLLOWING` : "CURRENT ROW";
|
|
1021
|
+
i = r`${r.raw(L)} BETWEEN ${r.raw(l)} AND ${r.raw(C)}`;
|
|
1022
1022
|
}
|
|
1023
1023
|
const S = [];
|
|
1024
1024
|
t && t.length > 0 && S.push(R), s && s.length > 0 && S.push(A), n?.frame && S.push(i);
|
|
@@ -1301,8 +1301,8 @@ class kt extends IE {
|
|
|
1301
1301
|
), r`, `)}` : r``;
|
|
1302
1302
|
let i = r``;
|
|
1303
1303
|
if (n?.frame) {
|
|
1304
|
-
const { type: I, start: a, end: o } = n.frame, L = I.toUpperCase(),
|
|
1305
|
-
i = r`${r.raw(L)} BETWEEN ${r.raw(
|
|
1304
|
+
const { type: I, start: a, end: o } = n.frame, L = I.toUpperCase(), l = a === "unbounded" ? "UNBOUNDED PRECEDING" : typeof a == "number" ? `${a} PRECEDING` : "CURRENT ROW", C = o === "unbounded" ? "UNBOUNDED FOLLOWING" : o === "current" ? "CURRENT ROW" : typeof o == "number" ? `${o} FOLLOWING` : "CURRENT ROW";
|
|
1305
|
+
i = r`${r.raw(L)} BETWEEN ${r.raw(l)} AND ${r.raw(C)}`;
|
|
1306
1306
|
}
|
|
1307
1307
|
const S = [];
|
|
1308
1308
|
t && t.length > 0 && S.push(R), s && s.length > 0 && S.push(A), n?.frame && S.push(i);
|
|
@@ -1964,7 +1964,7 @@ function iE(T, e) {
|
|
|
1964
1964
|
function SE(T) {
|
|
1965
1965
|
return T && typeof T == "object" ? r`${r`${T}`}` : T;
|
|
1966
1966
|
}
|
|
1967
|
-
function
|
|
1967
|
+
function B(T, e) {
|
|
1968
1968
|
const E = typeof T == "function" ? T(e) : T;
|
|
1969
1969
|
return SE(E);
|
|
1970
1970
|
}
|
|
@@ -2187,8 +2187,8 @@ class pe {
|
|
|
2187
2187
|
* Build time dimension expression with granularity using database adapter
|
|
2188
2188
|
*/
|
|
2189
2189
|
buildTimeDimensionExpression(e, E, t) {
|
|
2190
|
-
const s =
|
|
2191
|
-
return E ? this.databaseAdapter.buildTimeDimension(E, s) : s instanceof
|
|
2190
|
+
const s = B(e, t);
|
|
2191
|
+
return E ? this.databaseAdapter.buildTimeDimension(E, s) : s instanceof F ? s : r`${s}`;
|
|
2192
2192
|
}
|
|
2193
2193
|
/**
|
|
2194
2194
|
* Build date range condition for time dimensions
|
|
@@ -2292,8 +2292,8 @@ class pe {
|
|
|
2292
2292
|
return { start: I, end: a };
|
|
2293
2293
|
}
|
|
2294
2294
|
if (t === "last quarter") {
|
|
2295
|
-
const I = Math.floor(n / 3), a = I === 0 ? 3 : I - 1, o = I === 0 ? s - 1 : s, L = new Date(Date.UTC(o, a * 3, 1, 0, 0, 0, 0)),
|
|
2296
|
-
return { start: L, end:
|
|
2295
|
+
const I = Math.floor(n / 3), a = I === 0 ? 3 : I - 1, o = I === 0 ? s - 1 : s, L = new Date(Date.UTC(o, a * 3, 1, 0, 0, 0, 0)), l = new Date(Date.UTC(o, a * 3 + 3, 0, 23, 59, 59, 999));
|
|
2296
|
+
return { start: L, end: l };
|
|
2297
2297
|
}
|
|
2298
2298
|
if (t === "last year") {
|
|
2299
2299
|
const I = new Date(Date.UTC(s - 1, 0, 1, 0, 0, 0, 0)), a = new Date(Date.UTC(s - 1, 11, 31, 23, 59, 59, 999));
|
|
@@ -2497,7 +2497,7 @@ class oE {
|
|
|
2497
2497
|
if (!A) return null;
|
|
2498
2498
|
const i = A.dimensions?.[R];
|
|
2499
2499
|
if (!i) return null;
|
|
2500
|
-
const S =
|
|
2500
|
+
const S = B(i.sql, t);
|
|
2501
2501
|
return this.buildFilterCondition(
|
|
2502
2502
|
S,
|
|
2503
2503
|
s.operator,
|
|
@@ -2735,13 +2735,13 @@ function CT(T, e) {
|
|
|
2735
2735
|
throw new Error(
|
|
2736
2736
|
`Cannot substitute {${I}}: cube '${L}' not found`
|
|
2737
2737
|
);
|
|
2738
|
-
const C = `${L}.${o}`,
|
|
2739
|
-
if (!
|
|
2738
|
+
const C = `${L}.${o}`, c = s.get(C);
|
|
2739
|
+
if (!c)
|
|
2740
2740
|
throw new Error(
|
|
2741
2741
|
`Cannot substitute {${I}}: measure '${C}' not resolved yet. Ensure measures are resolved in dependency order.`
|
|
2742
2742
|
);
|
|
2743
|
-
const
|
|
2744
|
-
R.set(I,
|
|
2743
|
+
const M = c(), P = r`${M}`;
|
|
2744
|
+
R.set(I, P);
|
|
2745
2745
|
}
|
|
2746
2746
|
const A = [], i = [];
|
|
2747
2747
|
let S = 0;
|
|
@@ -2813,7 +2813,7 @@ function ye(T, e) {
|
|
|
2813
2813
|
}
|
|
2814
2814
|
return Array.from(t);
|
|
2815
2815
|
}
|
|
2816
|
-
class
|
|
2816
|
+
class H {
|
|
2817
2817
|
constructor(e) {
|
|
2818
2818
|
this.databaseAdapter = e;
|
|
2819
2819
|
}
|
|
@@ -2836,16 +2836,16 @@ class F {
|
|
|
2836
2836
|
const [O, I] = N.split("."), a = E.get(O);
|
|
2837
2837
|
if (a && a.measures && a.measures[I]) {
|
|
2838
2838
|
const o = a.measures[I];
|
|
2839
|
-
if (
|
|
2840
|
-
const L =
|
|
2839
|
+
if (H.isPostAggregationWindow(o)) {
|
|
2840
|
+
const L = H.getWindowBaseMeasure(o, O);
|
|
2841
2841
|
L && i.add(L);
|
|
2842
2842
|
continue;
|
|
2843
2843
|
}
|
|
2844
2844
|
k.isCalculatedMeasure(o) ? (A.push(N), ye(o.calculatedSql, O).forEach((C) => i.add(C)), S.getAllDependencies(N).forEach((C) => {
|
|
2845
|
-
const [
|
|
2846
|
-
if (
|
|
2847
|
-
const
|
|
2848
|
-
k.isCalculatedMeasure(
|
|
2845
|
+
const [c, M] = C.split("."), P = E.get(c);
|
|
2846
|
+
if (P && P.measures[M]) {
|
|
2847
|
+
const d = P.measures[M];
|
|
2848
|
+
k.isCalculatedMeasure(d) && ye(d.calculatedSql, c).forEach((f) => i.add(f));
|
|
2849
2849
|
}
|
|
2850
2850
|
})) : R.push(N);
|
|
2851
2851
|
}
|
|
@@ -2854,7 +2854,7 @@ class F {
|
|
|
2854
2854
|
const [O, I] = N.split("."), a = E.get(O);
|
|
2855
2855
|
if (a && a.measures && a.measures[I]) {
|
|
2856
2856
|
const o = a.measures[I];
|
|
2857
|
-
if (
|
|
2857
|
+
if (H.isPostAggregationWindow(o))
|
|
2858
2858
|
continue;
|
|
2859
2859
|
k.isCalculatedMeasure(o) ? A.includes(N) || A.push(N) : R.includes(N) || R.push(N);
|
|
2860
2860
|
}
|
|
@@ -2929,7 +2929,7 @@ class F {
|
|
|
2929
2929
|
case "count":
|
|
2930
2930
|
case "countDistinct":
|
|
2931
2931
|
case "sum":
|
|
2932
|
-
o =
|
|
2932
|
+
o = x(a);
|
|
2933
2933
|
break;
|
|
2934
2934
|
case "avg":
|
|
2935
2935
|
o = this.databaseAdapter.buildAvg(a);
|
|
@@ -2941,10 +2941,10 @@ class F {
|
|
|
2941
2941
|
o = oe(a);
|
|
2942
2942
|
break;
|
|
2943
2943
|
case "number":
|
|
2944
|
-
o =
|
|
2944
|
+
o = x(a);
|
|
2945
2945
|
break;
|
|
2946
2946
|
default:
|
|
2947
|
-
o =
|
|
2947
|
+
o = x(a);
|
|
2948
2948
|
}
|
|
2949
2949
|
R.set(i, () => o);
|
|
2950
2950
|
}
|
|
@@ -2986,7 +2986,7 @@ class F {
|
|
|
2986
2986
|
case "count":
|
|
2987
2987
|
case "countDistinct":
|
|
2988
2988
|
case "sum":
|
|
2989
|
-
return
|
|
2989
|
+
return x(A);
|
|
2990
2990
|
case "avg":
|
|
2991
2991
|
return this.databaseAdapter.buildAvg(A);
|
|
2992
2992
|
case "min":
|
|
@@ -2994,9 +2994,9 @@ class F {
|
|
|
2994
2994
|
case "max":
|
|
2995
2995
|
return oe(A);
|
|
2996
2996
|
case "number":
|
|
2997
|
-
return
|
|
2997
|
+
return x(A);
|
|
2998
2998
|
default:
|
|
2999
|
-
return
|
|
2999
|
+
return x(A);
|
|
3000
3000
|
}
|
|
3001
3001
|
}
|
|
3002
3002
|
}
|
|
@@ -3015,7 +3015,7 @@ class F {
|
|
|
3015
3015
|
throw new Error(
|
|
3016
3016
|
`Cannot build calculated measure '${e.name}' directly. Use buildCalculatedMeasure instead.`
|
|
3017
3017
|
);
|
|
3018
|
-
if (
|
|
3018
|
+
if (H.isPostAggregationWindow(e))
|
|
3019
3019
|
throw new Error(
|
|
3020
3020
|
`Post-aggregation window measure '${e.name}' should be built via buildPostAggregationWindowExpression, not buildMeasureExpression.`
|
|
3021
3021
|
);
|
|
@@ -3023,7 +3023,7 @@ class F {
|
|
|
3023
3023
|
throw new Error(
|
|
3024
3024
|
`Measure '${e.name}' of type '${e.type}' is missing required 'sql' property. Only calculated measures and post-aggregation window functions can omit 'sql'.`
|
|
3025
3025
|
);
|
|
3026
|
-
let s =
|
|
3026
|
+
let s = B(e.sql, E);
|
|
3027
3027
|
if (e.filters && e.filters.length > 0) {
|
|
3028
3028
|
const n = e.filters.map((R) => {
|
|
3029
3029
|
const A = R(E);
|
|
@@ -3042,7 +3042,7 @@ class F {
|
|
|
3042
3042
|
case "countDistinct":
|
|
3043
3043
|
return Qt(s);
|
|
3044
3044
|
case "sum":
|
|
3045
|
-
return
|
|
3045
|
+
return x(s);
|
|
3046
3046
|
case "avg":
|
|
3047
3047
|
return this.databaseAdapter.buildAvg(s);
|
|
3048
3048
|
case "min":
|
|
@@ -3099,7 +3099,7 @@ class F {
|
|
|
3099
3099
|
if (n.partitionBy && n.partitionBy.length > 0 && t) {
|
|
3100
3100
|
const S = n.partitionBy.map((N) => {
|
|
3101
3101
|
const O = N.includes(".") ? N.split(".")[1] : N, I = t.dimensions?.[O];
|
|
3102
|
-
return I ?
|
|
3102
|
+
return I ? B(I.sql, E) : (console.warn(`[drizzle-cube] Window function partition dimension '${N}' not found in cube '${t.name}'`), null);
|
|
3103
3103
|
}).filter((N) => N !== null);
|
|
3104
3104
|
S.length > 0 && (R = S);
|
|
3105
3105
|
}
|
|
@@ -3109,12 +3109,12 @@ class F {
|
|
|
3109
3109
|
const O = N.field.includes(".") ? N.field.split(".")[1] : N.field, I = t.dimensions?.[O];
|
|
3110
3110
|
if (I)
|
|
3111
3111
|
return {
|
|
3112
|
-
field:
|
|
3112
|
+
field: B(I.sql, E),
|
|
3113
3113
|
direction: N.direction
|
|
3114
3114
|
};
|
|
3115
3115
|
const a = t.measures?.[O];
|
|
3116
3116
|
return a && a.sql ? {
|
|
3117
|
-
field:
|
|
3117
|
+
field: B(a.sql, E),
|
|
3118
3118
|
direction: N.direction
|
|
3119
3119
|
} : (console.warn(`[drizzle-cube] Window function order field '${N.field}' not found in cube '${t.name}'`), null);
|
|
3120
3120
|
}).filter((N) => N !== null);
|
|
@@ -3163,7 +3163,7 @@ class F {
|
|
|
3163
3163
|
* @returns true if this is a window function type
|
|
3164
3164
|
*/
|
|
3165
3165
|
static isWindowFunction(e) {
|
|
3166
|
-
return
|
|
3166
|
+
return H.WINDOW_FUNCTION_TYPES.includes(e);
|
|
3167
3167
|
}
|
|
3168
3168
|
/**
|
|
3169
3169
|
* Categorize measures into window functions and regular aggregates
|
|
@@ -3179,7 +3179,7 @@ class F {
|
|
|
3179
3179
|
const [R, A] = n.split("."), i = E.get(R);
|
|
3180
3180
|
if (i?.measures?.[A]) {
|
|
3181
3181
|
const S = i.measures[A];
|
|
3182
|
-
|
|
3182
|
+
H.isWindowFunction(S.type) ? t.push(n) : s.push(n);
|
|
3183
3183
|
}
|
|
3184
3184
|
}
|
|
3185
3185
|
return { windowMeasures: t, aggregateMeasures: s };
|
|
@@ -3191,7 +3191,7 @@ class F {
|
|
|
3191
3191
|
* @returns true if any measure is a window function
|
|
3192
3192
|
*/
|
|
3193
3193
|
static hasWindowFunctions(e, E) {
|
|
3194
|
-
const { windowMeasures: t } =
|
|
3194
|
+
const { windowMeasures: t } = H.categorizeMeasures(e, E);
|
|
3195
3195
|
return t.length > 0;
|
|
3196
3196
|
}
|
|
3197
3197
|
// ============================================================================
|
|
@@ -3206,7 +3206,7 @@ class F {
|
|
|
3206
3206
|
* @returns true if this is a post-aggregation window function
|
|
3207
3207
|
*/
|
|
3208
3208
|
static isPostAggregationWindow(e) {
|
|
3209
|
-
return
|
|
3209
|
+
return H.isWindowFunction(e.type) && e.windowConfig?.measure !== void 0;
|
|
3210
3210
|
}
|
|
3211
3211
|
/**
|
|
3212
3212
|
* Get the base measure reference for a post-aggregation window function.
|
|
@@ -3257,11 +3257,11 @@ class F {
|
|
|
3257
3257
|
const [A, i] = R.split("."), S = E.get(A);
|
|
3258
3258
|
if (S?.measures?.[i]) {
|
|
3259
3259
|
const N = S.measures[i];
|
|
3260
|
-
if (
|
|
3260
|
+
if (H.isPostAggregationWindow(N)) {
|
|
3261
3261
|
s.push(R);
|
|
3262
|
-
const O =
|
|
3262
|
+
const O = H.getWindowBaseMeasure(N, A);
|
|
3263
3263
|
O && n.add(O);
|
|
3264
|
-
} else
|
|
3264
|
+
} else H.isWindowFunction(N.type) || t.push(R);
|
|
3265
3265
|
}
|
|
3266
3266
|
}
|
|
3267
3267
|
return { aggregateMeasures: t, postAggWindowMeasures: s, requiredBaseMeasures: n };
|
|
@@ -3274,7 +3274,7 @@ class F {
|
|
|
3274
3274
|
* @returns true if any measure is a post-aggregation window function
|
|
3275
3275
|
*/
|
|
3276
3276
|
static hasPostAggregationWindows(e, E) {
|
|
3277
|
-
const { postAggWindowMeasures: t } =
|
|
3277
|
+
const { postAggWindowMeasures: t } = H.categorizeForPostAggregation(
|
|
3278
3278
|
e,
|
|
3279
3279
|
E
|
|
3280
3280
|
);
|
|
@@ -3346,11 +3346,11 @@ class LT {
|
|
|
3346
3346
|
N = !0;
|
|
3347
3347
|
break;
|
|
3348
3348
|
}
|
|
3349
|
-
if (
|
|
3350
|
-
const
|
|
3351
|
-
if (
|
|
3352
|
-
const [C,
|
|
3353
|
-
if (
|
|
3349
|
+
if (H.isPostAggregationWindow(L)) {
|
|
3350
|
+
const l = H.getWindowBaseMeasure(L, I);
|
|
3351
|
+
if (l) {
|
|
3352
|
+
const [C, c] = l.split("."), P = R.get(C)?.measures?.[c];
|
|
3353
|
+
if (P && this.isAggregateFunctionType(P.type)) {
|
|
3354
3354
|
N = !0;
|
|
3355
3355
|
break;
|
|
3356
3356
|
}
|
|
@@ -3364,16 +3364,16 @@ class LT {
|
|
|
3364
3364
|
for (const O of E.dimensions) {
|
|
3365
3365
|
const [I, a] = O.split("."), o = R.get(I);
|
|
3366
3366
|
if (o && o.dimensions && o.dimensions[a])
|
|
3367
|
-
if (s?.preAggregationCTEs?.some((
|
|
3368
|
-
const
|
|
3367
|
+
if (s?.preAggregationCTEs?.some((l) => l.cube.name === I)) {
|
|
3368
|
+
const l = s.preAggregationCTEs.find((c) => c.cube.name === I), C = l.joinKeys.find((c) => c.targetColumn === a);
|
|
3369
3369
|
if (C && C.sourceColumnObj)
|
|
3370
3370
|
n.push(C.sourceColumnObj);
|
|
3371
3371
|
else {
|
|
3372
|
-
const
|
|
3373
|
-
n.push(
|
|
3372
|
+
const c = r`${r.identifier(l.cteAlias)}.${r.identifier(a)}`;
|
|
3373
|
+
n.push(c);
|
|
3374
3374
|
}
|
|
3375
3375
|
} else {
|
|
3376
|
-
const
|
|
3376
|
+
const l = o.dimensions[a], C = B(l.sql, t);
|
|
3377
3377
|
n.push(C);
|
|
3378
3378
|
}
|
|
3379
3379
|
}
|
|
@@ -3381,22 +3381,22 @@ class LT {
|
|
|
3381
3381
|
for (const O of E.timeDimensions) {
|
|
3382
3382
|
const [I, a] = O.dimension.split("."), o = R.get(I);
|
|
3383
3383
|
if (o && o.dimensions && o.dimensions[a])
|
|
3384
|
-
if (s?.preAggregationCTEs?.some((
|
|
3385
|
-
const
|
|
3384
|
+
if (s?.preAggregationCTEs?.some((l) => l.cube.name === I)) {
|
|
3385
|
+
const l = s.preAggregationCTEs.find((c) => c.cube.name === I), C = l.joinKeys.find((c) => c.targetColumn === a);
|
|
3386
3386
|
if (C && C.sourceColumnObj) {
|
|
3387
|
-
const
|
|
3387
|
+
const c = this.dateTimeBuilder.buildTimeDimensionExpression(
|
|
3388
3388
|
C.sourceColumnObj,
|
|
3389
3389
|
O.granularity,
|
|
3390
3390
|
t
|
|
3391
3391
|
);
|
|
3392
|
-
n.push(
|
|
3392
|
+
n.push(c);
|
|
3393
3393
|
} else {
|
|
3394
|
-
const
|
|
3395
|
-
n.push(
|
|
3394
|
+
const c = r`${r.identifier(l.cteAlias)}.${r.identifier(a)}`;
|
|
3395
|
+
n.push(c);
|
|
3396
3396
|
}
|
|
3397
3397
|
} else {
|
|
3398
|
-
const
|
|
3399
|
-
|
|
3398
|
+
const l = o.dimensions[a], C = this.dateTimeBuilder.buildTimeDimensionExpression(
|
|
3399
|
+
l.sql,
|
|
3400
3400
|
O.granularity,
|
|
3401
3401
|
t
|
|
3402
3402
|
);
|
|
@@ -3412,7 +3412,7 @@ class lT {
|
|
|
3412
3412
|
groupByBuilder;
|
|
3413
3413
|
measureBuilder;
|
|
3414
3414
|
constructor(e) {
|
|
3415
|
-
this.dateTimeBuilder = new pe(e), this.filterBuilder = new oE(e, this.dateTimeBuilder), this.groupByBuilder = new LT(this.dateTimeBuilder), this.measureBuilder = new
|
|
3415
|
+
this.dateTimeBuilder = new pe(e), this.filterBuilder = new oE(e, this.dateTimeBuilder), this.groupByBuilder = new LT(this.dateTimeBuilder), this.measureBuilder = new H(e);
|
|
3416
3416
|
}
|
|
3417
3417
|
/**
|
|
3418
3418
|
* Build resolvedMeasures map for a set of measures
|
|
@@ -3432,7 +3432,7 @@ class lT {
|
|
|
3432
3432
|
for (const R of E.dimensions) {
|
|
3433
3433
|
const [A, i] = R.split("."), S = n.get(A);
|
|
3434
3434
|
if (S && S.dimensions && S.dimensions[i]) {
|
|
3435
|
-
const N = S.dimensions[i], O =
|
|
3435
|
+
const N = S.dimensions[i], O = B(N.sql, t);
|
|
3436
3436
|
s[R] = r`${O}`.as(R);
|
|
3437
3437
|
}
|
|
3438
3438
|
}
|
|
@@ -3527,13 +3527,13 @@ class lT {
|
|
|
3527
3527
|
if (s?.preAggregationCTEs && s.preAggregationCTEs.some((C) => C.cube.name === N))
|
|
3528
3528
|
continue;
|
|
3529
3529
|
if (t.filterCache) {
|
|
3530
|
-
const
|
|
3530
|
+
const l = ut(S.dimension, S.dateRange), C = t.filterCache.get(l);
|
|
3531
3531
|
if (C) {
|
|
3532
3532
|
R.push(C);
|
|
3533
3533
|
continue;
|
|
3534
3534
|
}
|
|
3535
3535
|
}
|
|
3536
|
-
const a = I.dimensions[O], o =
|
|
3536
|
+
const a = I.dimensions[O], o = B(a.sql, t), L = this.buildDateRangeCondition(o, S.dateRange);
|
|
3537
3537
|
L && R.push(L);
|
|
3538
3538
|
}
|
|
3539
3539
|
}
|
|
@@ -3573,15 +3573,15 @@ class lT {
|
|
|
3573
3573
|
const N = S.dimensions[i], O = S.measures[i], I = N || O;
|
|
3574
3574
|
if (!I) return null;
|
|
3575
3575
|
if (s === "where" && N) {
|
|
3576
|
-
if (n?.preAggregationCTEs && n.preAggregationCTEs.some((
|
|
3576
|
+
if (n?.preAggregationCTEs && n.preAggregationCTEs.some((l) => l.cube.name === A))
|
|
3577
3577
|
return null;
|
|
3578
3578
|
const a = ["arrayContains", "arrayOverlaps", "arrayContained"].includes(R.operator);
|
|
3579
3579
|
if (!a && t.filterCache) {
|
|
3580
|
-
const L = Me(e),
|
|
3581
|
-
if (
|
|
3582
|
-
return
|
|
3580
|
+
const L = Me(e), l = t.filterCache.get(L);
|
|
3581
|
+
if (l)
|
|
3582
|
+
return l;
|
|
3583
3583
|
}
|
|
3584
|
-
const o = a ? typeof N.sql == "function" ? N.sql(t) : N.sql :
|
|
3584
|
+
const o = a ? typeof N.sql == "function" ? N.sql(t) : N.sql : B(N.sql, t);
|
|
3585
3585
|
return this.buildFilterCondition(
|
|
3586
3586
|
o,
|
|
3587
3587
|
R.operator,
|
|
@@ -3779,12 +3779,14 @@ class _e {
|
|
|
3779
3779
|
return this.findPath(e, E, s);
|
|
3780
3780
|
const R = n.map((A) => {
|
|
3781
3781
|
let i = 0;
|
|
3782
|
-
|
|
3783
|
-
(
|
|
3784
|
-
) && (i += 10)
|
|
3782
|
+
A.some(
|
|
3783
|
+
(O, I) => O.joinDef.preferredFor?.includes(E) && I === 0
|
|
3784
|
+
) && (i += 10);
|
|
3785
|
+
const N = A.filter((O) => t.has(O.toCube)).length;
|
|
3786
|
+
return i += N, i -= A.length - 1, {
|
|
3785
3787
|
path: A,
|
|
3786
3788
|
score: i,
|
|
3787
|
-
usesProcessed: A.some((
|
|
3789
|
+
usesProcessed: A.some((O) => s.has(O.toCube))
|
|
3788
3790
|
};
|
|
3789
3791
|
});
|
|
3790
3792
|
return R.sort((A, i) => i.score !== A.score ? i.score - A.score : A.usesProcessed !== i.usesProcessed ? A.usesProcessed ? -1 : 1 : A.path.length - i.path.length), R[0].path;
|
|
@@ -4054,24 +4056,24 @@ class Dt {
|
|
|
4054
4056
|
if (!L)
|
|
4055
4057
|
throw new Error(`Cube '${a}' not found`);
|
|
4056
4058
|
if (o.relationship === "belongsToMany" && o.through) {
|
|
4057
|
-
const
|
|
4059
|
+
const l = ST(o, s.securityContext);
|
|
4058
4060
|
A.push({
|
|
4059
4061
|
cube: L,
|
|
4060
4062
|
alias: `${a.toLowerCase()}_cube`,
|
|
4061
|
-
joinType:
|
|
4063
|
+
joinType: l.junctionJoins[1].joinType,
|
|
4062
4064
|
// Use the target join type
|
|
4063
|
-
joinCondition:
|
|
4065
|
+
joinCondition: l.junctionJoins[1].condition,
|
|
4064
4066
|
// Target join condition
|
|
4065
4067
|
junctionTable: {
|
|
4066
4068
|
table: o.through.table,
|
|
4067
4069
|
alias: `junction_${a.toLowerCase()}`,
|
|
4068
|
-
joinType:
|
|
4069
|
-
joinCondition:
|
|
4070
|
+
joinType: l.junctionJoins[0].joinType,
|
|
4071
|
+
joinCondition: l.junctionJoins[0].condition,
|
|
4070
4072
|
securitySql: o.through.securitySql
|
|
4071
4073
|
}
|
|
4072
4074
|
});
|
|
4073
4075
|
} else {
|
|
4074
|
-
const
|
|
4076
|
+
const l = R.buildJoinCondition(
|
|
4075
4077
|
o,
|
|
4076
4078
|
null,
|
|
4077
4079
|
// No source alias needed - use the actual column
|
|
@@ -4082,7 +4084,7 @@ class Dt {
|
|
|
4082
4084
|
cube: L,
|
|
4083
4085
|
alias: `${a.toLowerCase()}_cube`,
|
|
4084
4086
|
joinType: C,
|
|
4085
|
-
joinCondition:
|
|
4087
|
+
joinCondition: l
|
|
4086
4088
|
});
|
|
4087
4089
|
}
|
|
4088
4090
|
i.add(a);
|
|
@@ -4113,18 +4115,18 @@ class Dt {
|
|
|
4113
4115
|
targetColumn: C.target.name,
|
|
4114
4116
|
sourceColumnObj: C.source,
|
|
4115
4117
|
targetColumnObj: C.target
|
|
4116
|
-
})), I = this.findPropagatingFilters(s, R.cube, e), a = /* @__PURE__ */ new Map([[R.cube.name, R.cube]]), { aggregateMeasures: o, requiredBaseMeasures: L } =
|
|
4118
|
+
})), I = this.findPropagatingFilters(s, R.cube, e), a = /* @__PURE__ */ new Map([[R.cube.name, R.cube]]), { aggregateMeasures: o, requiredBaseMeasures: L } = H.categorizeForPostAggregation(
|
|
4117
4119
|
N,
|
|
4118
4120
|
a
|
|
4119
|
-
),
|
|
4121
|
+
), l = [.../* @__PURE__ */ new Set([
|
|
4120
4122
|
...o,
|
|
4121
4123
|
...Array.from(L).filter((C) => C.startsWith(R.cube.name + "."))
|
|
4122
4124
|
])];
|
|
4123
|
-
if (
|
|
4125
|
+
if (l.length > 0) {
|
|
4124
4126
|
const C = this.expandCalculatedMeasureDependencies(
|
|
4125
4127
|
R.cube,
|
|
4126
|
-
|
|
4127
|
-
),
|
|
4128
|
+
l
|
|
4129
|
+
), c = this.findDownstreamJoinKeys(
|
|
4128
4130
|
R.cube,
|
|
4129
4131
|
s,
|
|
4130
4132
|
e
|
|
@@ -4136,7 +4138,7 @@ class Dt {
|
|
|
4136
4138
|
joinKeys: O,
|
|
4137
4139
|
measures: C,
|
|
4138
4140
|
propagatingFilters: I.length > 0 ? I : void 0,
|
|
4139
|
-
downstreamJoinKeys:
|
|
4141
|
+
downstreamJoinKeys: c.length > 0 ? c : void 0,
|
|
4140
4142
|
cteType: "aggregate"
|
|
4141
4143
|
});
|
|
4142
4144
|
}
|
|
@@ -4419,10 +4421,10 @@ class Dt {
|
|
|
4419
4421
|
i.querySummary.joinCount = O.length, i.querySummary.cteCount = i.preAggregations.length, i.querySummary.hasPreAggregation = i.preAggregations.length > 0;
|
|
4420
4422
|
const a = /* @__PURE__ */ new Map();
|
|
4421
4423
|
for (const L of n) {
|
|
4422
|
-
const
|
|
4423
|
-
|
|
4424
|
+
const l = e.get(L);
|
|
4425
|
+
l && a.set(L, l);
|
|
4424
4426
|
}
|
|
4425
|
-
const o =
|
|
4427
|
+
const o = H.hasPostAggregationWindows(
|
|
4426
4428
|
E.measures || [],
|
|
4427
4429
|
a
|
|
4428
4430
|
);
|
|
@@ -4554,26 +4556,26 @@ class Dt {
|
|
|
4554
4556
|
if (!i)
|
|
4555
4557
|
continue;
|
|
4556
4558
|
const S = s.measures.filter(
|
|
4557
|
-
(
|
|
4559
|
+
(c) => c.startsWith(R + ".")
|
|
4558
4560
|
), N = this.extractMeasuresFromFilters(s, i), O = [.../* @__PURE__ */ new Set([...S, ...N])];
|
|
4559
4561
|
if (O.length === 0)
|
|
4560
4562
|
continue;
|
|
4561
|
-
const I = A.on.map((
|
|
4562
|
-
sourceColumn:
|
|
4563
|
-
targetColumn:
|
|
4564
|
-
})), a = /* @__PURE__ */ new Map([[R, i]]), { aggregateMeasures: o, postAggWindowMeasures: L, requiredBaseMeasures:
|
|
4563
|
+
const I = A.on.map((c) => ({
|
|
4564
|
+
sourceColumn: c.source.name,
|
|
4565
|
+
targetColumn: c.target.name
|
|
4566
|
+
})), a = /* @__PURE__ */ new Map([[R, i]]), { aggregateMeasures: o, postAggWindowMeasures: L, requiredBaseMeasures: l } = H.categorizeForPostAggregation(
|
|
4565
4567
|
O,
|
|
4566
4568
|
a
|
|
4567
4569
|
), C = [.../* @__PURE__ */ new Set([
|
|
4568
4570
|
...o,
|
|
4569
|
-
...Array.from(
|
|
4571
|
+
...Array.from(l).filter((c) => c.startsWith(R + "."))
|
|
4570
4572
|
])];
|
|
4571
4573
|
if (C.length > 0) {
|
|
4572
|
-
const
|
|
4574
|
+
const c = L.length > 0;
|
|
4573
4575
|
n.push({
|
|
4574
4576
|
cubeName: R,
|
|
4575
4577
|
cteAlias: `${R.toLowerCase()}_agg`,
|
|
4576
|
-
reason:
|
|
4578
|
+
reason: c ? `hasMany relationship from ${E.name} - requires pre-aggregation; includes base measures for post-aggregation window functions` : `hasMany relationship from ${E.name} - requires pre-aggregation to prevent row duplication (fan-out)`,
|
|
4577
4579
|
measures: C,
|
|
4578
4580
|
joinKeys: I,
|
|
4579
4581
|
cteType: "aggregate"
|
|
@@ -4598,42 +4600,42 @@ class uT {
|
|
|
4598
4600
|
*/
|
|
4599
4601
|
buildPreAggregationCTE(e, E, t, s, n) {
|
|
4600
4602
|
const R = e.cube, A = R.sql(t), i = {};
|
|
4601
|
-
for (const
|
|
4602
|
-
if (
|
|
4603
|
-
i[
|
|
4604
|
-
for (const [
|
|
4605
|
-
|
|
4603
|
+
for (const P of e.joinKeys)
|
|
4604
|
+
if (P.targetColumnObj) {
|
|
4605
|
+
i[P.targetColumn] = P.targetColumnObj;
|
|
4606
|
+
for (const [d, m] of Object.entries(R.dimensions || {}))
|
|
4607
|
+
m.sql === P.targetColumnObj && d !== P.targetColumn && (i[d] = r`${P.targetColumnObj}`.as(d));
|
|
4606
4608
|
}
|
|
4607
4609
|
if (e.downstreamJoinKeys)
|
|
4608
|
-
for (const
|
|
4609
|
-
for (const
|
|
4610
|
-
|
|
4610
|
+
for (const P of e.downstreamJoinKeys)
|
|
4611
|
+
for (const d of P.joinKeys)
|
|
4612
|
+
d.sourceColumnObj && (i[d.sourceColumn] = d.sourceColumnObj);
|
|
4611
4613
|
const S = R.name, N = /* @__PURE__ */ new Map([[S, R]]), O = this.queryBuilder.buildResolvedMeasures(
|
|
4612
4614
|
e.measures,
|
|
4613
4615
|
N,
|
|
4614
4616
|
t
|
|
4615
4617
|
);
|
|
4616
|
-
for (const
|
|
4617
|
-
const [,
|
|
4618
|
-
if (
|
|
4619
|
-
const
|
|
4620
|
-
i[
|
|
4618
|
+
for (const P of e.measures) {
|
|
4619
|
+
const [, d] = P.split("."), m = O.get(P);
|
|
4620
|
+
if (m) {
|
|
4621
|
+
const f = m();
|
|
4622
|
+
i[d] = r`${f}`.as(d);
|
|
4621
4623
|
}
|
|
4622
4624
|
}
|
|
4623
4625
|
if (E.dimensions)
|
|
4624
|
-
for (const
|
|
4625
|
-
const [
|
|
4626
|
-
if (
|
|
4627
|
-
const
|
|
4628
|
-
i[
|
|
4626
|
+
for (const P of E.dimensions) {
|
|
4627
|
+
const [d, m] = P.split(".");
|
|
4628
|
+
if (d === S && R.dimensions && R.dimensions[m]) {
|
|
4629
|
+
const f = R.dimensions[m], G = this.queryBuilder.buildMeasureExpression({ sql: f.sql, type: "number" }, t);
|
|
4630
|
+
i[m] = r`${G}`.as(m);
|
|
4629
4631
|
}
|
|
4630
4632
|
}
|
|
4631
4633
|
if (E.timeDimensions)
|
|
4632
|
-
for (const
|
|
4633
|
-
const [
|
|
4634
|
-
if (
|
|
4635
|
-
const
|
|
4636
|
-
i[
|
|
4634
|
+
for (const P of E.timeDimensions) {
|
|
4635
|
+
const [d, m] = P.dimension.split(".");
|
|
4636
|
+
if (d === S && R.dimensions && R.dimensions[m]) {
|
|
4637
|
+
const f = R.dimensions[m], G = this.queryBuilder.buildTimeDimensionExpression(f.sql, P.granularity, t);
|
|
4638
|
+
i[m] = r`${G}`.as(m);
|
|
4637
4639
|
}
|
|
4638
4640
|
}
|
|
4639
4641
|
if (Object.keys(i).length === 0)
|
|
@@ -4641,63 +4643,66 @@ class uT {
|
|
|
4641
4643
|
let I = t.db.select(i).from(A.from);
|
|
4642
4644
|
const a = s ? {
|
|
4643
4645
|
...s,
|
|
4644
|
-
preAggregationCTEs: s.preAggregationCTEs?.filter((
|
|
4646
|
+
preAggregationCTEs: s.preAggregationCTEs?.filter((P) => P.cube.name !== R.name)
|
|
4645
4647
|
} : void 0, o = this.queryBuilder.buildWhereConditions(R, E, t, a, n), L = [];
|
|
4646
4648
|
if (E.timeDimensions)
|
|
4647
|
-
for (const
|
|
4648
|
-
const [
|
|
4649
|
-
if (
|
|
4650
|
-
const
|
|
4651
|
-
|
|
4649
|
+
for (const P of E.timeDimensions) {
|
|
4650
|
+
const [d, m] = P.dimension.split(".");
|
|
4651
|
+
if (d === S && R.dimensions && R.dimensions[m] && P.dateRange) {
|
|
4652
|
+
const f = R.dimensions[m], G = this.queryBuilder.buildMeasureExpression({ sql: f.sql, type: "number" }, t), W = this.queryBuilder.buildDateRangeCondition(G, P.dateRange);
|
|
4653
|
+
W && L.push(W);
|
|
4652
4654
|
}
|
|
4653
4655
|
}
|
|
4654
4656
|
if (E.filters) {
|
|
4655
|
-
for (const
|
|
4656
|
-
if (!("and" in
|
|
4657
|
-
const
|
|
4658
|
-
if (
|
|
4659
|
-
const
|
|
4660
|
-
if (
|
|
4661
|
-
const
|
|
4662
|
-
|
|
4657
|
+
for (const P of E.filters)
|
|
4658
|
+
if (!("and" in P) && !("or" in P) && "member" in P && "operator" in P) {
|
|
4659
|
+
const d = P, [m, f] = d.member.split(".");
|
|
4660
|
+
if (m === S && R.dimensions && R.dimensions[f]) {
|
|
4661
|
+
const G = R.dimensions[f];
|
|
4662
|
+
if (d.operator === "inDateRange") {
|
|
4663
|
+
const W = this.queryBuilder.buildMeasureExpression({ sql: G.sql, type: "number" }, t), X = this.queryBuilder.buildDateRangeCondition(W, d.values);
|
|
4664
|
+
X && L.push(X);
|
|
4663
4665
|
}
|
|
4664
4666
|
}
|
|
4665
4667
|
}
|
|
4666
4668
|
}
|
|
4667
4669
|
if (e.propagatingFilters && e.propagatingFilters.length > 0)
|
|
4668
|
-
for (const
|
|
4669
|
-
const
|
|
4670
|
-
|
|
4670
|
+
for (const P of e.propagatingFilters) {
|
|
4671
|
+
const d = this.buildPropagatingFilterSubquery(
|
|
4672
|
+
P,
|
|
4671
4673
|
t
|
|
4672
4674
|
);
|
|
4673
|
-
|
|
4675
|
+
d && L.push(d);
|
|
4674
4676
|
}
|
|
4675
|
-
const
|
|
4676
|
-
if (A.where &&
|
|
4677
|
-
const
|
|
4678
|
-
I = I.where(
|
|
4677
|
+
const l = [];
|
|
4678
|
+
if (A.where && l.push(A.where), l.push(...o, ...L), l.length > 0) {
|
|
4679
|
+
const P = l.length === 1 ? l[0] : h(...l);
|
|
4680
|
+
I = I.where(P);
|
|
4679
4681
|
}
|
|
4680
|
-
const C = []
|
|
4681
|
-
|
|
4682
|
-
|
|
4682
|
+
const C = [], c = /* @__PURE__ */ new Set(), M = (P) => {
|
|
4683
|
+
const d = P?.name || (typeof P == "string" ? P : null);
|
|
4684
|
+
d && !c.has(d) ? (c.add(d), C.push(P)) : d || C.push(P);
|
|
4685
|
+
};
|
|
4686
|
+
for (const P of e.joinKeys)
|
|
4687
|
+
P.targetColumnObj && M(P.targetColumnObj);
|
|
4683
4688
|
if (e.downstreamJoinKeys)
|
|
4684
|
-
for (const
|
|
4685
|
-
for (const
|
|
4686
|
-
|
|
4689
|
+
for (const P of e.downstreamJoinKeys)
|
|
4690
|
+
for (const d of P.joinKeys)
|
|
4691
|
+
d.sourceColumnObj && M(d.sourceColumnObj);
|
|
4687
4692
|
if (E.dimensions)
|
|
4688
|
-
for (const
|
|
4689
|
-
const [
|
|
4690
|
-
if (
|
|
4691
|
-
const
|
|
4692
|
-
C.push(
|
|
4693
|
+
for (const P of E.dimensions) {
|
|
4694
|
+
const [d, m] = P.split(".");
|
|
4695
|
+
if (d === S && R.dimensions && R.dimensions[m]) {
|
|
4696
|
+
const f = R.dimensions[m], G = B(f.sql, t);
|
|
4697
|
+
C.push(G);
|
|
4693
4698
|
}
|
|
4694
4699
|
}
|
|
4695
4700
|
if (E.timeDimensions)
|
|
4696
|
-
for (const
|
|
4697
|
-
const [
|
|
4698
|
-
if (
|
|
4699
|
-
const
|
|
4700
|
-
C.push(
|
|
4701
|
+
for (const P of E.timeDimensions) {
|
|
4702
|
+
const [d, m] = P.dimension.split(".");
|
|
4703
|
+
if (d === S && R.dimensions && R.dimensions[m]) {
|
|
4704
|
+
const f = R.dimensions[m], G = this.queryBuilder.buildTimeDimensionExpression(f.sql, P.granularity, t);
|
|
4705
|
+
C.push(G);
|
|
4701
4706
|
}
|
|
4702
4707
|
}
|
|
4703
4708
|
return C.length > 0 && (I = I.groupBy(...C)), t.db.$with(e.cteAlias).as(I);
|
|
@@ -4858,18 +4863,18 @@ function MT(T, e) {
|
|
|
4858
4863
|
for (const [O, I] of S) {
|
|
4859
4864
|
const a = I.size > 0 ? I.values().next().value : null;
|
|
4860
4865
|
for (const o of i) {
|
|
4861
|
-
const L = o.toISOString(),
|
|
4862
|
-
if (
|
|
4863
|
-
N.push(
|
|
4866
|
+
const L = o.toISOString(), l = I.get(L);
|
|
4867
|
+
if (l)
|
|
4868
|
+
N.push(l);
|
|
4864
4869
|
else {
|
|
4865
4870
|
const C = {
|
|
4866
4871
|
[E]: L
|
|
4867
4872
|
};
|
|
4868
4873
|
if (a)
|
|
4869
|
-
for (const
|
|
4870
|
-
C[
|
|
4871
|
-
for (const
|
|
4872
|
-
C[
|
|
4874
|
+
for (const c of A)
|
|
4875
|
+
C[c] = a[c];
|
|
4876
|
+
for (const c of R)
|
|
4877
|
+
C[c] = n;
|
|
4873
4878
|
N.push(C);
|
|
4874
4879
|
}
|
|
4875
4880
|
}
|
|
@@ -5285,7 +5290,7 @@ class pT {
|
|
|
5285
5290
|
const [, A] = e.bindingKey.split("."), i = E.dimensions?.[A];
|
|
5286
5291
|
if (!i)
|
|
5287
5292
|
throw new Error(`Binding key dimension not found: ${e.bindingKey}`);
|
|
5288
|
-
return
|
|
5293
|
+
return B(i.sql, t);
|
|
5289
5294
|
}
|
|
5290
5295
|
const s = e.bindingKey.find((A) => A.cube === E.name);
|
|
5291
5296
|
if (!s)
|
|
@@ -5293,7 +5298,7 @@ class pT {
|
|
|
5293
5298
|
const [, n] = s.dimension.split("."), R = E.dimensions?.[n];
|
|
5294
5299
|
if (!R)
|
|
5295
5300
|
throw new Error(`Binding key dimension not found: ${s.dimension}`);
|
|
5296
|
-
return
|
|
5301
|
+
return B(R.sql, t);
|
|
5297
5302
|
}
|
|
5298
5303
|
/**
|
|
5299
5304
|
* Resolve time dimension expression for a cube
|
|
@@ -5303,7 +5308,7 @@ class pT {
|
|
|
5303
5308
|
const [, A] = e.timeDimension.split("."), i = E.dimensions?.[A];
|
|
5304
5309
|
if (!i)
|
|
5305
5310
|
throw new Error(`Time dimension not found: ${e.timeDimension}`);
|
|
5306
|
-
return
|
|
5311
|
+
return B(i.sql, t);
|
|
5307
5312
|
}
|
|
5308
5313
|
const s = e.timeDimension.find((A) => A.cube === E.name);
|
|
5309
5314
|
if (!s)
|
|
@@ -5311,7 +5316,7 @@ class pT {
|
|
|
5311
5316
|
const [, n] = s.dimension.split("."), R = E.dimensions?.[n];
|
|
5312
5317
|
if (!R)
|
|
5313
5318
|
throw new Error(`Time dimension not found: ${s.dimension}`);
|
|
5314
|
-
return
|
|
5319
|
+
return B(R.sql, t);
|
|
5315
5320
|
}
|
|
5316
5321
|
/**
|
|
5317
5322
|
* Build filter conditions for a step
|
|
@@ -5341,24 +5346,24 @@ class pT {
|
|
|
5341
5346
|
const n = "and" in e || "or" in e, R = "type" in e && "filters" in e && (e.type === "and" || e.type === "or");
|
|
5342
5347
|
if (n || R) {
|
|
5343
5348
|
const L = [];
|
|
5344
|
-
let
|
|
5349
|
+
let l;
|
|
5345
5350
|
if (R) {
|
|
5346
5351
|
const C = e;
|
|
5347
|
-
|
|
5348
|
-
for (const
|
|
5349
|
-
const
|
|
5350
|
-
|
|
5352
|
+
l = C.type === "and";
|
|
5353
|
+
for (const c of C.filters || []) {
|
|
5354
|
+
const M = this.buildFilterCondition(c, E, t, s);
|
|
5355
|
+
M && L.push(M);
|
|
5351
5356
|
}
|
|
5352
5357
|
} else {
|
|
5353
5358
|
const C = e;
|
|
5354
|
-
|
|
5355
|
-
const
|
|
5356
|
-
for (const
|
|
5357
|
-
const
|
|
5358
|
-
|
|
5359
|
+
l = "and" in C && !!C.and;
|
|
5360
|
+
const c = C.and || C.or || [];
|
|
5361
|
+
for (const M of c) {
|
|
5362
|
+
const P = this.buildFilterCondition(M, E, t, s);
|
|
5363
|
+
P && L.push(P);
|
|
5359
5364
|
}
|
|
5360
5365
|
}
|
|
5361
|
-
return L.length === 0 ? null : L.length === 1 ? L[0] :
|
|
5366
|
+
return L.length === 0 ? null : L.length === 1 ? L[0] : l ? h(...L) : r`(${r.join(L, r` OR `)})`;
|
|
5362
5367
|
}
|
|
5363
5368
|
const A = e, [i, S] = A.member.split("."), N = A.dateRange !== void 0;
|
|
5364
5369
|
if (A.operator !== "set" && A.operator !== "notSet" && !N && (!A.values || A.values.length === 0 || A.values[0] === void 0 || A.values[0] === ""))
|
|
@@ -5367,15 +5372,15 @@ class pT {
|
|
|
5367
5372
|
if (!I)
|
|
5368
5373
|
return null;
|
|
5369
5374
|
if (i !== E.name) {
|
|
5370
|
-
const
|
|
5371
|
-
if (!
|
|
5375
|
+
const l = new _e(t).findPath(E.name, i);
|
|
5376
|
+
if (!l || l.length === 0)
|
|
5372
5377
|
return console.warn(
|
|
5373
5378
|
`Funnel filter: Cannot filter by '${i}.${S}' in step using '${E.name}'. No join path found. Filter will be skipped.`
|
|
5374
5379
|
), null;
|
|
5375
5380
|
}
|
|
5376
5381
|
const a = I.dimensions?.[S];
|
|
5377
5382
|
if (!a) return null;
|
|
5378
|
-
const o =
|
|
5383
|
+
const o = B(a.sql, s);
|
|
5379
5384
|
return this.filterBuilder.buildFilterCondition(
|
|
5380
5385
|
o,
|
|
5381
5386
|
A.operator,
|
|
@@ -5641,8 +5646,8 @@ class fT {
|
|
|
5641
5646
|
N.push(o);
|
|
5642
5647
|
const L = this.buildLinksAggregationCTE(i, t);
|
|
5643
5648
|
N.push(L);
|
|
5644
|
-
const
|
|
5645
|
-
return N.push(
|
|
5649
|
+
const l = this.buildFinalResultCTE(t);
|
|
5650
|
+
return N.push(l), t.db.with(...N).select().from(l);
|
|
5646
5651
|
}
|
|
5647
5652
|
/**
|
|
5648
5653
|
* Transform raw SQL result to FlowResultRow
|
|
@@ -5708,7 +5713,7 @@ class fT {
|
|
|
5708
5713
|
const [, A] = e.bindingKey.split("."), i = E.dimensions?.[A];
|
|
5709
5714
|
if (!i)
|
|
5710
5715
|
throw new Error(`Binding key dimension not found: ${e.bindingKey}`);
|
|
5711
|
-
return
|
|
5716
|
+
return B(i.sql, t);
|
|
5712
5717
|
}
|
|
5713
5718
|
const s = e.bindingKey.find((A) => A.cube === E.name);
|
|
5714
5719
|
if (!s)
|
|
@@ -5716,7 +5721,7 @@ class fT {
|
|
|
5716
5721
|
const [, n] = s.dimension.split("."), R = E.dimensions?.[n];
|
|
5717
5722
|
if (!R)
|
|
5718
5723
|
throw new Error(`Binding key dimension not found: ${s.dimension}`);
|
|
5719
|
-
return
|
|
5724
|
+
return B(R.sql, t);
|
|
5720
5725
|
}
|
|
5721
5726
|
/**
|
|
5722
5727
|
* Resolve time dimension expression
|
|
@@ -5726,7 +5731,7 @@ class fT {
|
|
|
5726
5731
|
const [, A] = e.timeDimension.split("."), i = E.dimensions?.[A];
|
|
5727
5732
|
if (!i)
|
|
5728
5733
|
throw new Error(`Time dimension not found: ${e.timeDimension}`);
|
|
5729
|
-
return
|
|
5734
|
+
return B(i.sql, t);
|
|
5730
5735
|
}
|
|
5731
5736
|
const s = e.timeDimension.find((A) => A.cube === E.name);
|
|
5732
5737
|
if (!s)
|
|
@@ -5734,7 +5739,7 @@ class fT {
|
|
|
5734
5739
|
const [, n] = s.dimension.split("."), R = E.dimensions?.[n];
|
|
5735
5740
|
if (!R)
|
|
5736
5741
|
throw new Error(`Time dimension not found: ${s.dimension}`);
|
|
5737
|
-
return
|
|
5742
|
+
return B(R.sql, t);
|
|
5738
5743
|
}
|
|
5739
5744
|
/**
|
|
5740
5745
|
* Resolve event dimension expression
|
|
@@ -5743,7 +5748,7 @@ class fT {
|
|
|
5743
5748
|
const [, s] = e.eventDimension.split("."), n = E.dimensions?.[s];
|
|
5744
5749
|
if (!n)
|
|
5745
5750
|
throw new Error(`Event dimension not found: ${e.eventDimension}`);
|
|
5746
|
-
return
|
|
5751
|
+
return B(n.sql, t);
|
|
5747
5752
|
}
|
|
5748
5753
|
/**
|
|
5749
5754
|
* Build filter conditions for the starting step
|
|
@@ -5780,7 +5785,7 @@ class fT {
|
|
|
5780
5785
|
}
|
|
5781
5786
|
const s = e, [, n] = s.member.split("."), R = E.dimensions?.[n];
|
|
5782
5787
|
if (!R) return null;
|
|
5783
|
-
const A =
|
|
5788
|
+
const A = B(R.sql, t);
|
|
5784
5789
|
return this.filterBuilder.buildFilterCondition(
|
|
5785
5790
|
A,
|
|
5786
5791
|
s.operator,
|
|
@@ -5825,12 +5830,12 @@ class fT {
|
|
|
5825
5830
|
r`${n} = ${r.identifier(O)}.binding_key`,
|
|
5826
5831
|
r`${R} < ${r.identifier(O)}.${r.identifier(I)}`
|
|
5827
5832
|
);
|
|
5828
|
-
const L = o.length === 1 ? o[0] : h(...o),
|
|
5833
|
+
const L = o.length === 1 ? o[0] : h(...o), l = S ? r`${A} || ${"→"} || ${r.identifier(O)}.event_path` : r`${A}`, C = t.db.select({
|
|
5829
5834
|
binding_key: r`${n}`.as("binding_key"),
|
|
5830
5835
|
step_time: r`${R}`.as("step_time"),
|
|
5831
5836
|
event_type: r`${A}`.as("event_type"),
|
|
5832
|
-
event_path:
|
|
5833
|
-
}).from(s.from).where(L).orderBy(r`${R} DESC`).limit(1),
|
|
5837
|
+
event_path: l.as("event_path")
|
|
5838
|
+
}).from(s.from).where(L).orderBy(r`${R} DESC`).limit(1), c = t.db.$with(a).as(
|
|
5834
5839
|
t.db.select({
|
|
5835
5840
|
binding_key: r`e.binding_key`.as("binding_key"),
|
|
5836
5841
|
step_time: r`e.step_time`.as("step_time"),
|
|
@@ -5838,7 +5843,7 @@ class fT {
|
|
|
5838
5843
|
event_path: r`e.event_path`.as("event_path")
|
|
5839
5844
|
}).from(r`${r.identifier(O)}`).crossJoinLateral(C.as("e"))
|
|
5840
5845
|
);
|
|
5841
|
-
i.push(
|
|
5846
|
+
i.push(c);
|
|
5842
5847
|
}
|
|
5843
5848
|
return i;
|
|
5844
5849
|
}
|
|
@@ -5854,12 +5859,12 @@ class fT {
|
|
|
5854
5859
|
r`${n} = ${r.identifier(O)}.binding_key`,
|
|
5855
5860
|
r`${R} > ${r.identifier(O)}.${r.identifier(I)}`
|
|
5856
5861
|
);
|
|
5857
|
-
const L = o.length === 1 ? o[0] : h(...o),
|
|
5862
|
+
const L = o.length === 1 ? o[0] : h(...o), l = S ? r`${r.identifier(O)}.event_path || ${"→"} || ${A}` : r`${A}`, C = t.db.select({
|
|
5858
5863
|
binding_key: r`${n}`.as("binding_key"),
|
|
5859
5864
|
step_time: r`${R}`.as("step_time"),
|
|
5860
5865
|
event_type: r`${A}`.as("event_type"),
|
|
5861
|
-
event_path:
|
|
5862
|
-
}).from(s.from).where(L).orderBy(r`${R} ASC`).limit(1),
|
|
5866
|
+
event_path: l.as("event_path")
|
|
5867
|
+
}).from(s.from).where(L).orderBy(r`${R} ASC`).limit(1), c = t.db.$with(a).as(
|
|
5863
5868
|
t.db.select({
|
|
5864
5869
|
binding_key: r`e.binding_key`.as("binding_key"),
|
|
5865
5870
|
step_time: r`e.step_time`.as("step_time"),
|
|
@@ -5867,7 +5872,7 @@ class fT {
|
|
|
5867
5872
|
event_path: r`e.event_path`.as("event_path")
|
|
5868
5873
|
}).from(r`${r.identifier(O)}`).crossJoinLateral(C.as("e"))
|
|
5869
5874
|
);
|
|
5870
|
-
i.push(
|
|
5875
|
+
i.push(c);
|
|
5871
5876
|
}
|
|
5872
5877
|
return i;
|
|
5873
5878
|
}
|
|
@@ -5885,22 +5890,22 @@ class fT {
|
|
|
5885
5890
|
s.where && o.push(s.where), o.push(
|
|
5886
5891
|
r`${R} < ${r.identifier(O)}.${r.identifier(I)}`
|
|
5887
5892
|
);
|
|
5888
|
-
const L = o.length === 1 ? o[0] : h(...o),
|
|
5893
|
+
const L = o.length === 1 ? o[0] : h(...o), l = S ? r`${A} || ${"→"} || ${r.identifier(O)}.event_path` : r`${A}`, C = t.db.select({
|
|
5889
5894
|
binding_key: r`${n}`.as("binding_key"),
|
|
5890
5895
|
step_time: r`${R}`.as("step_time"),
|
|
5891
5896
|
event_type: r`${A}`.as("event_type"),
|
|
5892
|
-
event_path:
|
|
5897
|
+
event_path: l.as("event_path"),
|
|
5893
5898
|
rn: r`ROW_NUMBER() OVER (PARTITION BY ${n} ORDER BY ${R} DESC)`.as("rn")
|
|
5894
5899
|
}).from(s.from).innerJoin(
|
|
5895
5900
|
r`${r.identifier(O)}`,
|
|
5896
5901
|
r`${n} = ${r.identifier(O)}.binding_key`
|
|
5897
|
-
).where(L),
|
|
5902
|
+
).where(L), c = t.db.select({
|
|
5898
5903
|
binding_key: r`binding_key`.as("binding_key"),
|
|
5899
5904
|
step_time: r`step_time`.as("step_time"),
|
|
5900
5905
|
event_type: r`event_type`.as("event_type"),
|
|
5901
5906
|
event_path: r`event_path`.as("event_path")
|
|
5902
5907
|
}).from(C.as("ranked")).where(r`rn = 1`);
|
|
5903
|
-
i.push(t.db.$with(a).as(
|
|
5908
|
+
i.push(t.db.$with(a).as(c));
|
|
5904
5909
|
}
|
|
5905
5910
|
return i;
|
|
5906
5911
|
}
|
|
@@ -5918,22 +5923,22 @@ class fT {
|
|
|
5918
5923
|
s.where && o.push(s.where), o.push(
|
|
5919
5924
|
r`${R} > ${r.identifier(O)}.${r.identifier(I)}`
|
|
5920
5925
|
);
|
|
5921
|
-
const L = o.length === 1 ? o[0] : h(...o),
|
|
5926
|
+
const L = o.length === 1 ? o[0] : h(...o), l = S ? r`${r.identifier(O)}.event_path || ${"→"} || ${A}` : r`${A}`, C = t.db.select({
|
|
5922
5927
|
binding_key: r`${n}`.as("binding_key"),
|
|
5923
5928
|
step_time: r`${R}`.as("step_time"),
|
|
5924
5929
|
event_type: r`${A}`.as("event_type"),
|
|
5925
|
-
event_path:
|
|
5930
|
+
event_path: l.as("event_path"),
|
|
5926
5931
|
rn: r`ROW_NUMBER() OVER (PARTITION BY ${n} ORDER BY ${R} ASC)`.as("rn")
|
|
5927
5932
|
}).from(s.from).innerJoin(
|
|
5928
5933
|
r`${r.identifier(O)}`,
|
|
5929
5934
|
r`${n} = ${r.identifier(O)}.binding_key`
|
|
5930
|
-
).where(L),
|
|
5935
|
+
).where(L), c = t.db.select({
|
|
5931
5936
|
binding_key: r`binding_key`.as("binding_key"),
|
|
5932
5937
|
step_time: r`step_time`.as("step_time"),
|
|
5933
5938
|
event_type: r`event_type`.as("event_type"),
|
|
5934
5939
|
event_path: r`event_path`.as("event_path")
|
|
5935
5940
|
}).from(C.as("ranked")).where(r`rn = 1`);
|
|
5936
|
-
i.push(t.db.$with(a).as(
|
|
5941
|
+
i.push(t.db.$with(a).as(c));
|
|
5937
5942
|
}
|
|
5938
5943
|
return i;
|
|
5939
5944
|
}
|
|
@@ -6154,28 +6159,28 @@ class ee {
|
|
|
6154
6159
|
async execute(e, E, t) {
|
|
6155
6160
|
try {
|
|
6156
6161
|
if (this.funnelQueryBuilder.hasFunnel(E)) {
|
|
6157
|
-
const
|
|
6158
|
-
if (!
|
|
6159
|
-
throw new Error(`Funnel validation failed: ${
|
|
6162
|
+
const l = this.funnelQueryBuilder.validateConfig(E.funnel, e);
|
|
6163
|
+
if (!l.isValid)
|
|
6164
|
+
throw new Error(`Funnel validation failed: ${l.errors.join(", ")}`);
|
|
6160
6165
|
} else if (this.flowQueryBuilder.hasFlow(E)) {
|
|
6161
|
-
const
|
|
6162
|
-
if (!
|
|
6163
|
-
throw new Error(`Flow validation failed: ${
|
|
6166
|
+
const l = this.flowQueryBuilder.validateConfig(E.flow, e);
|
|
6167
|
+
if (!l.isValid)
|
|
6168
|
+
throw new Error(`Flow validation failed: ${l.errors.join(", ")}`);
|
|
6164
6169
|
} else {
|
|
6165
|
-
const
|
|
6166
|
-
if (!
|
|
6167
|
-
throw new Error(`Query validation failed: ${
|
|
6170
|
+
const l = Yt(e, E);
|
|
6171
|
+
if (!l.isValid)
|
|
6172
|
+
throw new Error(`Query validation failed: ${l.errors.join(", ")}`);
|
|
6168
6173
|
}
|
|
6169
6174
|
let s;
|
|
6170
6175
|
if (this.cacheConfig?.enabled !== !1 && this.cacheConfig?.provider) {
|
|
6171
6176
|
s = NT(E, t, this.cacheConfig);
|
|
6172
6177
|
try {
|
|
6173
|
-
const
|
|
6178
|
+
const l = Date.now(), C = await this.cacheConfig.provider.get(s);
|
|
6174
6179
|
if (C)
|
|
6175
6180
|
return this.cacheConfig.onCacheEvent?.({
|
|
6176
6181
|
type: "hit",
|
|
6177
6182
|
key: s,
|
|
6178
|
-
durationMs: Date.now() -
|
|
6183
|
+
durationMs: Date.now() - l
|
|
6179
6184
|
}), {
|
|
6180
6185
|
...C.value,
|
|
6181
6186
|
cache: C.metadata ? {
|
|
@@ -6193,10 +6198,10 @@ class ee {
|
|
|
6193
6198
|
this.cacheConfig.onCacheEvent?.({
|
|
6194
6199
|
type: "miss",
|
|
6195
6200
|
key: s,
|
|
6196
|
-
durationMs: Date.now() -
|
|
6201
|
+
durationMs: Date.now() - l
|
|
6197
6202
|
});
|
|
6198
|
-
} catch (
|
|
6199
|
-
this.cacheConfig.onError?.(
|
|
6203
|
+
} catch (l) {
|
|
6204
|
+
this.cacheConfig.onError?.(l, "get");
|
|
6200
6205
|
}
|
|
6201
6206
|
}
|
|
6202
6207
|
if (this.comparisonQueryBuilder.hasComparison(E))
|
|
@@ -6214,17 +6219,17 @@ class ee {
|
|
|
6214
6219
|
this.preloadFilterCache(E, n, e, R);
|
|
6215
6220
|
const A = this.queryPlanner.createQueryPlan(e, E, R);
|
|
6216
6221
|
this.validateSecurityContext(A, R);
|
|
6217
|
-
const i = this.buildUnifiedQuery(A, E, R), S = this.queryBuilder.collectNumericFields(e, E), N = await this.dbExecutor.execute(i, S), O = Array.isArray(N) ? N.map((
|
|
6218
|
-
const C = { ...
|
|
6222
|
+
const i = this.buildUnifiedQuery(A, E, R), S = this.queryBuilder.collectNumericFields(e, E), N = await this.dbExecutor.execute(i, S), O = Array.isArray(N) ? N.map((l) => {
|
|
6223
|
+
const C = { ...l };
|
|
6219
6224
|
if (E.timeDimensions) {
|
|
6220
|
-
for (const
|
|
6221
|
-
if (
|
|
6222
|
-
let
|
|
6223
|
-
if (typeof
|
|
6224
|
-
const
|
|
6225
|
-
|
|
6225
|
+
for (const c of E.timeDimensions)
|
|
6226
|
+
if (c.dimension in C) {
|
|
6227
|
+
let M = C[c.dimension];
|
|
6228
|
+
if (typeof M == "string" && M.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)) {
|
|
6229
|
+
const P = M.replace(" ", "T"), d = !P.endsWith("Z") && !P.includes("+") ? P + "Z" : P;
|
|
6230
|
+
M = new Date(d);
|
|
6226
6231
|
}
|
|
6227
|
-
|
|
6232
|
+
M = this.databaseAdapter.convertTimeDimensionResult(M), C[c.dimension] = M;
|
|
6228
6233
|
}
|
|
6229
6234
|
}
|
|
6230
6235
|
return C;
|
|
@@ -6234,7 +6239,7 @@ class ee {
|
|
|
6234
6239
|
};
|
|
6235
6240
|
if (s && this.cacheConfig?.provider)
|
|
6236
6241
|
try {
|
|
6237
|
-
const
|
|
6242
|
+
const l = Date.now();
|
|
6238
6243
|
await this.cacheConfig.provider.set(
|
|
6239
6244
|
s,
|
|
6240
6245
|
L,
|
|
@@ -6242,10 +6247,10 @@ class ee {
|
|
|
6242
6247
|
), this.cacheConfig.onCacheEvent?.({
|
|
6243
6248
|
type: "set",
|
|
6244
6249
|
key: s,
|
|
6245
|
-
durationMs: Date.now() -
|
|
6250
|
+
durationMs: Date.now() - l
|
|
6246
6251
|
});
|
|
6247
|
-
} catch (
|
|
6248
|
-
this.cacheConfig.onError?.(
|
|
6252
|
+
} catch (l) {
|
|
6253
|
+
this.cacheConfig.onError?.(l, "set");
|
|
6249
6254
|
}
|
|
6250
6255
|
return L;
|
|
6251
6256
|
} catch (s) {
|
|
@@ -6444,14 +6449,14 @@ class ee {
|
|
|
6444
6449
|
const R = this.queryPlanner.createQueryPlan(e, E, n), A = this.buildUnifiedQuery(R, E, n), i = this.queryBuilder.collectNumericFields(e, E), S = await this.dbExecutor.execute(A, i), N = Array.isArray(S) ? S.map((o) => {
|
|
6445
6450
|
const L = { ...o };
|
|
6446
6451
|
if (E.timeDimensions) {
|
|
6447
|
-
for (const
|
|
6448
|
-
if (
|
|
6449
|
-
let C = L[
|
|
6452
|
+
for (const l of E.timeDimensions)
|
|
6453
|
+
if (l.dimension in L) {
|
|
6454
|
+
let C = L[l.dimension];
|
|
6450
6455
|
if (typeof C == "string" && C.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)) {
|
|
6451
|
-
const
|
|
6452
|
-
C = new Date(
|
|
6456
|
+
const c = C.replace(" ", "T"), M = !c.endsWith("Z") && !c.includes("+") ? c + "Z" : c;
|
|
6457
|
+
C = new Date(M);
|
|
6453
6458
|
}
|
|
6454
|
-
C = this.databaseAdapter.convertTimeDimensionResult(C), L[
|
|
6459
|
+
C = this.databaseAdapter.convertTimeDimensionResult(C), L[l.dimension] = C;
|
|
6455
6460
|
}
|
|
6456
6461
|
}
|
|
6457
6462
|
return L;
|
|
@@ -6497,31 +6502,31 @@ class ee {
|
|
|
6497
6502
|
if (e.preAggregationCTEs && e.preAggregationCTEs.length > 0) {
|
|
6498
6503
|
for (const C of e.preAggregationCTEs)
|
|
6499
6504
|
if (C.propagatingFilters && C.propagatingFilters.length > 0)
|
|
6500
|
-
for (const
|
|
6501
|
-
const
|
|
6502
|
-
if (!s.has(
|
|
6503
|
-
const
|
|
6504
|
-
filters:
|
|
6505
|
-
},
|
|
6506
|
-
|
|
6507
|
-
|
|
6505
|
+
for (const c of C.propagatingFilters) {
|
|
6506
|
+
const M = c.sourceCube.name;
|
|
6507
|
+
if (!s.has(M)) {
|
|
6508
|
+
const d = {
|
|
6509
|
+
filters: c.filters
|
|
6510
|
+
}, m = /* @__PURE__ */ new Map([[M, c.sourceCube]]), f = this.queryBuilder.buildWhereConditions(
|
|
6511
|
+
m,
|
|
6512
|
+
d,
|
|
6508
6513
|
t
|
|
6509
6514
|
);
|
|
6510
|
-
s.set(
|
|
6515
|
+
s.set(M, f);
|
|
6511
6516
|
}
|
|
6512
|
-
const
|
|
6513
|
-
|
|
6517
|
+
const P = s.get(M);
|
|
6518
|
+
P && P.length > 0 && (c.preBuiltFilterSQL = P.length === 1 ? P[0] : h(...P));
|
|
6514
6519
|
}
|
|
6515
6520
|
}
|
|
6516
6521
|
const n = [], R = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
|
|
6517
6522
|
if (e.preAggregationCTEs && e.preAggregationCTEs.length > 0)
|
|
6518
6523
|
for (const C of e.preAggregationCTEs) {
|
|
6519
|
-
const
|
|
6520
|
-
if (
|
|
6521
|
-
for (const
|
|
6522
|
-
A.set(
|
|
6524
|
+
const c = this.cteBuilder.buildPreAggregationCTE(C, E, t, e, s);
|
|
6525
|
+
if (c && (n.push(c), R.set(C.cube.name, C.cteAlias), C.downstreamJoinKeys))
|
|
6526
|
+
for (const M of C.downstreamJoinKeys)
|
|
6527
|
+
A.set(M.targetCubeName, {
|
|
6523
6528
|
cteAlias: C.cteAlias,
|
|
6524
|
-
joinKeys:
|
|
6529
|
+
joinKeys: M.joinKeys
|
|
6525
6530
|
});
|
|
6526
6531
|
}
|
|
6527
6532
|
const i = e.primaryCube.sql(t), N = { ...this.queryBuilder.buildSelections(
|
|
@@ -6532,92 +6537,92 @@ class ee {
|
|
|
6532
6537
|
) };
|
|
6533
6538
|
if (e.preAggregationCTEs)
|
|
6534
6539
|
for (const C of e.preAggregationCTEs) {
|
|
6535
|
-
const
|
|
6536
|
-
for (const
|
|
6537
|
-
if (N[
|
|
6538
|
-
const [,
|
|
6539
|
-
if (
|
|
6540
|
-
const
|
|
6541
|
-
let
|
|
6542
|
-
if (
|
|
6543
|
-
const
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6540
|
+
const c = C.cube.name;
|
|
6541
|
+
for (const M of C.measures)
|
|
6542
|
+
if (N[M]) {
|
|
6543
|
+
const [, P] = M.split("."), d = this.getCubesFromPlan(e).get(c);
|
|
6544
|
+
if (d && d.measures && d.measures[P]) {
|
|
6545
|
+
const m = d.measures[P], f = r`${r.identifier(C.cteAlias)}.${r.identifier(P)}`;
|
|
6546
|
+
let G;
|
|
6547
|
+
if (m.type === "calculated" && m.calculatedSql) {
|
|
6548
|
+
const W = this.getCubesFromPlan(e);
|
|
6549
|
+
G = this.queryBuilder.buildCTECalculatedMeasure(
|
|
6550
|
+
m,
|
|
6551
|
+
d,
|
|
6547
6552
|
C,
|
|
6548
|
-
|
|
6553
|
+
W,
|
|
6549
6554
|
t
|
|
6550
6555
|
);
|
|
6551
6556
|
} else
|
|
6552
|
-
switch (
|
|
6557
|
+
switch (m.type) {
|
|
6553
6558
|
case "count":
|
|
6554
6559
|
case "countDistinct":
|
|
6555
6560
|
case "sum":
|
|
6556
|
-
|
|
6561
|
+
G = x(f);
|
|
6557
6562
|
break;
|
|
6558
6563
|
case "avg":
|
|
6559
|
-
|
|
6564
|
+
G = this.databaseAdapter.buildAvg(f);
|
|
6560
6565
|
break;
|
|
6561
6566
|
case "min":
|
|
6562
|
-
|
|
6567
|
+
G = Ce(f);
|
|
6563
6568
|
break;
|
|
6564
6569
|
case "max":
|
|
6565
|
-
|
|
6570
|
+
G = oe(f);
|
|
6566
6571
|
break;
|
|
6567
6572
|
case "number":
|
|
6568
|
-
|
|
6573
|
+
G = x(f);
|
|
6569
6574
|
break;
|
|
6570
6575
|
default:
|
|
6571
|
-
|
|
6576
|
+
G = x(f);
|
|
6572
6577
|
}
|
|
6573
|
-
N[
|
|
6578
|
+
N[M] = r`${G}`.as(M);
|
|
6574
6579
|
}
|
|
6575
6580
|
}
|
|
6576
|
-
for (const
|
|
6577
|
-
const [
|
|
6578
|
-
if (
|
|
6579
|
-
const
|
|
6580
|
-
if (f ||
|
|
6581
|
-
let
|
|
6582
|
-
if (!
|
|
6583
|
-
const
|
|
6584
|
-
|
|
6581
|
+
for (const M in N) {
|
|
6582
|
+
const [P, d] = M.split(".");
|
|
6583
|
+
if (P === c) {
|
|
6584
|
+
const m = this.getCubesFromPlan(e).get(c), f = m && m.dimensions?.[d], G = M.startsWith(c + ".");
|
|
6585
|
+
if (f || G) {
|
|
6586
|
+
let W = C.joinKeys.find((X) => X.targetColumn === d);
|
|
6587
|
+
if (!W && m?.dimensions?.[d]) {
|
|
6588
|
+
const X = m.dimensions[d].sql;
|
|
6589
|
+
W = C.joinKeys.find((he) => he.targetColumnObj === X);
|
|
6585
6590
|
}
|
|
6586
|
-
|
|
6591
|
+
W ? N[M] = r`${r.identifier(C.cteAlias)}.${r.identifier(d)}`.as(M) : G && m?.dimensions?.[d] && (N[M] = r`${r.identifier(C.cteAlias)}.${r.identifier(d)}`.as(M));
|
|
6587
6592
|
}
|
|
6588
6593
|
}
|
|
6589
6594
|
}
|
|
6590
6595
|
}
|
|
6591
6596
|
if (E.measures) {
|
|
6592
6597
|
const C = this.getCubesFromPlan(e);
|
|
6593
|
-
for (const
|
|
6594
|
-
const [
|
|
6595
|
-
if (
|
|
6596
|
-
const
|
|
6597
|
-
if (
|
|
6598
|
-
const f =
|
|
6598
|
+
for (const c of E.measures) {
|
|
6599
|
+
const [M, P] = c.split("."), d = C.get(M);
|
|
6600
|
+
if (d?.measures?.[P]) {
|
|
6601
|
+
const m = d.measures[P];
|
|
6602
|
+
if (H.isPostAggregationWindow(m)) {
|
|
6603
|
+
const f = H.getWindowBaseMeasure(m, M);
|
|
6599
6604
|
if (f) {
|
|
6600
|
-
const [
|
|
6601
|
-
if (
|
|
6602
|
-
const he =
|
|
6603
|
-
(Oe) => Oe.cube?.name ===
|
|
6605
|
+
const [G, W] = f.split("."), X = C.get(G);
|
|
6606
|
+
if (X?.measures?.[W]) {
|
|
6607
|
+
const he = X.measures[W], LE = e.preAggregationCTEs?.find(
|
|
6608
|
+
(Oe) => Oe.cube?.name === G && Oe.measures?.includes(f)
|
|
6604
6609
|
);
|
|
6605
6610
|
let Ne;
|
|
6606
6611
|
if (LE) {
|
|
6607
|
-
const Oe = r`${r.identifier(LE.cteAlias)}.${r.identifier(
|
|
6612
|
+
const Oe = r`${r.identifier(LE.cteAlias)}.${r.identifier(W)}`;
|
|
6608
6613
|
Ne = r`sum(${Oe})`;
|
|
6609
6614
|
} else
|
|
6610
|
-
Ne = this.queryBuilder.buildMeasureExpression(he, t,
|
|
6615
|
+
Ne = this.queryBuilder.buildMeasureExpression(he, t, X);
|
|
6611
6616
|
N[f] || (N[f] = r`${Ne}`.as(f));
|
|
6612
6617
|
const lE = this.buildPostAggregationWindowExpression(
|
|
6613
|
-
|
|
6618
|
+
m,
|
|
6614
6619
|
Ne,
|
|
6615
6620
|
E,
|
|
6616
6621
|
t,
|
|
6617
|
-
|
|
6622
|
+
d,
|
|
6618
6623
|
e
|
|
6619
6624
|
);
|
|
6620
|
-
lE && (N[
|
|
6625
|
+
lE && (N[c] = r`${lE}`.as(c));
|
|
6621
6626
|
}
|
|
6622
6627
|
}
|
|
6623
6628
|
}
|
|
@@ -6644,60 +6649,60 @@ class ee {
|
|
|
6644
6649
|
}
|
|
6645
6650
|
if (e.joinCubes && e.joinCubes.length > 0)
|
|
6646
6651
|
for (const C of e.joinCubes) {
|
|
6647
|
-
const
|
|
6652
|
+
const c = R.get(C.cube.name);
|
|
6648
6653
|
if (C.junctionTable) {
|
|
6649
|
-
const
|
|
6650
|
-
if (
|
|
6651
|
-
const f =
|
|
6652
|
-
Array.isArray(f) ?
|
|
6654
|
+
const d = C.junctionTable, m = [];
|
|
6655
|
+
if (d.securitySql) {
|
|
6656
|
+
const f = d.securitySql(t.securityContext);
|
|
6657
|
+
Array.isArray(f) ? m.push(...f) : m.push(f);
|
|
6653
6658
|
}
|
|
6654
6659
|
try {
|
|
6655
|
-
switch (
|
|
6660
|
+
switch (d.joinType || "left") {
|
|
6656
6661
|
case "left":
|
|
6657
|
-
I = I.leftJoin(
|
|
6662
|
+
I = I.leftJoin(d.table, d.joinCondition);
|
|
6658
6663
|
break;
|
|
6659
6664
|
case "inner":
|
|
6660
|
-
I = I.innerJoin(
|
|
6665
|
+
I = I.innerJoin(d.table, d.joinCondition);
|
|
6661
6666
|
break;
|
|
6662
6667
|
case "right":
|
|
6663
|
-
I = I.rightJoin(
|
|
6668
|
+
I = I.rightJoin(d.table, d.joinCondition);
|
|
6664
6669
|
break;
|
|
6665
6670
|
case "full":
|
|
6666
|
-
I = I.fullJoin(
|
|
6671
|
+
I = I.fullJoin(d.table, d.joinCondition);
|
|
6667
6672
|
break;
|
|
6668
6673
|
}
|
|
6669
|
-
|
|
6674
|
+
m.length > 0 && O.push(...m);
|
|
6670
6675
|
} catch {
|
|
6671
6676
|
}
|
|
6672
6677
|
}
|
|
6673
|
-
let
|
|
6674
|
-
if (
|
|
6675
|
-
|
|
6678
|
+
let M, P;
|
|
6679
|
+
if (c)
|
|
6680
|
+
M = r`${r.identifier(c)}`, P = this.cteBuilder.buildCTEJoinCondition(C, c, e);
|
|
6676
6681
|
else {
|
|
6677
|
-
const
|
|
6678
|
-
if (
|
|
6682
|
+
const d = A.get(C.cube.name);
|
|
6683
|
+
if (M = C.cube.sql(t).from, d) {
|
|
6679
6684
|
const f = [];
|
|
6680
|
-
for (const
|
|
6681
|
-
const
|
|
6682
|
-
f.push(Q(
|
|
6685
|
+
for (const G of d.joinKeys) {
|
|
6686
|
+
const W = r`${r.identifier(d.cteAlias)}.${r.identifier(G.sourceColumn)}`, X = G.targetColumnObj || r.identifier(G.targetColumn);
|
|
6687
|
+
f.push(Q(W, X));
|
|
6683
6688
|
}
|
|
6684
|
-
|
|
6689
|
+
P = f.length === 1 ? f[0] : h(...f);
|
|
6685
6690
|
} else
|
|
6686
|
-
|
|
6691
|
+
P = C.joinCondition;
|
|
6687
6692
|
}
|
|
6688
6693
|
try {
|
|
6689
6694
|
switch (C.joinType || "left") {
|
|
6690
6695
|
case "left":
|
|
6691
|
-
I = I.leftJoin(
|
|
6696
|
+
I = I.leftJoin(M, P);
|
|
6692
6697
|
break;
|
|
6693
6698
|
case "inner":
|
|
6694
|
-
I = I.innerJoin(
|
|
6699
|
+
I = I.innerJoin(M, P);
|
|
6695
6700
|
break;
|
|
6696
6701
|
case "right":
|
|
6697
|
-
I = I.rightJoin(
|
|
6702
|
+
I = I.rightJoin(M, P);
|
|
6698
6703
|
break;
|
|
6699
6704
|
case "full":
|
|
6700
|
-
I = I.fullJoin(
|
|
6705
|
+
I = I.fullJoin(M, P);
|
|
6701
6706
|
break;
|
|
6702
6707
|
}
|
|
6703
6708
|
} catch {
|
|
@@ -6707,8 +6712,8 @@ class ee {
|
|
|
6707
6712
|
for (const C of e.joinCubes) {
|
|
6708
6713
|
if (R.get(C.cube.name))
|
|
6709
6714
|
continue;
|
|
6710
|
-
const
|
|
6711
|
-
|
|
6715
|
+
const M = C.cube.sql(t);
|
|
6716
|
+
M.where && O.push(M.where);
|
|
6712
6717
|
}
|
|
6713
6718
|
const a = this.queryBuilder.buildWhereConditions(
|
|
6714
6719
|
e.joinCubes.length > 0 ? this.getCubesFromPlan(e) : e.primaryCube,
|
|
@@ -6745,8 +6750,8 @@ class ee {
|
|
|
6745
6750
|
const C = L.length === 1 ? L[0] : h(...L);
|
|
6746
6751
|
I = I.having(C);
|
|
6747
6752
|
}
|
|
6748
|
-
const
|
|
6749
|
-
return
|
|
6753
|
+
const l = this.queryBuilder.buildOrderBy(E);
|
|
6754
|
+
return l.length > 0 && (I = I.orderBy(...l)), I = this.queryBuilder.applyLimitAndOffset(I, E), I;
|
|
6750
6755
|
}
|
|
6751
6756
|
/**
|
|
6752
6757
|
* Convert query plan to cube map for QueryBuilder methods
|
|
@@ -6903,7 +6908,7 @@ class ee {
|
|
|
6903
6908
|
const O = N.dimensions?.[S];
|
|
6904
6909
|
if (!O || ["arrayContains", "arrayOverlaps", "arrayContained"].includes(R.operator))
|
|
6905
6910
|
continue;
|
|
6906
|
-
const a =
|
|
6911
|
+
const a = B(O.sql, s), o = this.queryBuilder.buildFilterConditionPublic(
|
|
6907
6912
|
a,
|
|
6908
6913
|
R.operator,
|
|
6909
6914
|
R.values,
|
|
@@ -6922,7 +6927,7 @@ class ee {
|
|
|
6922
6927
|
if (!S) continue;
|
|
6923
6928
|
const N = S.dimensions?.[i];
|
|
6924
6929
|
if (!N) continue;
|
|
6925
|
-
const O =
|
|
6930
|
+
const O = B(N.sql, s), I = this.queryBuilder.buildDateRangeCondition(O, n.dateRange);
|
|
6926
6931
|
I && E.set(R, I);
|
|
6927
6932
|
}
|
|
6928
6933
|
}
|
|
@@ -6945,7 +6950,7 @@ class ee {
|
|
|
6945
6950
|
buildPostAggregationWindowExpression(e, E, t, s, n, R) {
|
|
6946
6951
|
const A = e.windowConfig || {}, i = (a, o) => {
|
|
6947
6952
|
if (!R?.preAggregationCTEs) return null;
|
|
6948
|
-
const L = R.preAggregationCTEs.find((
|
|
6953
|
+
const L = R.preAggregationCTEs.find((l) => l.cube?.name === a);
|
|
6949
6954
|
return L && L.cteAlias ? r`${r.identifier(L.cteAlias)}.${r.identifier(o)}` : null;
|
|
6950
6955
|
};
|
|
6951
6956
|
let S;
|
|
@@ -6954,19 +6959,19 @@ class ee {
|
|
|
6954
6959
|
const o = a.field.includes(".") ? a.field.split(".")[1] : a.field;
|
|
6955
6960
|
if (t.timeDimensions)
|
|
6956
6961
|
for (const C of t.timeDimensions) {
|
|
6957
|
-
const [
|
|
6958
|
-
if (
|
|
6959
|
-
const
|
|
6960
|
-
if (
|
|
6962
|
+
const [c, M] = C.dimension.split(".");
|
|
6963
|
+
if (M === o) {
|
|
6964
|
+
const P = i(c, o);
|
|
6965
|
+
if (P)
|
|
6961
6966
|
return {
|
|
6962
|
-
field:
|
|
6967
|
+
field: P,
|
|
6963
6968
|
direction: a.direction
|
|
6964
6969
|
};
|
|
6965
|
-
const
|
|
6966
|
-
if (
|
|
6970
|
+
const d = n.dimensions?.[M];
|
|
6971
|
+
if (d)
|
|
6967
6972
|
return {
|
|
6968
6973
|
field: this.queryBuilder.buildTimeDimensionExpression(
|
|
6969
|
-
|
|
6974
|
+
d.sql,
|
|
6970
6975
|
C.granularity,
|
|
6971
6976
|
s
|
|
6972
6977
|
),
|
|
@@ -6977,29 +6982,29 @@ class ee {
|
|
|
6977
6982
|
const L = n.dimensions?.[o];
|
|
6978
6983
|
if (L)
|
|
6979
6984
|
return {
|
|
6980
|
-
field:
|
|
6985
|
+
field: B(L.sql, s),
|
|
6981
6986
|
direction: a.direction
|
|
6982
6987
|
};
|
|
6983
|
-
const
|
|
6984
|
-
return o ===
|
|
6988
|
+
const l = A.measure?.includes(".") ? A.measure.split(".")[1] : A.measure;
|
|
6989
|
+
return o === l || a.field === A.measure ? {
|
|
6985
6990
|
field: E,
|
|
6986
6991
|
direction: a.direction
|
|
6987
6992
|
} : null;
|
|
6988
6993
|
}).filter((a) => a !== null);
|
|
6989
6994
|
else if (t.timeDimensions && t.timeDimensions.length > 0) {
|
|
6990
|
-
const a = t.timeDimensions[0], [o, L] = a.dimension.split("."),
|
|
6991
|
-
if (
|
|
6995
|
+
const a = t.timeDimensions[0], [o, L] = a.dimension.split("."), l = i(o, L);
|
|
6996
|
+
if (l)
|
|
6992
6997
|
S = [{
|
|
6993
|
-
field:
|
|
6998
|
+
field: l,
|
|
6994
6999
|
direction: "asc"
|
|
6995
7000
|
}];
|
|
6996
7001
|
else {
|
|
6997
7002
|
const C = n.name === o ? n : void 0;
|
|
6998
7003
|
if (C?.dimensions?.[L]) {
|
|
6999
|
-
const
|
|
7004
|
+
const c = C.dimensions[L];
|
|
7000
7005
|
S = [{
|
|
7001
7006
|
field: this.queryBuilder.buildTimeDimensionExpression(
|
|
7002
|
-
|
|
7007
|
+
c.sql,
|
|
7003
7008
|
a.granularity,
|
|
7004
7009
|
s
|
|
7005
7010
|
),
|
|
@@ -7011,7 +7016,7 @@ class ee {
|
|
|
7011
7016
|
let N;
|
|
7012
7017
|
A.partitionBy && A.partitionBy.length > 0 && (N = A.partitionBy.map((a) => {
|
|
7013
7018
|
const o = a.includes(".") ? a.split(".")[1] : a, L = n.dimensions?.[o];
|
|
7014
|
-
return L ?
|
|
7019
|
+
return L ? B(L.sql, s) : null;
|
|
7015
7020
|
}).filter((a) => a !== null));
|
|
7016
7021
|
const O = this.databaseAdapter.buildWindowFunction(
|
|
7017
7022
|
e.type,
|
|
@@ -7027,7 +7032,7 @@ class ee {
|
|
|
7027
7032
|
);
|
|
7028
7033
|
if (!O)
|
|
7029
7034
|
return null;
|
|
7030
|
-
switch (A.operation ||
|
|
7035
|
+
switch (A.operation || H.getDefaultWindowOperation(e.type)) {
|
|
7031
7036
|
case "difference":
|
|
7032
7037
|
return r`${E} - ${O}`;
|
|
7033
7038
|
case "ratio":
|
|
@@ -7104,23 +7109,23 @@ const _ = (T) => T.flatMap(hT), hT = (T) => Le(BT(T)).map(GT), GT = (T) => T.rep
|
|
|
7104
7109
|
E.push(t + s);
|
|
7105
7110
|
return E;
|
|
7106
7111
|
};
|
|
7107
|
-
var
|
|
7112
|
+
var D;
|
|
7108
7113
|
(function(T) {
|
|
7109
7114
|
T.QUOTED_IDENTIFIER = "QUOTED_IDENTIFIER", T.IDENTIFIER = "IDENTIFIER", T.STRING = "STRING", T.VARIABLE = "VARIABLE", T.RESERVED_DATA_TYPE = "RESERVED_DATA_TYPE", T.RESERVED_PARAMETERIZED_DATA_TYPE = "RESERVED_PARAMETERIZED_DATA_TYPE", T.RESERVED_KEYWORD = "RESERVED_KEYWORD", T.RESERVED_FUNCTION_NAME = "RESERVED_FUNCTION_NAME", T.RESERVED_KEYWORD_PHRASE = "RESERVED_KEYWORD_PHRASE", T.RESERVED_DATA_TYPE_PHRASE = "RESERVED_DATA_TYPE_PHRASE", T.RESERVED_SET_OPERATION = "RESERVED_SET_OPERATION", T.RESERVED_CLAUSE = "RESERVED_CLAUSE", T.RESERVED_SELECT = "RESERVED_SELECT", T.RESERVED_JOIN = "RESERVED_JOIN", T.ARRAY_IDENTIFIER = "ARRAY_IDENTIFIER", T.ARRAY_KEYWORD = "ARRAY_KEYWORD", T.CASE = "CASE", T.END = "END", T.WHEN = "WHEN", T.ELSE = "ELSE", T.THEN = "THEN", T.LIMIT = "LIMIT", T.BETWEEN = "BETWEEN", T.AND = "AND", T.OR = "OR", T.XOR = "XOR", T.OPERATOR = "OPERATOR", T.COMMA = "COMMA", T.ASTERISK = "ASTERISK", T.PROPERTY_ACCESS_OPERATOR = "PROPERTY_ACCESS_OPERATOR", T.OPEN_PAREN = "OPEN_PAREN", T.CLOSE_PAREN = "CLOSE_PAREN", T.LINE_COMMENT = "LINE_COMMENT", T.BLOCK_COMMENT = "BLOCK_COMMENT", T.DISABLE_COMMENT = "DISABLE_COMMENT", T.NUMBER = "NUMBER", T.NAMED_PARAMETER = "NAMED_PARAMETER", T.QUOTED_PARAMETER = "QUOTED_PARAMETER", T.NUMBERED_PARAMETER = "NUMBERED_PARAMETER", T.POSITIONAL_PARAMETER = "POSITIONAL_PARAMETER", T.CUSTOM_PARAMETER = "CUSTOM_PARAMETER", T.DELIMITER = "DELIMITER", T.EOF = "EOF";
|
|
7110
|
-
})(
|
|
7115
|
+
})(D = D || (D = {}));
|
|
7111
7116
|
const ct = (T) => ({
|
|
7112
|
-
type:
|
|
7117
|
+
type: D.EOF,
|
|
7113
7118
|
raw: "«EOF»",
|
|
7114
7119
|
text: "«EOF»",
|
|
7115
7120
|
start: T
|
|
7116
7121
|
}), Re = ct(1 / 0), Ee = (T) => (e) => e.type === T.type && e.text === T.text, q = {
|
|
7117
|
-
ARRAY: Ee({ text: "ARRAY", type:
|
|
7118
|
-
BY: Ee({ text: "BY", type:
|
|
7119
|
-
SET: Ee({ text: "SET", type:
|
|
7120
|
-
STRUCT: Ee({ text: "STRUCT", type:
|
|
7121
|
-
WINDOW: Ee({ text: "WINDOW", type:
|
|
7122
|
-
VALUES: Ee({ text: "VALUES", type:
|
|
7123
|
-
}, Pt = (T) => T ===
|
|
7122
|
+
ARRAY: Ee({ text: "ARRAY", type: D.RESERVED_DATA_TYPE }),
|
|
7123
|
+
BY: Ee({ text: "BY", type: D.RESERVED_KEYWORD }),
|
|
7124
|
+
SET: Ee({ text: "SET", type: D.RESERVED_CLAUSE }),
|
|
7125
|
+
STRUCT: Ee({ text: "STRUCT", type: D.RESERVED_DATA_TYPE }),
|
|
7126
|
+
WINDOW: Ee({ text: "WINDOW", type: D.RESERVED_CLAUSE }),
|
|
7127
|
+
VALUES: Ee({ text: "VALUES", type: D.RESERVED_CLAUSE })
|
|
7128
|
+
}, Pt = (T) => T === D.RESERVED_DATA_TYPE || T === D.RESERVED_KEYWORD || T === D.RESERVED_FUNCTION_NAME || T === D.RESERVED_KEYWORD_PHRASE || T === D.RESERVED_DATA_TYPE_PHRASE || T === D.RESERVED_CLAUSE || T === D.RESERVED_SELECT || T === D.RESERVED_SET_OPERATION || T === D.RESERVED_JOIN || T === D.ARRAY_KEYWORD || T === D.CASE || T === D.END || T === D.WHEN || T === D.ELSE || T === D.THEN || T === D.LIMIT || T === D.BETWEEN || T === D.AND || T === D.OR || T === D.XOR, yT = (T) => T === D.AND || T === D.OR || T === D.XOR, VT = [
|
|
7124
7129
|
// https://cloud.google.com/bigquery/docs/reference/standard-sql/aead_encryption_functions
|
|
7125
7130
|
"KEYS.NEW_KEYSET",
|
|
7126
7131
|
"KEYS.ADD_KEY_FROM_RAW_BYTES",
|
|
@@ -7976,7 +7981,7 @@ function jT(T) {
|
|
|
7976
7981
|
}
|
|
7977
7982
|
function kT(T) {
|
|
7978
7983
|
let e = Re;
|
|
7979
|
-
return T.map((E) => E.text === "OFFSET" && e.text === "[" ? (e = E, Object.assign(Object.assign({}, E), { type:
|
|
7984
|
+
return T.map((E) => E.text === "OFFSET" && e.text === "[" ? (e = E, Object.assign(Object.assign({}, E), { type: D.RESERVED_FUNCTION_NAME })) : (e = E, E));
|
|
7980
7985
|
}
|
|
7981
7986
|
function ZT(T) {
|
|
7982
7987
|
var e;
|
|
@@ -7986,7 +7991,7 @@ function ZT(T) {
|
|
|
7986
7991
|
if ((q.ARRAY(s) || q.STRUCT(s)) && ((e = T[t + 1]) === null || e === void 0 ? void 0 : e.text) === "<") {
|
|
7987
7992
|
const n = qT(T, t + 1), R = T.slice(t, n + 1);
|
|
7988
7993
|
E.push({
|
|
7989
|
-
type:
|
|
7994
|
+
type: D.IDENTIFIER,
|
|
7990
7995
|
raw: R.map(gE("raw")).join(""),
|
|
7991
7996
|
text: R.map(gE("text")).join(""),
|
|
7992
7997
|
start: s.start
|
|
@@ -7996,7 +8001,7 @@ function ZT(T) {
|
|
|
7996
8001
|
}
|
|
7997
8002
|
return E;
|
|
7998
8003
|
}
|
|
7999
|
-
const gE = (T) => (e) => e.type ===
|
|
8004
|
+
const gE = (T) => (e) => e.type === D.IDENTIFIER || e.type === D.COMMA ? e[T] + " " : e[T];
|
|
8000
8005
|
function qT(T, e) {
|
|
8001
8006
|
let E = 0;
|
|
8002
8007
|
for (let t = e; t < T.length; t++) {
|
|
@@ -11747,9 +11752,9 @@ function fe(T) {
|
|
|
11747
11752
|
return T.map((e, E) => {
|
|
11748
11753
|
const t = T[E + 1] || Re;
|
|
11749
11754
|
if (q.SET(e) && t.text === "(")
|
|
11750
|
-
return Object.assign(Object.assign({}, e), { type:
|
|
11755
|
+
return Object.assign(Object.assign({}, e), { type: D.RESERVED_FUNCTION_NAME });
|
|
11751
11756
|
const s = T[E - 1] || Re;
|
|
11752
|
-
return q.VALUES(e) && s.text === "=" ? Object.assign(Object.assign({}, e), { type:
|
|
11757
|
+
return q.VALUES(e) && s.text === "=" ? Object.assign(Object.assign({}, e), { type: D.RESERVED_FUNCTION_NAME }) : e;
|
|
11753
11758
|
});
|
|
11754
11759
|
}
|
|
11755
11760
|
const Vs = [
|
|
@@ -15556,7 +15561,7 @@ const Vs = [
|
|
|
15556
15561
|
};
|
|
15557
15562
|
function Yn(T) {
|
|
15558
15563
|
let e = Re;
|
|
15559
|
-
return T.map((E) => q.SET(E) && q.BY(e) ? Object.assign(Object.assign({}, E), { type:
|
|
15564
|
+
return T.map((E) => q.SET(E) && q.BY(e) ? Object.assign(Object.assign({}, E), { type: D.RESERVED_KEYWORD }) : (Pt(E.type) && (e = E), E));
|
|
15560
15565
|
}
|
|
15561
15566
|
const gn = [
|
|
15562
15567
|
// https://www.postgresql.org/docs/14/functions.html
|
|
@@ -18243,7 +18248,7 @@ const gn = [
|
|
|
18243
18248
|
function aR(T) {
|
|
18244
18249
|
return T.map((e, E) => {
|
|
18245
18250
|
const t = T[E - 1] || Re, s = T[E + 1] || Re;
|
|
18246
|
-
return q.WINDOW(e) && s.type ===
|
|
18251
|
+
return q.WINDOW(e) && s.type === D.OPEN_PAREN ? Object.assign(Object.assign({}, e), { type: D.RESERVED_FUNCTION_NAME }) : e.text === "ITEMS" && e.type === D.RESERVED_KEYWORD && !(t.text === "COLLECTION" && s.text === "TERMINATED") ? Object.assign(Object.assign({}, e), { type: D.IDENTIFIER, text: e.raw }) : e;
|
|
18247
18252
|
});
|
|
18248
18253
|
}
|
|
18249
18254
|
const oR = [
|
|
@@ -22559,20 +22564,20 @@ const oR = [
|
|
|
22559
22564
|
tidb: on,
|
|
22560
22565
|
transactsql: eA,
|
|
22561
22566
|
trino: KR
|
|
22562
|
-
}, Symbol.toStringTag, { value: "Module" })), ie = (T) => T[T.length - 1], dt = (T) => T.sort((e, E) => E.length - e.length || e.localeCompare(E)), le = (T) => T.replace(/\s+/gu, " "), TE = (T) => /\n/.test(T),
|
|
22567
|
+
}, Symbol.toStringTag, { value: "Module" })), ie = (T) => T[T.length - 1], dt = (T) => T.sort((e, E) => E.length - e.length || e.localeCompare(E)), le = (T) => T.replace(/\s+/gu, " "), TE = (T) => /\n/.test(T), v = (T) => T.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"), tt = /\s+/uy, z = (T) => new RegExp(`(?:${T})`, "uy"), cA = (T) => T.split("").map((e) => / /gu.test(e) ? "\\s+" : `[${e.toUpperCase()}${e.toLowerCase()}]`).join(""), PA = (T) => T + "(?:-" + T + ")*", dA = ({ prefixes: T, requirePrefix: e }) => `(?:${T.map(cA).join("|")}${e ? "" : "|"})`, MA = (T) => new RegExp(`(?:${T.map(v).join("|")}).*?(?=\r
|
|
22563
22568
|
|\r|
|
|
22564
22569
|
|$)`, "uy"), Tt = (T, e = []) => {
|
|
22565
22570
|
const E = T === "open" ? 0 : 1, t = ["()", ...e].map((s) => s[E]);
|
|
22566
|
-
return z(t.map(
|
|
22567
|
-
}, st = (T) => z(`${dt(T).map(
|
|
22571
|
+
return z(t.map(v).join("|"));
|
|
22572
|
+
}, st = (T) => z(`${dt(T).map(v).join("|")}`), UA = ({ rest: T, dashes: e }) => T || e ? `(?![${T || ""}${e ? "-" : ""}])` : "", J = (T, e = {}) => {
|
|
22568
22573
|
if (T.length === 0)
|
|
22569
22574
|
return /^\b$/u;
|
|
22570
|
-
const E = UA(e), t = dt(T).map(
|
|
22575
|
+
const E = UA(e), t = dt(T).map(v).join("|").replace(/ /gu, "\\s+");
|
|
22571
22576
|
return new RegExp(`(?:${t})${E}\\b`, "iuy");
|
|
22572
22577
|
}, sE = (T, e) => {
|
|
22573
22578
|
if (!T.length)
|
|
22574
22579
|
return;
|
|
22575
|
-
const E = T.map(
|
|
22580
|
+
const E = T.map(v).join("|");
|
|
22576
22581
|
return z(`(?:${E})(?:${e})`);
|
|
22577
22582
|
}, mA = () => {
|
|
22578
22583
|
const T = {
|
|
@@ -22580,7 +22585,7 @@ const oR = [
|
|
|
22580
22585
|
"[": "]",
|
|
22581
22586
|
"(": ")",
|
|
22582
22587
|
"{": "}"
|
|
22583
|
-
}, e = "{left}(?:(?!{right}').)*?{right}", E = Object.entries(T).map(([R, A]) => e.replace(/{left}/g,
|
|
22588
|
+
}, e = "{left}(?:(?!{right}').)*?{right}", E = Object.entries(T).map(([R, A]) => e.replace(/{left}/g, v(R)).replace(/{right}/g, v(A))), t = v(Object.keys(T).join(""));
|
|
22584
22589
|
return `[Qq]'(?:${String.raw`(?<tag>[^\s${t}])(?:(?!\k<tag>').)*?\k<tag>`}|${E.join("|")})'`;
|
|
22585
22590
|
}, nt = {
|
|
22586
22591
|
// - backtick quoted (using `` to escape)
|
|
@@ -22608,7 +22613,7 @@ const oR = [
|
|
|
22608
22613
|
// Oracle q'' strings: q'<text>' q'|text|' ...
|
|
22609
22614
|
"q''": mA()
|
|
22610
22615
|
}, Mt = (T) => typeof T == "string" ? nt[T] : "regex" in T ? T.regex : dA(T) + nt[T.quote], pA = (T) => z(T.map((e) => "regex" in e ? e.regex : Mt(e)).join("|")), Ut = (T) => T.map(Mt).join("|"), Rt = (T) => z(Ut(T)), fA = (T = {}) => z(mt(T)), mt = ({ first: T, rest: e, dashes: E, allowFirstCharNumber: t } = {}) => {
|
|
22611
|
-
const s = "\\p{Alphabetic}\\p{Mark}_", n = "\\p{Decimal_Number}", R =
|
|
22616
|
+
const s = "\\p{Alphabetic}\\p{Mark}_", n = "\\p{Decimal_Number}", R = v(T ?? ""), A = v(e ?? ""), i = t ? `[${s}${n}${R}][${s}${n}${A}]*` : `[${s}${R}][${s}${n}${A}]*`;
|
|
22612
22617
|
return E ? PA(i) : i;
|
|
22613
22618
|
};
|
|
22614
22619
|
function pt(T, e) {
|
|
@@ -22723,125 +22728,125 @@ class HA {
|
|
|
22723
22728
|
var E, t, s;
|
|
22724
22729
|
return this.validRules([
|
|
22725
22730
|
{
|
|
22726
|
-
type:
|
|
22731
|
+
type: D.DISABLE_COMMENT,
|
|
22727
22732
|
regex: /(\/\* *sql-formatter-disable *\*\/[\s\S]*?(?:\/\* *sql-formatter-enable *\*\/|$))/uy
|
|
22728
22733
|
},
|
|
22729
22734
|
{
|
|
22730
|
-
type:
|
|
22735
|
+
type: D.BLOCK_COMMENT,
|
|
22731
22736
|
regex: e.nestedBlockComments ? new FA() : /(\/\*[^]*?\*\/)/uy
|
|
22732
22737
|
},
|
|
22733
22738
|
{
|
|
22734
|
-
type:
|
|
22739
|
+
type: D.LINE_COMMENT,
|
|
22735
22740
|
regex: MA((E = e.lineCommentTypes) !== null && E !== void 0 ? E : ["--"])
|
|
22736
22741
|
},
|
|
22737
22742
|
{
|
|
22738
|
-
type:
|
|
22743
|
+
type: D.QUOTED_IDENTIFIER,
|
|
22739
22744
|
regex: Rt(e.identTypes)
|
|
22740
22745
|
},
|
|
22741
22746
|
{
|
|
22742
|
-
type:
|
|
22747
|
+
type: D.NUMBER,
|
|
22743
22748
|
regex: e.underscoresInNumbers ? /(?:0x[0-9a-fA-F_]+|0b[01_]+|(?:-\s*)?(?:[0-9_]*\.[0-9_]+|[0-9_]+(?:\.[0-9_]*)?)(?:[eE][-+]?[0-9_]+(?:\.[0-9_]+)?)?)(?![\w\p{Alphabetic}])/uy : /(?:0x[0-9a-fA-F]+|0b[01]+|(?:-\s*)?(?:[0-9]*\.[0-9]+|[0-9]+(?:\.[0-9]*)?)(?:[eE][-+]?[0-9]+(?:\.[0-9]+)?)?)(?![\w\p{Alphabetic}])/uy
|
|
22744
22749
|
},
|
|
22745
22750
|
// RESERVED_KEYWORD_PHRASE and RESERVED_DATA_TYPE_PHRASE is matched before all other keyword tokens
|
|
22746
22751
|
// to e.g. prioritize matching "TIMESTAMP WITH TIME ZONE" phrase over "WITH" clause.
|
|
22747
22752
|
{
|
|
22748
|
-
type:
|
|
22753
|
+
type: D.RESERVED_KEYWORD_PHRASE,
|
|
22749
22754
|
regex: J((t = e.reservedKeywordPhrases) !== null && t !== void 0 ? t : [], e.identChars),
|
|
22750
22755
|
text: Y
|
|
22751
22756
|
},
|
|
22752
22757
|
{
|
|
22753
|
-
type:
|
|
22758
|
+
type: D.RESERVED_DATA_TYPE_PHRASE,
|
|
22754
22759
|
regex: J((s = e.reservedDataTypePhrases) !== null && s !== void 0 ? s : [], e.identChars),
|
|
22755
22760
|
text: Y
|
|
22756
22761
|
},
|
|
22757
22762
|
{
|
|
22758
|
-
type:
|
|
22763
|
+
type: D.CASE,
|
|
22759
22764
|
regex: /CASE\b/iuy,
|
|
22760
22765
|
text: Y
|
|
22761
22766
|
},
|
|
22762
22767
|
{
|
|
22763
|
-
type:
|
|
22768
|
+
type: D.END,
|
|
22764
22769
|
regex: /END\b/iuy,
|
|
22765
22770
|
text: Y
|
|
22766
22771
|
},
|
|
22767
22772
|
{
|
|
22768
|
-
type:
|
|
22773
|
+
type: D.BETWEEN,
|
|
22769
22774
|
regex: /BETWEEN\b/iuy,
|
|
22770
22775
|
text: Y
|
|
22771
22776
|
},
|
|
22772
22777
|
{
|
|
22773
|
-
type:
|
|
22778
|
+
type: D.LIMIT,
|
|
22774
22779
|
regex: e.reservedClauses.includes("LIMIT") ? /LIMIT\b/iuy : void 0,
|
|
22775
22780
|
text: Y
|
|
22776
22781
|
},
|
|
22777
22782
|
{
|
|
22778
|
-
type:
|
|
22783
|
+
type: D.RESERVED_CLAUSE,
|
|
22779
22784
|
regex: J(e.reservedClauses, e.identChars),
|
|
22780
22785
|
text: Y
|
|
22781
22786
|
},
|
|
22782
22787
|
{
|
|
22783
|
-
type:
|
|
22788
|
+
type: D.RESERVED_SELECT,
|
|
22784
22789
|
regex: J(e.reservedSelect, e.identChars),
|
|
22785
22790
|
text: Y
|
|
22786
22791
|
},
|
|
22787
22792
|
{
|
|
22788
|
-
type:
|
|
22793
|
+
type: D.RESERVED_SET_OPERATION,
|
|
22789
22794
|
regex: J(e.reservedSetOperations, e.identChars),
|
|
22790
22795
|
text: Y
|
|
22791
22796
|
},
|
|
22792
22797
|
{
|
|
22793
|
-
type:
|
|
22798
|
+
type: D.WHEN,
|
|
22794
22799
|
regex: /WHEN\b/iuy,
|
|
22795
22800
|
text: Y
|
|
22796
22801
|
},
|
|
22797
22802
|
{
|
|
22798
|
-
type:
|
|
22803
|
+
type: D.ELSE,
|
|
22799
22804
|
regex: /ELSE\b/iuy,
|
|
22800
22805
|
text: Y
|
|
22801
22806
|
},
|
|
22802
22807
|
{
|
|
22803
|
-
type:
|
|
22808
|
+
type: D.THEN,
|
|
22804
22809
|
regex: /THEN\b/iuy,
|
|
22805
22810
|
text: Y
|
|
22806
22811
|
},
|
|
22807
22812
|
{
|
|
22808
|
-
type:
|
|
22813
|
+
type: D.RESERVED_JOIN,
|
|
22809
22814
|
regex: J(e.reservedJoins, e.identChars),
|
|
22810
22815
|
text: Y
|
|
22811
22816
|
},
|
|
22812
22817
|
{
|
|
22813
|
-
type:
|
|
22818
|
+
type: D.AND,
|
|
22814
22819
|
regex: /AND\b/iuy,
|
|
22815
22820
|
text: Y
|
|
22816
22821
|
},
|
|
22817
22822
|
{
|
|
22818
|
-
type:
|
|
22823
|
+
type: D.OR,
|
|
22819
22824
|
regex: /OR\b/iuy,
|
|
22820
22825
|
text: Y
|
|
22821
22826
|
},
|
|
22822
22827
|
{
|
|
22823
|
-
type:
|
|
22828
|
+
type: D.XOR,
|
|
22824
22829
|
regex: e.supportsXor ? /XOR\b/iuy : void 0,
|
|
22825
22830
|
text: Y
|
|
22826
22831
|
},
|
|
22827
22832
|
...e.operatorKeyword ? [
|
|
22828
22833
|
{
|
|
22829
|
-
type:
|
|
22834
|
+
type: D.OPERATOR,
|
|
22830
22835
|
regex: /OPERATOR *\([^)]+\)/iuy
|
|
22831
22836
|
}
|
|
22832
22837
|
] : [],
|
|
22833
22838
|
{
|
|
22834
|
-
type:
|
|
22839
|
+
type: D.RESERVED_FUNCTION_NAME,
|
|
22835
22840
|
regex: J(e.reservedFunctionNames, e.identChars),
|
|
22836
22841
|
text: Y
|
|
22837
22842
|
},
|
|
22838
22843
|
{
|
|
22839
|
-
type:
|
|
22844
|
+
type: D.RESERVED_DATA_TYPE,
|
|
22840
22845
|
regex: J(e.reservedDataTypes, e.identChars),
|
|
22841
22846
|
text: Y
|
|
22842
22847
|
},
|
|
22843
22848
|
{
|
|
22844
|
-
type:
|
|
22849
|
+
type: D.RESERVED_KEYWORD,
|
|
22845
22850
|
regex: J(e.reservedKeywords, e.identChars),
|
|
22846
22851
|
text: Y
|
|
22847
22852
|
}
|
|
@@ -22853,26 +22858,26 @@ class HA {
|
|
|
22853
22858
|
var E, t;
|
|
22854
22859
|
return this.validRules([
|
|
22855
22860
|
{
|
|
22856
|
-
type:
|
|
22861
|
+
type: D.VARIABLE,
|
|
22857
22862
|
regex: e.variableTypes ? pA(e.variableTypes) : void 0
|
|
22858
22863
|
},
|
|
22859
|
-
{ type:
|
|
22864
|
+
{ type: D.STRING, regex: Rt(e.stringTypes) },
|
|
22860
22865
|
{
|
|
22861
|
-
type:
|
|
22866
|
+
type: D.IDENTIFIER,
|
|
22862
22867
|
regex: fA(e.identChars)
|
|
22863
22868
|
},
|
|
22864
|
-
{ type:
|
|
22865
|
-
{ type:
|
|
22869
|
+
{ type: D.DELIMITER, regex: /[;]/uy },
|
|
22870
|
+
{ type: D.COMMA, regex: /[,]/y },
|
|
22866
22871
|
{
|
|
22867
|
-
type:
|
|
22872
|
+
type: D.OPEN_PAREN,
|
|
22868
22873
|
regex: Tt("open", e.extraParens)
|
|
22869
22874
|
},
|
|
22870
22875
|
{
|
|
22871
|
-
type:
|
|
22876
|
+
type: D.CLOSE_PAREN,
|
|
22872
22877
|
regex: Tt("close", e.extraParens)
|
|
22873
22878
|
},
|
|
22874
22879
|
{
|
|
22875
|
-
type:
|
|
22880
|
+
type: D.OPERATOR,
|
|
22876
22881
|
regex: st([
|
|
22877
22882
|
// standard operators
|
|
22878
22883
|
"+",
|
|
@@ -22888,9 +22893,9 @@ class HA {
|
|
|
22888
22893
|
...(E = e.operators) !== null && E !== void 0 ? E : []
|
|
22889
22894
|
])
|
|
22890
22895
|
},
|
|
22891
|
-
{ type:
|
|
22896
|
+
{ type: D.ASTERISK, regex: /[*]/uy },
|
|
22892
22897
|
{
|
|
22893
|
-
type:
|
|
22898
|
+
type: D.PROPERTY_ACCESS_OPERATOR,
|
|
22894
22899
|
regex: st([".", ...(t = e.propertyAccessOperators) !== null && t !== void 0 ? t : []])
|
|
22895
22900
|
}
|
|
22896
22901
|
]);
|
|
@@ -22908,31 +22913,31 @@ class HA {
|
|
|
22908
22913
|
};
|
|
22909
22914
|
return this.validRules([
|
|
22910
22915
|
{
|
|
22911
|
-
type:
|
|
22916
|
+
type: D.NAMED_PARAMETER,
|
|
22912
22917
|
regex: sE(i.named, mt(e.paramChars || e.identChars)),
|
|
22913
22918
|
key: (S) => S.slice(1)
|
|
22914
22919
|
},
|
|
22915
22920
|
{
|
|
22916
|
-
type:
|
|
22921
|
+
type: D.QUOTED_PARAMETER,
|
|
22917
22922
|
regex: sE(i.quoted, Ut(e.identTypes)),
|
|
22918
|
-
key: (S) => (({ tokenKey: N, quoteChar: O }) => N.replace(new RegExp(
|
|
22923
|
+
key: (S) => (({ tokenKey: N, quoteChar: O }) => N.replace(new RegExp(v("\\" + O), "gu"), O))({
|
|
22919
22924
|
tokenKey: S.slice(2, -1),
|
|
22920
22925
|
quoteChar: S.slice(-1)
|
|
22921
22926
|
})
|
|
22922
22927
|
},
|
|
22923
22928
|
{
|
|
22924
|
-
type:
|
|
22929
|
+
type: D.NUMBERED_PARAMETER,
|
|
22925
22930
|
regex: sE(i.numbered, "[0-9]+"),
|
|
22926
22931
|
key: (S) => S.slice(1)
|
|
22927
22932
|
},
|
|
22928
22933
|
{
|
|
22929
|
-
type:
|
|
22934
|
+
type: D.POSITIONAL_PARAMETER,
|
|
22930
22935
|
regex: i.positional ? /[?]/y : void 0
|
|
22931
22936
|
},
|
|
22932
22937
|
...i.custom.map((S) => {
|
|
22933
22938
|
var N;
|
|
22934
22939
|
return {
|
|
22935
|
-
type:
|
|
22940
|
+
type: D.CUSTOM_PARAMETER,
|
|
22936
22941
|
regex: z(S.regex),
|
|
22937
22942
|
key: (N = S.key) !== null && N !== void 0 ? N : ((O) => O)
|
|
22938
22943
|
};
|
|
@@ -23028,29 +23033,29 @@ function wA() {
|
|
|
23028
23033
|
var o = N[a];
|
|
23029
23034
|
if (o.isComplete) {
|
|
23030
23035
|
if (o.finish(), o.data !== R.fail) {
|
|
23031
|
-
for (var L = o.wantedBy,
|
|
23032
|
-
var C = L[
|
|
23036
|
+
for (var L = o.wantedBy, l = L.length; l--; ) {
|
|
23037
|
+
var C = L[l];
|
|
23033
23038
|
this.complete(C, o);
|
|
23034
23039
|
}
|
|
23035
23040
|
if (o.reference === this.index) {
|
|
23036
|
-
var
|
|
23037
|
-
(this.completed[
|
|
23041
|
+
var c = o.rule.name;
|
|
23042
|
+
(this.completed[c] = this.completed[c] || []).push(o);
|
|
23038
23043
|
}
|
|
23039
23044
|
}
|
|
23040
23045
|
} else {
|
|
23041
|
-
var
|
|
23042
|
-
if (typeof
|
|
23046
|
+
var c = o.rule.symbols[o.dot];
|
|
23047
|
+
if (typeof c != "string") {
|
|
23043
23048
|
this.scannable.push(o);
|
|
23044
23049
|
continue;
|
|
23045
23050
|
}
|
|
23046
|
-
if (O[
|
|
23047
|
-
if (O[
|
|
23048
|
-
for (var
|
|
23049
|
-
var
|
|
23050
|
-
this.complete(o,
|
|
23051
|
+
if (O[c]) {
|
|
23052
|
+
if (O[c].push(o), I.hasOwnProperty(c))
|
|
23053
|
+
for (var M = I[c], l = 0; l < M.length; l++) {
|
|
23054
|
+
var P = M[l];
|
|
23055
|
+
this.complete(o, P);
|
|
23051
23056
|
}
|
|
23052
23057
|
} else
|
|
23053
|
-
O[
|
|
23058
|
+
O[c] = [o], this.predict(c);
|
|
23054
23059
|
}
|
|
23055
23060
|
}
|
|
23056
23061
|
}, t.prototype.predict = function(S) {
|
|
@@ -23106,17 +23111,17 @@ function wA() {
|
|
|
23106
23111
|
var o = this.index - this.lastLineBreak, L = String(this.line).length;
|
|
23107
23112
|
return N += " at line " + this.line + " col " + o + `:
|
|
23108
23113
|
|
|
23109
|
-
`, N += I.map(function(C,
|
|
23110
|
-
return
|
|
23114
|
+
`, N += I.map(function(C, c) {
|
|
23115
|
+
return l(this.line - I.length + c + 1, L) + " " + C;
|
|
23111
23116
|
}, this).join(`
|
|
23112
23117
|
`), N += `
|
|
23113
|
-
` +
|
|
23118
|
+
` + l("", L + o) + `^
|
|
23114
23119
|
`, N;
|
|
23115
23120
|
} else
|
|
23116
23121
|
return N + " at index " + (this.index - 1);
|
|
23117
|
-
function
|
|
23118
|
-
var
|
|
23119
|
-
return Array(
|
|
23122
|
+
function l(C, c) {
|
|
23123
|
+
var M = String(C);
|
|
23124
|
+
return Array(c - M.length + 1).join(" ") + M;
|
|
23120
23125
|
}
|
|
23121
23126
|
};
|
|
23122
23127
|
function R(S, N, O) {
|
|
@@ -23151,11 +23156,11 @@ function wA() {
|
|
|
23151
23156
|
this.options.keepHistory || delete this.table[this.current - 1];
|
|
23152
23157
|
var o = this.current + 1, L = new t(this.grammar, o);
|
|
23153
23158
|
this.table.push(L);
|
|
23154
|
-
for (var
|
|
23155
|
-
var
|
|
23156
|
-
if (
|
|
23157
|
-
var
|
|
23158
|
-
L.states.push(
|
|
23159
|
+
for (var l = O.text !== void 0 ? O.text : O.value, C = N.constructor === n ? O.value : O, c = a.scannable, M = c.length; M--; ) {
|
|
23160
|
+
var P = c[M], d = P.rule.symbols[P.dot];
|
|
23161
|
+
if (d.test ? d.test(C) : d.type ? d.type === O.type : d.literal === l) {
|
|
23162
|
+
var m = P.nextState({ data: C, token: O, isToken: !0, reference: o - 1 });
|
|
23163
|
+
L.states.push(m);
|
|
23159
23164
|
}
|
|
23160
23165
|
}
|
|
23161
23166
|
if (L.process(), L.states.length === 0) {
|
|
@@ -23174,8 +23179,8 @@ function wA() {
|
|
|
23174
23179
|
}, R.prototype.reportErrorCommon = function(S, N) {
|
|
23175
23180
|
var O = [];
|
|
23176
23181
|
O.push(S);
|
|
23177
|
-
var I = this.table.length - 2, a = this.table[I], o = a.states.filter(function(
|
|
23178
|
-
var C =
|
|
23182
|
+
var I = this.table.length - 2, a = this.table[I], o = a.states.filter(function(l) {
|
|
23183
|
+
var C = l.rule.symbols[l.dot];
|
|
23179
23184
|
return C && typeof C != "string";
|
|
23180
23185
|
});
|
|
23181
23186
|
if (o.length === 0)
|
|
@@ -23184,12 +23189,12 @@ function wA() {
|
|
|
23184
23189
|
else {
|
|
23185
23190
|
O.push("Unexpected " + N + `. Instead, I was expecting to see one of the following:
|
|
23186
23191
|
`);
|
|
23187
|
-
var L = o.map(function(
|
|
23188
|
-
return this.buildFirstStateStack(
|
|
23192
|
+
var L = o.map(function(l) {
|
|
23193
|
+
return this.buildFirstStateStack(l, []) || [l];
|
|
23189
23194
|
}, this);
|
|
23190
|
-
L.forEach(function(
|
|
23191
|
-
var C =
|
|
23192
|
-
O.push("A " +
|
|
23195
|
+
L.forEach(function(l) {
|
|
23196
|
+
var C = l[0], c = C.rule.symbols[C.dot], M = this.getSymbolDisplay(c);
|
|
23197
|
+
O.push("A " + M + " based on:"), this.displayStateStack(l, O);
|
|
23193
23198
|
}, this);
|
|
23194
23199
|
}
|
|
23195
23200
|
return O.push(""), O.join(`
|
|
@@ -23274,39 +23279,39 @@ function vA(T) {
|
|
|
23274
23279
|
const xA = (T, e, E) => {
|
|
23275
23280
|
if (Pt(T.type)) {
|
|
23276
23281
|
const t = ZA(E, e);
|
|
23277
|
-
if (t && t.type ===
|
|
23278
|
-
return Object.assign(Object.assign({}, T), { type:
|
|
23282
|
+
if (t && t.type === D.PROPERTY_ACCESS_OPERATOR)
|
|
23283
|
+
return Object.assign(Object.assign({}, T), { type: D.IDENTIFIER, text: T.raw });
|
|
23279
23284
|
const s = Ae(E, e);
|
|
23280
|
-
if (s && s.type ===
|
|
23281
|
-
return Object.assign(Object.assign({}, T), { type:
|
|
23285
|
+
if (s && s.type === D.PROPERTY_ACCESS_OPERATOR)
|
|
23286
|
+
return Object.assign(Object.assign({}, T), { type: D.IDENTIFIER, text: T.raw });
|
|
23282
23287
|
}
|
|
23283
23288
|
return T;
|
|
23284
23289
|
}, JA = (T, e, E) => {
|
|
23285
|
-
if (T.type ===
|
|
23290
|
+
if (T.type === D.RESERVED_FUNCTION_NAME) {
|
|
23286
23291
|
const t = Ae(E, e);
|
|
23287
23292
|
if (!t || !ft(t))
|
|
23288
|
-
return Object.assign(Object.assign({}, T), { type:
|
|
23293
|
+
return Object.assign(Object.assign({}, T), { type: D.IDENTIFIER, text: T.raw });
|
|
23289
23294
|
}
|
|
23290
23295
|
return T;
|
|
23291
23296
|
}, QA = (T, e, E) => {
|
|
23292
|
-
if (T.type ===
|
|
23297
|
+
if (T.type === D.RESERVED_DATA_TYPE) {
|
|
23293
23298
|
const t = Ae(E, e);
|
|
23294
23299
|
if (t && ft(t))
|
|
23295
|
-
return Object.assign(Object.assign({}, T), { type:
|
|
23300
|
+
return Object.assign(Object.assign({}, T), { type: D.RESERVED_PARAMETERIZED_DATA_TYPE });
|
|
23296
23301
|
}
|
|
23297
23302
|
return T;
|
|
23298
23303
|
}, jA = (T, e, E) => {
|
|
23299
|
-
if (T.type ===
|
|
23304
|
+
if (T.type === D.IDENTIFIER) {
|
|
23300
23305
|
const t = Ae(E, e);
|
|
23301
23306
|
if (t && ht(t))
|
|
23302
|
-
return Object.assign(Object.assign({}, T), { type:
|
|
23307
|
+
return Object.assign(Object.assign({}, T), { type: D.ARRAY_IDENTIFIER });
|
|
23303
23308
|
}
|
|
23304
23309
|
return T;
|
|
23305
23310
|
}, kA = (T, e, E) => {
|
|
23306
|
-
if (T.type ===
|
|
23311
|
+
if (T.type === D.RESERVED_DATA_TYPE) {
|
|
23307
23312
|
const t = Ae(E, e);
|
|
23308
23313
|
if (t && ht(t))
|
|
23309
|
-
return Object.assign(Object.assign({}, T), { type:
|
|
23314
|
+
return Object.assign(Object.assign({}, T), { type: D.ARRAY_KEYWORD });
|
|
23310
23315
|
}
|
|
23311
23316
|
return T;
|
|
23312
23317
|
}, ZA = (T, e) => Ae(T, e, -1), Ae = (T, e, E = 1) => {
|
|
@@ -23314,7 +23319,7 @@ const xA = (T, e, E) => {
|
|
|
23314
23319
|
for (; T[e + t * E] && qA(T[e + t * E]); )
|
|
23315
23320
|
t++;
|
|
23316
23321
|
return T[e + t * E];
|
|
23317
|
-
}, ft = (T) => T.type ===
|
|
23322
|
+
}, ft = (T) => T.type === D.OPEN_PAREN && T.text === "(", ht = (T) => T.type === D.OPEN_PAREN && T.text === "[", qA = (T) => T.type === D.BLOCK_COMMENT || T.type === D.LINE_COMMENT;
|
|
23318
23323
|
class Gt {
|
|
23319
23324
|
constructor(e) {
|
|
23320
23325
|
this.tokenize = e, this.index = 0, this.tokens = [], this.input = "";
|
|
@@ -23332,7 +23337,7 @@ class Gt {
|
|
|
23332
23337
|
return `Parse error at token: ${e.text} at line ${E} column ${t}`;
|
|
23333
23338
|
}
|
|
23334
23339
|
has(e) {
|
|
23335
|
-
return e in
|
|
23340
|
+
return e in D;
|
|
23336
23341
|
}
|
|
23337
23342
|
}
|
|
23338
23343
|
var U;
|
|
@@ -23342,7 +23347,7 @@ var U;
|
|
|
23342
23347
|
function nE(T) {
|
|
23343
23348
|
return T[0];
|
|
23344
23349
|
}
|
|
23345
|
-
const
|
|
23350
|
+
const p = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
23346
23351
|
type: U.keyword,
|
|
23347
23352
|
tokenType: T.type,
|
|
23348
23353
|
text: T.text,
|
|
@@ -23362,7 +23367,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23362
23367
|
}
|
|
23363
23368
|
return T;
|
|
23364
23369
|
}, er = {
|
|
23365
|
-
Lexer:
|
|
23370
|
+
Lexer: p,
|
|
23366
23371
|
ParserRules: [
|
|
23367
23372
|
{ name: "main$ebnf$1", symbols: [] },
|
|
23368
23373
|
{ name: "main$ebnf$1", symbols: ["main$ebnf$1", "statement"], postprocess: (T) => T[0].concat([T[1]]) },
|
|
@@ -23374,15 +23379,15 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23374
23379
|
return e && !e.hasSemicolon ? e.children.length > 0 ? T : T.slice(0, -1) : T;
|
|
23375
23380
|
}
|
|
23376
23381
|
},
|
|
23377
|
-
{ name: "statement$subexpression$1", symbols: [
|
|
23378
|
-
{ name: "statement$subexpression$1", symbols: [
|
|
23382
|
+
{ name: "statement$subexpression$1", symbols: [p.has("DELIMITER") ? { type: "DELIMITER" } : DELIMITER] },
|
|
23383
|
+
{ name: "statement$subexpression$1", symbols: [p.has("EOF") ? { type: "EOF" } : EOF] },
|
|
23379
23384
|
{
|
|
23380
23385
|
name: "statement",
|
|
23381
23386
|
symbols: ["expressions_or_clauses", "statement$subexpression$1"],
|
|
23382
23387
|
postprocess: ([T, [e]]) => ({
|
|
23383
23388
|
type: U.statement,
|
|
23384
23389
|
children: T,
|
|
23385
|
-
hasSemicolon: e.type ===
|
|
23390
|
+
hasSemicolon: e.type === D.DELIMITER
|
|
23386
23391
|
})
|
|
23387
23392
|
},
|
|
23388
23393
|
{ name: "expressions_or_clauses$ebnf$1", symbols: [] },
|
|
@@ -23401,12 +23406,12 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23401
23406
|
{ name: "clause", symbols: ["clause$subexpression$1"], postprocess: j },
|
|
23402
23407
|
{ name: "limit_clause$ebnf$1$subexpression$1$ebnf$1", symbols: ["free_form_sql"] },
|
|
23403
23408
|
{ name: "limit_clause$ebnf$1$subexpression$1$ebnf$1", symbols: ["limit_clause$ebnf$1$subexpression$1$ebnf$1", "free_form_sql"], postprocess: (T) => T[0].concat([T[1]]) },
|
|
23404
|
-
{ name: "limit_clause$ebnf$1$subexpression$1", symbols: [
|
|
23409
|
+
{ name: "limit_clause$ebnf$1$subexpression$1", symbols: [p.has("COMMA") ? { type: "COMMA" } : COMMA, "limit_clause$ebnf$1$subexpression$1$ebnf$1"] },
|
|
23405
23410
|
{ name: "limit_clause$ebnf$1", symbols: ["limit_clause$ebnf$1$subexpression$1"], postprocess: nE },
|
|
23406
23411
|
{ name: "limit_clause$ebnf$1", symbols: [], postprocess: () => null },
|
|
23407
23412
|
{
|
|
23408
23413
|
name: "limit_clause",
|
|
23409
|
-
symbols: [
|
|
23414
|
+
symbols: [p.has("LIMIT") ? { type: "LIMIT" } : LIMIT, "_", "expression_chain_", "limit_clause$ebnf$1"],
|
|
23410
23415
|
postprocess: ([T, e, E, t]) => {
|
|
23411
23416
|
if (t) {
|
|
23412
23417
|
const [s, n] = t;
|
|
@@ -23432,7 +23437,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23432
23437
|
{ name: "select_clause$subexpression$1", symbols: ["asteriskless_free_form_sql", "select_clause$subexpression$1$ebnf$2"] },
|
|
23433
23438
|
{
|
|
23434
23439
|
name: "select_clause",
|
|
23435
|
-
symbols: [
|
|
23440
|
+
symbols: [p.has("RESERVED_SELECT") ? { type: "RESERVED_SELECT" } : RESERVED_SELECT, "select_clause$subexpression$1"],
|
|
23436
23441
|
postprocess: ([T, [e, E]]) => ({
|
|
23437
23442
|
type: U.clause,
|
|
23438
23443
|
nameKw: g(T),
|
|
@@ -23441,7 +23446,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23441
23446
|
},
|
|
23442
23447
|
{
|
|
23443
23448
|
name: "select_clause",
|
|
23444
|
-
symbols: [
|
|
23449
|
+
symbols: [p.has("RESERVED_SELECT") ? { type: "RESERVED_SELECT" } : RESERVED_SELECT],
|
|
23445
23450
|
postprocess: ([T]) => ({
|
|
23446
23451
|
type: U.clause,
|
|
23447
23452
|
nameKw: g(T),
|
|
@@ -23450,14 +23455,14 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23450
23455
|
},
|
|
23451
23456
|
{
|
|
23452
23457
|
name: "all_columns_asterisk",
|
|
23453
|
-
symbols: [
|
|
23458
|
+
symbols: [p.has("ASTERISK") ? { type: "ASTERISK" } : ASTERISK],
|
|
23454
23459
|
postprocess: () => ({ type: U.all_columns_asterisk })
|
|
23455
23460
|
},
|
|
23456
23461
|
{ name: "other_clause$ebnf$1", symbols: [] },
|
|
23457
23462
|
{ name: "other_clause$ebnf$1", symbols: ["other_clause$ebnf$1", "free_form_sql"], postprocess: (T) => T[0].concat([T[1]]) },
|
|
23458
23463
|
{
|
|
23459
23464
|
name: "other_clause",
|
|
23460
|
-
symbols: [
|
|
23465
|
+
symbols: [p.has("RESERVED_CLAUSE") ? { type: "RESERVED_CLAUSE" } : RESERVED_CLAUSE, "other_clause$ebnf$1"],
|
|
23461
23466
|
postprocess: ([T, e]) => ({
|
|
23462
23467
|
type: U.clause,
|
|
23463
23468
|
nameKw: g(T),
|
|
@@ -23468,7 +23473,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23468
23473
|
{ name: "set_operation$ebnf$1", symbols: ["set_operation$ebnf$1", "free_form_sql"], postprocess: (T) => T[0].concat([T[1]]) },
|
|
23469
23474
|
{
|
|
23470
23475
|
name: "set_operation",
|
|
23471
|
-
symbols: [
|
|
23476
|
+
symbols: [p.has("RESERVED_SET_OPERATION") ? { type: "RESERVED_SET_OPERATION" } : RESERVED_SET_OPERATION, "set_operation$ebnf$1"],
|
|
23472
23477
|
postprocess: ([T, e]) => ({
|
|
23473
23478
|
type: U.set_operation,
|
|
23474
23479
|
nameKw: g(T),
|
|
@@ -23541,7 +23546,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23541
23546
|
{ name: "atomic_expression", symbols: ["atomic_expression$subexpression$1"], postprocess: j },
|
|
23542
23547
|
{
|
|
23543
23548
|
name: "array_subscript",
|
|
23544
|
-
symbols: [
|
|
23549
|
+
symbols: [p.has("ARRAY_IDENTIFIER") ? { type: "ARRAY_IDENTIFIER" } : ARRAY_IDENTIFIER, "_", "square_brackets"],
|
|
23545
23550
|
postprocess: ([T, e, E]) => ({
|
|
23546
23551
|
type: U.array_subscript,
|
|
23547
23552
|
array: y({ type: U.identifier, quoted: !1, text: T.text }, { trailing: e }),
|
|
@@ -23550,7 +23555,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23550
23555
|
},
|
|
23551
23556
|
{
|
|
23552
23557
|
name: "array_subscript",
|
|
23553
|
-
symbols: [
|
|
23558
|
+
symbols: [p.has("ARRAY_KEYWORD") ? { type: "ARRAY_KEYWORD" } : ARRAY_KEYWORD, "_", "square_brackets"],
|
|
23554
23559
|
postprocess: ([T, e, E]) => ({
|
|
23555
23560
|
type: U.array_subscript,
|
|
23556
23561
|
array: y(g(T), { trailing: e }),
|
|
@@ -23559,7 +23564,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23559
23564
|
},
|
|
23560
23565
|
{
|
|
23561
23566
|
name: "function_call",
|
|
23562
|
-
symbols: [
|
|
23567
|
+
symbols: [p.has("RESERVED_FUNCTION_NAME") ? { type: "RESERVED_FUNCTION_NAME" } : RESERVED_FUNCTION_NAME, "_", "parenthesis"],
|
|
23563
23568
|
postprocess: ([T, e, E]) => ({
|
|
23564
23569
|
type: U.function_call,
|
|
23565
23570
|
nameKw: y(g(T), { trailing: e }),
|
|
@@ -23606,7 +23611,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23606
23611
|
{ name: "property_access$subexpression$1", symbols: ["parameter"] },
|
|
23607
23612
|
{
|
|
23608
23613
|
name: "property_access",
|
|
23609
|
-
symbols: ["atomic_expression", "_",
|
|
23614
|
+
symbols: ["atomic_expression", "_", p.has("PROPERTY_ACCESS_OPERATOR") ? { type: "PROPERTY_ACCESS_OPERATOR" } : PROPERTY_ACCESS_OPERATOR, "_", "property_access$subexpression$1"],
|
|
23610
23615
|
postprocess: (
|
|
23611
23616
|
// Allowing property to be <array_subscript> is currently a hack.
|
|
23612
23617
|
// A better way would be to allow <property_access> on the left side of array_subscript,
|
|
@@ -23622,7 +23627,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23622
23627
|
},
|
|
23623
23628
|
{
|
|
23624
23629
|
name: "between_predicate",
|
|
23625
|
-
symbols: [
|
|
23630
|
+
symbols: [p.has("BETWEEN") ? { type: "BETWEEN" } : BETWEEN, "_", "andless_expression_chain", "_", p.has("AND") ? { type: "AND" } : AND, "_", "andless_expression"],
|
|
23626
23631
|
postprocess: ([T, e, E, t, s, n, R]) => ({
|
|
23627
23632
|
type: U.between_predicate,
|
|
23628
23633
|
betweenKw: g(T),
|
|
@@ -23637,7 +23642,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23637
23642
|
{ name: "case_expression$ebnf$2", symbols: ["case_expression$ebnf$2", "case_clause"], postprocess: (T) => T[0].concat([T[1]]) },
|
|
23638
23643
|
{
|
|
23639
23644
|
name: "case_expression",
|
|
23640
|
-
symbols: [
|
|
23645
|
+
symbols: [p.has("CASE") ? { type: "CASE" } : CASE, "_", "case_expression$ebnf$1", "case_expression$ebnf$2", p.has("END") ? { type: "END" } : END],
|
|
23641
23646
|
postprocess: ([T, e, E, t, s]) => ({
|
|
23642
23647
|
type: U.case_expression,
|
|
23643
23648
|
caseKw: y(g(T), { trailing: e }),
|
|
@@ -23648,7 +23653,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23648
23653
|
},
|
|
23649
23654
|
{
|
|
23650
23655
|
name: "case_clause",
|
|
23651
|
-
symbols: [
|
|
23656
|
+
symbols: [p.has("WHEN") ? { type: "WHEN" } : WHEN, "_", "expression_chain_", p.has("THEN") ? { type: "THEN" } : THEN, "_", "expression_chain_"],
|
|
23652
23657
|
postprocess: ([T, e, E, t, s, n]) => ({
|
|
23653
23658
|
type: U.case_when,
|
|
23654
23659
|
whenKw: y(g(T), { trailing: e }),
|
|
@@ -23659,42 +23664,42 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23659
23664
|
},
|
|
23660
23665
|
{
|
|
23661
23666
|
name: "case_clause",
|
|
23662
|
-
symbols: [
|
|
23667
|
+
symbols: [p.has("ELSE") ? { type: "ELSE" } : ELSE, "_", "expression_chain_"],
|
|
23663
23668
|
postprocess: ([T, e, E]) => ({
|
|
23664
23669
|
type: U.case_else,
|
|
23665
23670
|
elseKw: y(g(T), { trailing: e }),
|
|
23666
23671
|
result: E
|
|
23667
23672
|
})
|
|
23668
23673
|
},
|
|
23669
|
-
{ name: "comma$subexpression$1", symbols: [
|
|
23674
|
+
{ name: "comma$subexpression$1", symbols: [p.has("COMMA") ? { type: "COMMA" } : COMMA] },
|
|
23670
23675
|
{ name: "comma", symbols: ["comma$subexpression$1"], postprocess: ([[T]]) => ({ type: U.comma }) },
|
|
23671
|
-
{ name: "asterisk$subexpression$1", symbols: [
|
|
23676
|
+
{ name: "asterisk$subexpression$1", symbols: [p.has("ASTERISK") ? { type: "ASTERISK" } : ASTERISK] },
|
|
23672
23677
|
{ name: "asterisk", symbols: ["asterisk$subexpression$1"], postprocess: ([[T]]) => ({ type: U.operator, text: T.text }) },
|
|
23673
|
-
{ name: "operator$subexpression$1", symbols: [
|
|
23678
|
+
{ name: "operator$subexpression$1", symbols: [p.has("OPERATOR") ? { type: "OPERATOR" } : OPERATOR] },
|
|
23674
23679
|
{ name: "operator", symbols: ["operator$subexpression$1"], postprocess: ([[T]]) => ({ type: U.operator, text: T.text }) },
|
|
23675
|
-
{ name: "identifier$subexpression$1", symbols: [
|
|
23676
|
-
{ name: "identifier$subexpression$1", symbols: [
|
|
23677
|
-
{ name: "identifier$subexpression$1", symbols: [
|
|
23680
|
+
{ name: "identifier$subexpression$1", symbols: [p.has("IDENTIFIER") ? { type: "IDENTIFIER" } : IDENTIFIER] },
|
|
23681
|
+
{ name: "identifier$subexpression$1", symbols: [p.has("QUOTED_IDENTIFIER") ? { type: "QUOTED_IDENTIFIER" } : QUOTED_IDENTIFIER] },
|
|
23682
|
+
{ name: "identifier$subexpression$1", symbols: [p.has("VARIABLE") ? { type: "VARIABLE" } : VARIABLE] },
|
|
23678
23683
|
{ name: "identifier", symbols: ["identifier$subexpression$1"], postprocess: ([[T]]) => ({ type: U.identifier, quoted: T.type !== "IDENTIFIER", text: T.text }) },
|
|
23679
|
-
{ name: "parameter$subexpression$1", symbols: [
|
|
23680
|
-
{ name: "parameter$subexpression$1", symbols: [
|
|
23681
|
-
{ name: "parameter$subexpression$1", symbols: [
|
|
23682
|
-
{ name: "parameter$subexpression$1", symbols: [
|
|
23683
|
-
{ name: "parameter$subexpression$1", symbols: [
|
|
23684
|
+
{ name: "parameter$subexpression$1", symbols: [p.has("NAMED_PARAMETER") ? { type: "NAMED_PARAMETER" } : NAMED_PARAMETER] },
|
|
23685
|
+
{ name: "parameter$subexpression$1", symbols: [p.has("QUOTED_PARAMETER") ? { type: "QUOTED_PARAMETER" } : QUOTED_PARAMETER] },
|
|
23686
|
+
{ name: "parameter$subexpression$1", symbols: [p.has("NUMBERED_PARAMETER") ? { type: "NUMBERED_PARAMETER" } : NUMBERED_PARAMETER] },
|
|
23687
|
+
{ name: "parameter$subexpression$1", symbols: [p.has("POSITIONAL_PARAMETER") ? { type: "POSITIONAL_PARAMETER" } : POSITIONAL_PARAMETER] },
|
|
23688
|
+
{ name: "parameter$subexpression$1", symbols: [p.has("CUSTOM_PARAMETER") ? { type: "CUSTOM_PARAMETER" } : CUSTOM_PARAMETER] },
|
|
23684
23689
|
{ name: "parameter", symbols: ["parameter$subexpression$1"], postprocess: ([[T]]) => ({ type: U.parameter, key: T.key, text: T.text }) },
|
|
23685
|
-
{ name: "literal$subexpression$1", symbols: [
|
|
23686
|
-
{ name: "literal$subexpression$1", symbols: [
|
|
23690
|
+
{ name: "literal$subexpression$1", symbols: [p.has("NUMBER") ? { type: "NUMBER" } : NUMBER] },
|
|
23691
|
+
{ name: "literal$subexpression$1", symbols: [p.has("STRING") ? { type: "STRING" } : STRING] },
|
|
23687
23692
|
{ name: "literal", symbols: ["literal$subexpression$1"], postprocess: ([[T]]) => ({ type: U.literal, text: T.text }) },
|
|
23688
|
-
{ name: "keyword$subexpression$1", symbols: [
|
|
23689
|
-
{ name: "keyword$subexpression$1", symbols: [
|
|
23690
|
-
{ name: "keyword$subexpression$1", symbols: [
|
|
23693
|
+
{ name: "keyword$subexpression$1", symbols: [p.has("RESERVED_KEYWORD") ? { type: "RESERVED_KEYWORD" } : RESERVED_KEYWORD] },
|
|
23694
|
+
{ name: "keyword$subexpression$1", symbols: [p.has("RESERVED_KEYWORD_PHRASE") ? { type: "RESERVED_KEYWORD_PHRASE" } : RESERVED_KEYWORD_PHRASE] },
|
|
23695
|
+
{ name: "keyword$subexpression$1", symbols: [p.has("RESERVED_JOIN") ? { type: "RESERVED_JOIN" } : RESERVED_JOIN] },
|
|
23691
23696
|
{
|
|
23692
23697
|
name: "keyword",
|
|
23693
23698
|
symbols: ["keyword$subexpression$1"],
|
|
23694
23699
|
postprocess: ([[T]]) => g(T)
|
|
23695
23700
|
},
|
|
23696
|
-
{ name: "data_type$subexpression$1", symbols: [
|
|
23697
|
-
{ name: "data_type$subexpression$1", symbols: [
|
|
23701
|
+
{ name: "data_type$subexpression$1", symbols: [p.has("RESERVED_DATA_TYPE") ? { type: "RESERVED_DATA_TYPE" } : RESERVED_DATA_TYPE] },
|
|
23702
|
+
{ name: "data_type$subexpression$1", symbols: [p.has("RESERVED_DATA_TYPE_PHRASE") ? { type: "RESERVED_DATA_TYPE_PHRASE" } : RESERVED_DATA_TYPE_PHRASE] },
|
|
23698
23703
|
{
|
|
23699
23704
|
name: "data_type",
|
|
23700
23705
|
symbols: ["data_type$subexpression$1"],
|
|
@@ -23702,25 +23707,25 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23702
23707
|
},
|
|
23703
23708
|
{
|
|
23704
23709
|
name: "data_type",
|
|
23705
|
-
symbols: [
|
|
23710
|
+
symbols: [p.has("RESERVED_PARAMETERIZED_DATA_TYPE") ? { type: "RESERVED_PARAMETERIZED_DATA_TYPE" } : RESERVED_PARAMETERIZED_DATA_TYPE, "_", "parenthesis"],
|
|
23706
23711
|
postprocess: ([T, e, E]) => ({
|
|
23707
23712
|
type: U.parameterized_data_type,
|
|
23708
23713
|
dataType: y(St(T), { trailing: e }),
|
|
23709
23714
|
parenthesis: E
|
|
23710
23715
|
})
|
|
23711
23716
|
},
|
|
23712
|
-
{ name: "logic_operator$subexpression$1", symbols: [
|
|
23713
|
-
{ name: "logic_operator$subexpression$1", symbols: [
|
|
23714
|
-
{ name: "logic_operator$subexpression$1", symbols: [
|
|
23717
|
+
{ name: "logic_operator$subexpression$1", symbols: [p.has("AND") ? { type: "AND" } : AND] },
|
|
23718
|
+
{ name: "logic_operator$subexpression$1", symbols: [p.has("OR") ? { type: "OR" } : OR] },
|
|
23719
|
+
{ name: "logic_operator$subexpression$1", symbols: [p.has("XOR") ? { type: "XOR" } : XOR] },
|
|
23715
23720
|
{
|
|
23716
23721
|
name: "logic_operator",
|
|
23717
23722
|
symbols: ["logic_operator$subexpression$1"],
|
|
23718
23723
|
postprocess: ([[T]]) => g(T)
|
|
23719
23724
|
},
|
|
23720
|
-
{ name: "other_keyword$subexpression$1", symbols: [
|
|
23721
|
-
{ name: "other_keyword$subexpression$1", symbols: [
|
|
23722
|
-
{ name: "other_keyword$subexpression$1", symbols: [
|
|
23723
|
-
{ name: "other_keyword$subexpression$1", symbols: [
|
|
23725
|
+
{ name: "other_keyword$subexpression$1", symbols: [p.has("WHEN") ? { type: "WHEN" } : WHEN] },
|
|
23726
|
+
{ name: "other_keyword$subexpression$1", symbols: [p.has("THEN") ? { type: "THEN" } : THEN] },
|
|
23727
|
+
{ name: "other_keyword$subexpression$1", symbols: [p.has("ELSE") ? { type: "ELSE" } : ELSE] },
|
|
23728
|
+
{ name: "other_keyword$subexpression$1", symbols: [p.has("END") ? { type: "END" } : END] },
|
|
23724
23729
|
{
|
|
23725
23730
|
name: "other_keyword",
|
|
23726
23731
|
symbols: ["other_keyword$subexpression$1"],
|
|
@@ -23731,7 +23736,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23731
23736
|
{ name: "_", symbols: ["_$ebnf$1"], postprocess: ([T]) => T },
|
|
23732
23737
|
{
|
|
23733
23738
|
name: "comment",
|
|
23734
|
-
symbols: [
|
|
23739
|
+
symbols: [p.has("LINE_COMMENT") ? { type: "LINE_COMMENT" } : LINE_COMMENT],
|
|
23735
23740
|
postprocess: ([T]) => ({
|
|
23736
23741
|
type: U.line_comment,
|
|
23737
23742
|
text: T.text,
|
|
@@ -23740,7 +23745,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23740
23745
|
},
|
|
23741
23746
|
{
|
|
23742
23747
|
name: "comment",
|
|
23743
|
-
symbols: [
|
|
23748
|
+
symbols: [p.has("BLOCK_COMMENT") ? { type: "BLOCK_COMMENT" } : BLOCK_COMMENT],
|
|
23744
23749
|
postprocess: ([T]) => ({
|
|
23745
23750
|
type: U.block_comment,
|
|
23746
23751
|
text: T.text,
|
|
@@ -23749,7 +23754,7 @@ const m = new Gt((T) => []), j = ([[T]]) => T, g = (T) => ({
|
|
|
23749
23754
|
},
|
|
23750
23755
|
{
|
|
23751
23756
|
name: "comment",
|
|
23752
|
-
symbols: [
|
|
23757
|
+
symbols: [p.has("DISABLE_COMMENT") ? { type: "DISABLE_COMMENT" } : DISABLE_COMMENT],
|
|
23753
23758
|
postprocess: ([T]) => ({
|
|
23754
23759
|
type: U.disable_comment,
|
|
23755
23760
|
text: T.text,
|
|
@@ -23776,10 +23781,10 @@ ${JSON.stringify(R, void 0, 2)}`);
|
|
|
23776
23781
|
}
|
|
23777
23782
|
};
|
|
23778
23783
|
}
|
|
23779
|
-
var
|
|
23784
|
+
var u;
|
|
23780
23785
|
(function(T) {
|
|
23781
23786
|
T[T.SPACE = 0] = "SPACE", T[T.NO_SPACE = 1] = "NO_SPACE", T[T.NO_NEWLINE = 2] = "NO_NEWLINE", T[T.NEWLINE = 3] = "NEWLINE", T[T.MANDATORY_NEWLINE = 4] = "MANDATORY_NEWLINE", T[T.INDENT = 5] = "INDENT", T[T.SINGLE_INDENT = 6] = "SINGLE_INDENT";
|
|
23782
|
-
})(
|
|
23787
|
+
})(u = u || (u = {}));
|
|
23783
23788
|
class Bt {
|
|
23784
23789
|
constructor(e) {
|
|
23785
23790
|
this.indentation = e, this.items = [];
|
|
@@ -23790,26 +23795,26 @@ class Bt {
|
|
|
23790
23795
|
add(...e) {
|
|
23791
23796
|
for (const E of e)
|
|
23792
23797
|
switch (E) {
|
|
23793
|
-
case
|
|
23794
|
-
this.items.push(
|
|
23798
|
+
case u.SPACE:
|
|
23799
|
+
this.items.push(u.SPACE);
|
|
23795
23800
|
break;
|
|
23796
|
-
case
|
|
23801
|
+
case u.NO_SPACE:
|
|
23797
23802
|
this.trimHorizontalWhitespace();
|
|
23798
23803
|
break;
|
|
23799
|
-
case
|
|
23804
|
+
case u.NO_NEWLINE:
|
|
23800
23805
|
this.trimWhitespace();
|
|
23801
23806
|
break;
|
|
23802
|
-
case
|
|
23803
|
-
this.trimHorizontalWhitespace(), this.addNewline(
|
|
23807
|
+
case u.NEWLINE:
|
|
23808
|
+
this.trimHorizontalWhitespace(), this.addNewline(u.NEWLINE);
|
|
23804
23809
|
break;
|
|
23805
|
-
case
|
|
23806
|
-
this.trimHorizontalWhitespace(), this.addNewline(
|
|
23810
|
+
case u.MANDATORY_NEWLINE:
|
|
23811
|
+
this.trimHorizontalWhitespace(), this.addNewline(u.MANDATORY_NEWLINE);
|
|
23807
23812
|
break;
|
|
23808
|
-
case
|
|
23813
|
+
case u.INDENT:
|
|
23809
23814
|
this.addIndentation();
|
|
23810
23815
|
break;
|
|
23811
|
-
case
|
|
23812
|
-
this.items.push(
|
|
23816
|
+
case u.SINGLE_INDENT:
|
|
23817
|
+
this.items.push(u.SINGLE_INDENT);
|
|
23813
23818
|
break;
|
|
23814
23819
|
default:
|
|
23815
23820
|
this.items.push(E);
|
|
@@ -23826,10 +23831,10 @@ class Bt {
|
|
|
23826
23831
|
addNewline(e) {
|
|
23827
23832
|
if (this.items.length > 0)
|
|
23828
23833
|
switch (ie(this.items)) {
|
|
23829
|
-
case
|
|
23834
|
+
case u.NEWLINE:
|
|
23830
23835
|
this.items.pop(), this.items.push(e);
|
|
23831
23836
|
break;
|
|
23832
|
-
case
|
|
23837
|
+
case u.MANDATORY_NEWLINE:
|
|
23833
23838
|
break;
|
|
23834
23839
|
default:
|
|
23835
23840
|
this.items.push(e);
|
|
@@ -23838,7 +23843,7 @@ class Bt {
|
|
|
23838
23843
|
}
|
|
23839
23844
|
addIndentation() {
|
|
23840
23845
|
for (let e = 0; e < this.indentation.getLevel(); e++)
|
|
23841
|
-
this.items.push(
|
|
23846
|
+
this.items.push(u.SINGLE_INDENT);
|
|
23842
23847
|
}
|
|
23843
23848
|
/**
|
|
23844
23849
|
* Returns the final SQL string.
|
|
@@ -23854,20 +23859,20 @@ class Bt {
|
|
|
23854
23859
|
}
|
|
23855
23860
|
itemToString(e) {
|
|
23856
23861
|
switch (e) {
|
|
23857
|
-
case
|
|
23862
|
+
case u.SPACE:
|
|
23858
23863
|
return " ";
|
|
23859
|
-
case
|
|
23860
|
-
case
|
|
23864
|
+
case u.NEWLINE:
|
|
23865
|
+
case u.MANDATORY_NEWLINE:
|
|
23861
23866
|
return `
|
|
23862
23867
|
`;
|
|
23863
|
-
case
|
|
23868
|
+
case u.SINGLE_INDENT:
|
|
23864
23869
|
return this.indentation.getSingleIndent();
|
|
23865
23870
|
default:
|
|
23866
23871
|
return e;
|
|
23867
23872
|
}
|
|
23868
23873
|
}
|
|
23869
23874
|
}
|
|
23870
|
-
const sr = (T) => T ===
|
|
23875
|
+
const sr = (T) => T === u.SPACE || T === u.SINGLE_INDENT, nr = (T) => T === u.SPACE || T === u.SINGLE_INDENT || T === u.NEWLINE;
|
|
23871
23876
|
function Nt(T, e) {
|
|
23872
23877
|
if (e === "standard")
|
|
23873
23878
|
return T;
|
|
@@ -23875,7 +23880,7 @@ function Nt(T, e) {
|
|
|
23875
23880
|
return T.length >= 10 && T.includes(" ") && ([T, ...E] = T.split(" ")), e === "tabularLeft" ? T = T.padEnd(9, " ") : T = T.padStart(9, " "), T + ["", ...E].join(" ");
|
|
23876
23881
|
}
|
|
23877
23882
|
function Ot(T) {
|
|
23878
|
-
return yT(T) || T ===
|
|
23883
|
+
return yT(T) || T === D.RESERVED_CLAUSE || T === D.RESERVED_SELECT || T === D.RESERVED_SET_OPERATION || T === D.RESERVED_JOIN || T === D.LIMIT;
|
|
23879
23884
|
}
|
|
23880
23885
|
const RE = "top-level", Rr = "block-level";
|
|
23881
23886
|
class Ft {
|
|
@@ -23939,9 +23944,9 @@ class Ar extends Bt {
|
|
|
23939
23944
|
if (typeof e == "string")
|
|
23940
23945
|
this.length += e.length, this.trailingSpace = !1;
|
|
23941
23946
|
else {
|
|
23942
|
-
if (e ===
|
|
23947
|
+
if (e === u.MANDATORY_NEWLINE || e === u.NEWLINE)
|
|
23943
23948
|
throw new OE();
|
|
23944
|
-
e ===
|
|
23949
|
+
e === u.INDENT || e === u.SINGLE_INDENT || e === u.SPACE ? this.trailingSpace || (this.length++, this.trailingSpace = !0) : (e === u.NO_NEWLINE || e === u.NO_SPACE) && this.trailingSpace && (this.trailingSpace = !1, this.length--);
|
|
23945
23950
|
}
|
|
23946
23951
|
}
|
|
23947
23952
|
}
|
|
@@ -24037,23 +24042,23 @@ class me {
|
|
|
24037
24042
|
}), this.formatNode(e.parenthesis);
|
|
24038
24043
|
}
|
|
24039
24044
|
formatPropertyAccess(e) {
|
|
24040
|
-
this.formatNode(e.object), this.layout.add(
|
|
24045
|
+
this.formatNode(e.object), this.layout.add(u.NO_SPACE, e.operator), this.formatNode(e.property);
|
|
24041
24046
|
}
|
|
24042
24047
|
formatParenthesis(e) {
|
|
24043
24048
|
const E = this.formatInlineExpression(e.children);
|
|
24044
|
-
E ? (this.layout.add(e.openParen), this.layout.add(...E.getLayoutItems()), this.layout.add(
|
|
24049
|
+
E ? (this.layout.add(e.openParen), this.layout.add(...E.getLayoutItems()), this.layout.add(u.NO_SPACE, e.closeParen, u.SPACE)) : (this.layout.add(e.openParen, u.NEWLINE), te(this.cfg) ? (this.layout.add(u.INDENT), this.layout = this.formatSubExpression(e.children)) : (this.layout.indentation.increaseBlockLevel(), this.layout.add(u.INDENT), this.layout = this.formatSubExpression(e.children), this.layout.indentation.decreaseBlockLevel()), this.layout.add(u.NEWLINE, u.INDENT, e.closeParen, u.SPACE));
|
|
24045
24050
|
}
|
|
24046
24051
|
formatBetweenPredicate(e) {
|
|
24047
|
-
this.layout.add(this.showKw(e.betweenKw),
|
|
24052
|
+
this.layout.add(this.showKw(e.betweenKw), u.SPACE), this.layout = this.formatSubExpression(e.expr1), this.layout.add(u.NO_SPACE, u.SPACE, this.showNonTabularKw(e.andKw), u.SPACE), this.layout = this.formatSubExpression(e.expr2), this.layout.add(u.SPACE);
|
|
24048
24053
|
}
|
|
24049
24054
|
formatCaseExpression(e) {
|
|
24050
|
-
this.formatNode(e.caseKw), this.layout.indentation.increaseBlockLevel(), this.layout = this.formatSubExpression(e.expr), this.layout = this.formatSubExpression(e.clauses), this.layout.indentation.decreaseBlockLevel(), this.layout.add(
|
|
24055
|
+
this.formatNode(e.caseKw), this.layout.indentation.increaseBlockLevel(), this.layout = this.formatSubExpression(e.expr), this.layout = this.formatSubExpression(e.clauses), this.layout.indentation.decreaseBlockLevel(), this.layout.add(u.NEWLINE, u.INDENT), this.formatNode(e.endKw);
|
|
24051
24056
|
}
|
|
24052
24057
|
formatCaseWhen(e) {
|
|
24053
|
-
this.layout.add(
|
|
24058
|
+
this.layout.add(u.NEWLINE, u.INDENT), this.formatNode(e.whenKw), this.layout = this.formatSubExpression(e.condition), this.formatNode(e.thenKw), this.layout = this.formatSubExpression(e.result);
|
|
24054
24059
|
}
|
|
24055
24060
|
formatCaseElse(e) {
|
|
24056
|
-
this.layout.add(
|
|
24061
|
+
this.layout.add(u.NEWLINE, u.INDENT), this.formatNode(e.elseKw), this.layout = this.formatSubExpression(e.result);
|
|
24057
24062
|
}
|
|
24058
24063
|
formatClause(e) {
|
|
24059
24064
|
this.isOnelineClause(e) ? this.formatClauseInOnelineStyle(e) : te(this.cfg) ? this.formatClauseInTabularStyle(e) : this.formatClauseInIndentedStyle(e);
|
|
@@ -24062,39 +24067,39 @@ class me {
|
|
|
24062
24067
|
return te(this.cfg) ? this.dialectCfg.tabularOnelineClauses[e.nameKw.text] : this.dialectCfg.onelineClauses[e.nameKw.text];
|
|
24063
24068
|
}
|
|
24064
24069
|
formatClauseInIndentedStyle(e) {
|
|
24065
|
-
this.layout.add(
|
|
24070
|
+
this.layout.add(u.NEWLINE, u.INDENT, this.showKw(e.nameKw), u.NEWLINE), this.layout.indentation.increaseTopLevel(), this.layout.add(u.INDENT), this.layout = this.formatSubExpression(e.children), this.layout.indentation.decreaseTopLevel();
|
|
24066
24071
|
}
|
|
24067
24072
|
formatClauseInOnelineStyle(e) {
|
|
24068
|
-
this.layout.add(
|
|
24073
|
+
this.layout.add(u.NEWLINE, u.INDENT, this.showKw(e.nameKw), u.SPACE), this.layout = this.formatSubExpression(e.children);
|
|
24069
24074
|
}
|
|
24070
24075
|
formatClauseInTabularStyle(e) {
|
|
24071
|
-
this.layout.add(
|
|
24076
|
+
this.layout.add(u.NEWLINE, u.INDENT, this.showKw(e.nameKw), u.SPACE), this.layout.indentation.increaseTopLevel(), this.layout = this.formatSubExpression(e.children), this.layout.indentation.decreaseTopLevel();
|
|
24072
24077
|
}
|
|
24073
24078
|
formatSetOperation(e) {
|
|
24074
|
-
this.layout.add(
|
|
24079
|
+
this.layout.add(u.NEWLINE, u.INDENT, this.showKw(e.nameKw), u.NEWLINE), this.layout.add(u.INDENT), this.layout = this.formatSubExpression(e.children);
|
|
24075
24080
|
}
|
|
24076
24081
|
formatLimitClause(e) {
|
|
24077
24082
|
this.withComments(e.limitKw, () => {
|
|
24078
|
-
this.layout.add(
|
|
24079
|
-
}), this.layout.indentation.increaseTopLevel(), te(this.cfg) ? this.layout.add(
|
|
24083
|
+
this.layout.add(u.NEWLINE, u.INDENT, this.showKw(e.limitKw));
|
|
24084
|
+
}), this.layout.indentation.increaseTopLevel(), te(this.cfg) ? this.layout.add(u.SPACE) : this.layout.add(u.NEWLINE, u.INDENT), e.offset ? (this.layout = this.formatSubExpression(e.offset), this.layout.add(u.NO_SPACE, ",", u.SPACE), this.layout = this.formatSubExpression(e.count)) : this.layout = this.formatSubExpression(e.count), this.layout.indentation.decreaseTopLevel();
|
|
24080
24085
|
}
|
|
24081
24086
|
formatAllColumnsAsterisk(e) {
|
|
24082
|
-
this.layout.add("*",
|
|
24087
|
+
this.layout.add("*", u.SPACE);
|
|
24083
24088
|
}
|
|
24084
24089
|
formatLiteral(e) {
|
|
24085
|
-
this.layout.add(e.text,
|
|
24090
|
+
this.layout.add(e.text, u.SPACE);
|
|
24086
24091
|
}
|
|
24087
24092
|
formatIdentifier(e) {
|
|
24088
|
-
this.layout.add(this.showIdentifier(e),
|
|
24093
|
+
this.layout.add(this.showIdentifier(e), u.SPACE);
|
|
24089
24094
|
}
|
|
24090
24095
|
formatParameter(e) {
|
|
24091
|
-
this.layout.add(this.params.get(e),
|
|
24096
|
+
this.layout.add(this.params.get(e), u.SPACE);
|
|
24092
24097
|
}
|
|
24093
24098
|
formatOperator({ text: e }) {
|
|
24094
|
-
this.cfg.denseOperators || this.dialectCfg.alwaysDenseOperators.includes(e) ? this.layout.add(
|
|
24099
|
+
this.cfg.denseOperators || this.dialectCfg.alwaysDenseOperators.includes(e) ? this.layout.add(u.NO_SPACE, e) : e === ":" ? this.layout.add(u.NO_SPACE, e, u.SPACE) : this.layout.add(e, u.SPACE);
|
|
24095
24100
|
}
|
|
24096
24101
|
formatComma(e) {
|
|
24097
|
-
this.inline ? this.layout.add(
|
|
24102
|
+
this.inline ? this.layout.add(u.NO_SPACE, ",", u.SPACE) : this.layout.add(u.NO_SPACE, ",", u.NEWLINE, u.INDENT);
|
|
24098
24103
|
}
|
|
24099
24104
|
withComments(e, E) {
|
|
24100
24105
|
this.formatComments(e.leadingComments), E(), this.formatComments(e.trailingComments);
|
|
@@ -24105,12 +24110,12 @@ class me {
|
|
|
24105
24110
|
});
|
|
24106
24111
|
}
|
|
24107
24112
|
formatLineComment(e) {
|
|
24108
|
-
TE(e.precedingWhitespace || "") ? this.layout.add(
|
|
24113
|
+
TE(e.precedingWhitespace || "") ? this.layout.add(u.NEWLINE, u.INDENT, e.text, u.MANDATORY_NEWLINE, u.INDENT) : this.layout.getLayoutItems().length > 0 ? this.layout.add(u.NO_NEWLINE, u.SPACE, e.text, u.MANDATORY_NEWLINE, u.INDENT) : this.layout.add(e.text, u.MANDATORY_NEWLINE, u.INDENT);
|
|
24109
24114
|
}
|
|
24110
24115
|
formatBlockComment(e) {
|
|
24111
24116
|
e.type === U.block_comment && this.isMultilineBlockComment(e) ? (this.splitBlockComment(e.text).forEach((E) => {
|
|
24112
|
-
this.layout.add(
|
|
24113
|
-
}), this.layout.add(
|
|
24117
|
+
this.layout.add(u.NEWLINE, u.INDENT, E);
|
|
24118
|
+
}), this.layout.add(u.NEWLINE, u.INDENT)) : this.layout.add(e.text, u.SPACE);
|
|
24114
24119
|
}
|
|
24115
24120
|
isMultilineBlockComment(e) {
|
|
24116
24121
|
return TE(e.text) || TE(e.precedingWhitespace || "");
|
|
@@ -24183,27 +24188,27 @@ class me {
|
|
|
24183
24188
|
}
|
|
24184
24189
|
formatKeywordNode(e) {
|
|
24185
24190
|
switch (e.tokenType) {
|
|
24186
|
-
case
|
|
24191
|
+
case D.RESERVED_JOIN:
|
|
24187
24192
|
return this.formatJoin(e);
|
|
24188
|
-
case
|
|
24189
|
-
case
|
|
24190
|
-
case
|
|
24193
|
+
case D.AND:
|
|
24194
|
+
case D.OR:
|
|
24195
|
+
case D.XOR:
|
|
24191
24196
|
return this.formatLogicalOperator(e);
|
|
24192
24197
|
default:
|
|
24193
24198
|
return this.formatKeyword(e);
|
|
24194
24199
|
}
|
|
24195
24200
|
}
|
|
24196
24201
|
formatJoin(e) {
|
|
24197
|
-
te(this.cfg) ? (this.layout.indentation.decreaseTopLevel(), this.layout.add(
|
|
24202
|
+
te(this.cfg) ? (this.layout.indentation.decreaseTopLevel(), this.layout.add(u.NEWLINE, u.INDENT, this.showKw(e), u.SPACE), this.layout.indentation.increaseTopLevel()) : this.layout.add(u.NEWLINE, u.INDENT, this.showKw(e), u.SPACE);
|
|
24198
24203
|
}
|
|
24199
24204
|
formatKeyword(e) {
|
|
24200
|
-
this.layout.add(this.showKw(e),
|
|
24205
|
+
this.layout.add(this.showKw(e), u.SPACE);
|
|
24201
24206
|
}
|
|
24202
24207
|
formatLogicalOperator(e) {
|
|
24203
|
-
this.cfg.logicalOperatorNewline === "before" ? te(this.cfg) ? (this.layout.indentation.decreaseTopLevel(), this.layout.add(
|
|
24208
|
+
this.cfg.logicalOperatorNewline === "before" ? te(this.cfg) ? (this.layout.indentation.decreaseTopLevel(), this.layout.add(u.NEWLINE, u.INDENT, this.showKw(e), u.SPACE), this.layout.indentation.increaseTopLevel()) : this.layout.add(u.NEWLINE, u.INDENT, this.showKw(e), u.SPACE) : this.layout.add(this.showKw(e), u.NEWLINE, u.INDENT);
|
|
24204
24209
|
}
|
|
24205
24210
|
formatDataType(e) {
|
|
24206
|
-
this.layout.add(this.showDataType(e),
|
|
24211
|
+
this.layout.add(this.showDataType(e), u.SPACE);
|
|
24207
24212
|
}
|
|
24208
24213
|
showKw(e) {
|
|
24209
24214
|
return Ot(e.tokenType) ? Nt(this.showNonTabularKw(e), this.cfg.indentStyle) : this.showNonTabularKw(e);
|
|
@@ -24283,7 +24288,7 @@ class rr {
|
|
|
24283
24288
|
params: this.params,
|
|
24284
24289
|
layout: new Bt(new Ft(yA(this.cfg)))
|
|
24285
24290
|
}).format(e.children);
|
|
24286
|
-
return e.hasSemicolon && (this.cfg.newlineBeforeSemicolon ? E.add(
|
|
24291
|
+
return e.hasSemicolon && (this.cfg.newlineBeforeSemicolon ? E.add(u.NEWLINE, ";") : E.add(u.NO_NEWLINE, ";")), E.toString();
|
|
24287
24292
|
}
|
|
24288
24293
|
}
|
|
24289
24294
|
class De extends Error {
|