drizzle-cube 0.1.17 → 0.1.19
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-Dec55JjO.js → compiler-CPsEzFP2.js} +702 -703
- package/dist/adapters/express/index.d.ts +7 -7
- package/dist/adapters/express/index.js +1 -1
- package/dist/adapters/fastify/index.d.ts +6 -6
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/hono/index.d.ts +7 -7
- package/dist/adapters/hono/index.js +1 -1
- package/dist/adapters/nextjs/index.d.ts +9 -9
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/adapters/utils.d.ts +3 -3
- package/dist/client/styles.css +1 -1
- package/dist/server/index.d.ts +177 -246
- package/dist/server/index.js +613 -621
- package/package.json +2 -2
package/dist/server/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var XT = Object.defineProperty;
|
|
2
2
|
var bT = (T, E, R) => E in T ? XT(T, E, { enumerable: !0, configurable: !0, writable: !0, value: R }) : T[E] = R;
|
|
3
3
|
var f = (T, E, R) => bT(T, typeof E != "symbol" ? E + "" : E, R);
|
|
4
|
-
import { sql as
|
|
4
|
+
import { sql as r, count as SE, sum as y, max as uE, min as FE, and as d, countDistinct as KT, SQL as yT, or as $T, gt as fE, lt as WE, gte as Q, lte as Z, isNull as gT, isNotNull as JT, notInArray as xT, ne as wT, inArray as XE, eq as mE, desc as vT, asc as bE } from "drizzle-orm";
|
|
5
5
|
class pE {
|
|
6
6
|
/**
|
|
7
7
|
* Helper method to build pattern for string matching
|
|
@@ -32,21 +32,21 @@ class QT extends pE {
|
|
|
32
32
|
buildTimeDimension(E, R) {
|
|
33
33
|
switch (E) {
|
|
34
34
|
case "year":
|
|
35
|
-
return
|
|
35
|
+
return r`DATE_TRUNC('year', ${R}::timestamp)`;
|
|
36
36
|
case "quarter":
|
|
37
|
-
return
|
|
37
|
+
return r`DATE_TRUNC('quarter', ${R}::timestamp)`;
|
|
38
38
|
case "month":
|
|
39
|
-
return
|
|
39
|
+
return r`DATE_TRUNC('month', ${R}::timestamp)`;
|
|
40
40
|
case "week":
|
|
41
|
-
return
|
|
41
|
+
return r`DATE_TRUNC('week', ${R}::timestamp)`;
|
|
42
42
|
case "day":
|
|
43
|
-
return
|
|
43
|
+
return r`DATE_TRUNC('day', ${R}::timestamp)::timestamp`;
|
|
44
44
|
case "hour":
|
|
45
|
-
return
|
|
45
|
+
return r`DATE_TRUNC('hour', ${R}::timestamp)`;
|
|
46
46
|
case "minute":
|
|
47
|
-
return
|
|
47
|
+
return r`DATE_TRUNC('minute', ${R}::timestamp)`;
|
|
48
48
|
case "second":
|
|
49
|
-
return
|
|
49
|
+
return r`DATE_TRUNC('second', ${R}::timestamp)`;
|
|
50
50
|
default:
|
|
51
51
|
return R;
|
|
52
52
|
}
|
|
@@ -59,13 +59,13 @@ class QT extends pE {
|
|
|
59
59
|
const S = this.buildPattern(R, A);
|
|
60
60
|
switch (R) {
|
|
61
61
|
case "contains":
|
|
62
|
-
return
|
|
62
|
+
return r`${E} ILIKE ${S}`;
|
|
63
63
|
case "notContains":
|
|
64
|
-
return
|
|
64
|
+
return r`${E} NOT ILIKE ${S}`;
|
|
65
65
|
case "startsWith":
|
|
66
|
-
return
|
|
66
|
+
return r`${E} ILIKE ${S}`;
|
|
67
67
|
case "endsWith":
|
|
68
|
-
return
|
|
68
|
+
return r`${E} ILIKE ${S}`;
|
|
69
69
|
default:
|
|
70
70
|
throw new Error(`Unsupported string operator: ${R}`);
|
|
71
71
|
}
|
|
@@ -77,11 +77,11 @@ class QT extends pE {
|
|
|
77
77
|
castToType(E, R) {
|
|
78
78
|
switch (R) {
|
|
79
79
|
case "timestamp":
|
|
80
|
-
return
|
|
80
|
+
return r`${E}::timestamp`;
|
|
81
81
|
case "decimal":
|
|
82
|
-
return
|
|
82
|
+
return r`${E}::decimal`;
|
|
83
83
|
case "integer":
|
|
84
|
-
return
|
|
84
|
+
return r`${E}::integer`;
|
|
85
85
|
default:
|
|
86
86
|
throw new Error(`Unsupported cast type: ${R}`);
|
|
87
87
|
}
|
|
@@ -92,21 +92,21 @@ class QT extends pE {
|
|
|
92
92
|
* Extracted from multi-cube-builder.ts:284
|
|
93
93
|
*/
|
|
94
94
|
buildAvg(E) {
|
|
95
|
-
return
|
|
95
|
+
return r`COALESCE(AVG(${E}), 0)`;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Build PostgreSQL CASE WHEN conditional expression
|
|
99
99
|
*/
|
|
100
100
|
buildCaseWhen(E, R) {
|
|
101
|
-
const A = E.map((S) =>
|
|
102
|
-
return R !== void 0 ?
|
|
101
|
+
const A = E.map((S) => r`WHEN ${S.when} THEN ${S.then}`).reduce((S, I) => r`${S} ${I}`);
|
|
102
|
+
return R !== void 0 ? r`CASE ${A} ELSE ${R} END` : r`CASE ${A} END`;
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* Build PostgreSQL boolean literal
|
|
106
106
|
* PostgreSQL uses TRUE/FALSE keywords
|
|
107
107
|
*/
|
|
108
108
|
buildBooleanLiteral(E) {
|
|
109
|
-
return E ?
|
|
109
|
+
return E ? r`TRUE` : r`FALSE`;
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* Convert filter values - PostgreSQL uses native types
|
|
@@ -159,12 +159,12 @@ class ZT extends pE {
|
|
|
159
159
|
};
|
|
160
160
|
switch (E) {
|
|
161
161
|
case "quarter":
|
|
162
|
-
return
|
|
162
|
+
return r`DATE_ADD(MAKEDATE(YEAR(${R}), 1), INTERVAL (QUARTER(${R}) - 1) * 3 MONTH)`;
|
|
163
163
|
case "week":
|
|
164
|
-
return
|
|
164
|
+
return r`DATE_SUB(${R}, INTERVAL WEEKDAY(${R}) DAY)`;
|
|
165
165
|
default:
|
|
166
166
|
const S = A[E];
|
|
167
|
-
return S ?
|
|
167
|
+
return S ? r`STR_TO_DATE(DATE_FORMAT(${R}, ${S}), '%Y-%m-%d %H:%i:%s')` : R;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
@@ -176,13 +176,13 @@ class ZT extends pE {
|
|
|
176
176
|
const S = this.buildPattern(R, A.toLowerCase());
|
|
177
177
|
switch (R) {
|
|
178
178
|
case "contains":
|
|
179
|
-
return
|
|
179
|
+
return r`LOWER(${E}) LIKE ${S}`;
|
|
180
180
|
case "notContains":
|
|
181
|
-
return
|
|
181
|
+
return r`LOWER(${E}) NOT LIKE ${S}`;
|
|
182
182
|
case "startsWith":
|
|
183
|
-
return
|
|
183
|
+
return r`LOWER(${E}) LIKE ${S}`;
|
|
184
184
|
case "endsWith":
|
|
185
|
-
return
|
|
185
|
+
return r`LOWER(${E}) LIKE ${S}`;
|
|
186
186
|
default:
|
|
187
187
|
throw new Error(`Unsupported string operator: ${R}`);
|
|
188
188
|
}
|
|
@@ -194,11 +194,11 @@ class ZT extends pE {
|
|
|
194
194
|
castToType(E, R) {
|
|
195
195
|
switch (R) {
|
|
196
196
|
case "timestamp":
|
|
197
|
-
return
|
|
197
|
+
return r`CAST(${E} AS DATETIME)`;
|
|
198
198
|
case "decimal":
|
|
199
|
-
return
|
|
199
|
+
return r`CAST(${E} AS DECIMAL(10,2))`;
|
|
200
200
|
case "integer":
|
|
201
|
-
return
|
|
201
|
+
return r`CAST(${E} AS SIGNED INTEGER)`;
|
|
202
202
|
default:
|
|
203
203
|
throw new Error(`Unsupported cast type: ${R}`);
|
|
204
204
|
}
|
|
@@ -208,21 +208,21 @@ class ZT extends pE {
|
|
|
208
208
|
* MySQL AVG returns NULL for empty sets, using IFNULL for consistency
|
|
209
209
|
*/
|
|
210
210
|
buildAvg(E) {
|
|
211
|
-
return
|
|
211
|
+
return r`IFNULL(AVG(${E}), 0)`;
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
214
|
* Build MySQL CASE WHEN conditional expression
|
|
215
215
|
*/
|
|
216
216
|
buildCaseWhen(E, R) {
|
|
217
|
-
const A = E.map((S) =>
|
|
218
|
-
return R !== void 0 ?
|
|
217
|
+
const A = E.map((S) => r`WHEN ${S.when} THEN ${S.then}`).reduce((S, I) => r`${S} ${I}`);
|
|
218
|
+
return R !== void 0 ? r`CASE ${A} ELSE ${R} END` : r`CASE ${A} END`;
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* Build MySQL boolean literal
|
|
222
222
|
* MySQL uses TRUE/FALSE keywords (equivalent to 1/0)
|
|
223
223
|
*/
|
|
224
224
|
buildBooleanLiteral(E) {
|
|
225
|
-
return E ?
|
|
225
|
+
return E ? r`TRUE` : r`FALSE`;
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
228
|
* Convert filter values - MySQL uses native types
|
|
@@ -265,28 +265,28 @@ class qT extends pE {
|
|
|
265
265
|
buildTimeDimension(E, R) {
|
|
266
266
|
switch (E) {
|
|
267
267
|
case "year":
|
|
268
|
-
return
|
|
268
|
+
return r`datetime(${R}, 'unixepoch', 'start of year')`;
|
|
269
269
|
case "quarter":
|
|
270
|
-
const A =
|
|
271
|
-
return
|
|
270
|
+
const A = r`datetime(${R}, 'unixepoch')`;
|
|
271
|
+
return r`datetime(${A}, 'start of year',
|
|
272
272
|
'+' || (((CAST(strftime('%m', ${A}) AS INTEGER) - 1) / 3) * 3) || ' months')`;
|
|
273
273
|
case "month":
|
|
274
|
-
return
|
|
274
|
+
return r`datetime(${R}, 'unixepoch', 'start of month')`;
|
|
275
275
|
case "week":
|
|
276
|
-
return
|
|
276
|
+
return r`date(datetime(${R}, 'unixepoch'), 'weekday 1', '-6 days')`;
|
|
277
277
|
case "day":
|
|
278
|
-
return
|
|
278
|
+
return r`datetime(${R}, 'unixepoch', 'start of day')`;
|
|
279
279
|
case "hour":
|
|
280
|
-
const S =
|
|
281
|
-
return
|
|
280
|
+
const S = r`datetime(${R}, 'unixepoch')`;
|
|
281
|
+
return r`datetime(strftime('%Y-%m-%d %H:00:00', ${S}))`;
|
|
282
282
|
case "minute":
|
|
283
|
-
const I =
|
|
284
|
-
return
|
|
283
|
+
const I = r`datetime(${R}, 'unixepoch')`;
|
|
284
|
+
return r`datetime(strftime('%Y-%m-%d %H:%M:00', ${I}))`;
|
|
285
285
|
case "second":
|
|
286
|
-
const N =
|
|
287
|
-
return
|
|
286
|
+
const N = r`datetime(${R}, 'unixepoch')`;
|
|
287
|
+
return r`datetime(strftime('%Y-%m-%d %H:%M:%S', ${N}))`;
|
|
288
288
|
default:
|
|
289
|
-
return
|
|
289
|
+
return r`datetime(${R}, 'unixepoch')`;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
@@ -297,13 +297,13 @@ class qT extends pE {
|
|
|
297
297
|
const S = this.buildPattern(R, A.toLowerCase());
|
|
298
298
|
switch (R) {
|
|
299
299
|
case "contains":
|
|
300
|
-
return
|
|
300
|
+
return r`LOWER(${E}) LIKE ${S}`;
|
|
301
301
|
case "notContains":
|
|
302
|
-
return
|
|
302
|
+
return r`LOWER(${E}) NOT LIKE ${S}`;
|
|
303
303
|
case "startsWith":
|
|
304
|
-
return
|
|
304
|
+
return r`LOWER(${E}) LIKE ${S}`;
|
|
305
305
|
case "endsWith":
|
|
306
|
-
return
|
|
306
|
+
return r`LOWER(${E}) LIKE ${S}`;
|
|
307
307
|
default:
|
|
308
308
|
throw new Error(`Unsupported string operator: ${R}`);
|
|
309
309
|
}
|
|
@@ -315,11 +315,11 @@ class qT extends pE {
|
|
|
315
315
|
castToType(E, R) {
|
|
316
316
|
switch (R) {
|
|
317
317
|
case "timestamp":
|
|
318
|
-
return
|
|
318
|
+
return r`datetime(${E} / 1000, 'unixepoch')`;
|
|
319
319
|
case "decimal":
|
|
320
|
-
return
|
|
320
|
+
return r`CAST(${E} AS REAL)`;
|
|
321
321
|
case "integer":
|
|
322
|
-
return
|
|
322
|
+
return r`CAST(${E} AS INTEGER)`;
|
|
323
323
|
default:
|
|
324
324
|
throw new Error(`Unsupported cast type: ${R}`);
|
|
325
325
|
}
|
|
@@ -329,21 +329,21 @@ class qT extends pE {
|
|
|
329
329
|
* SQLite AVG returns NULL for empty sets, using IFNULL for consistency
|
|
330
330
|
*/
|
|
331
331
|
buildAvg(E) {
|
|
332
|
-
return
|
|
332
|
+
return r`IFNULL(AVG(${E}), 0)`;
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
335
|
* Build SQLite CASE WHEN conditional expression
|
|
336
336
|
*/
|
|
337
337
|
buildCaseWhen(E, R) {
|
|
338
|
-
const A = E.map((S) => S.then && typeof S.then == "object" && (S.then.queryChunks || S.then._ || S.then.sql) ?
|
|
339
|
-
return R !== void 0 ? R && typeof R == "object" && (R.queryChunks || R._ || R.sql) ?
|
|
338
|
+
const A = E.map((S) => S.then && typeof S.then == "object" && (S.then.queryChunks || S.then._ || S.then.sql) ? r`WHEN ${S.when} THEN ${r.raw("(")}${S.then}${r.raw(")")}` : r`WHEN ${S.when} THEN ${S.then}`).reduce((S, I) => r`${S} ${I}`);
|
|
339
|
+
return R !== void 0 ? R && typeof R == "object" && (R.queryChunks || R._ || R.sql) ? r`CASE ${A} ELSE ${r.raw("(")}${R}${r.raw(")")} END` : r`CASE ${A} ELSE ${R} END` : r`CASE ${A} END`;
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
342
342
|
* Build SQLite boolean literal
|
|
343
343
|
* SQLite uses 1/0 for true/false
|
|
344
344
|
*/
|
|
345
345
|
buildBooleanLiteral(E) {
|
|
346
|
-
return E ?
|
|
346
|
+
return E ? r`1` : r`0`;
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* Convert filter values to SQLite-compatible types
|
|
@@ -391,12 +391,6 @@ function kT(T) {
|
|
|
391
391
|
throw new Error(`Unsupported database engine: ${T}`);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
function uO(T, E) {
|
|
395
|
-
return {
|
|
396
|
-
...E,
|
|
397
|
-
name: E.name
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
394
|
class dE {
|
|
401
395
|
constructor(E, R, A) {
|
|
402
396
|
f(this, "databaseAdapter");
|
|
@@ -419,7 +413,7 @@ class jT extends dE {
|
|
|
419
413
|
} catch (S) {
|
|
420
414
|
if (typeof E.getSQL == "function") {
|
|
421
415
|
const I = E.getSQL(), N = await this.db.execute(I);
|
|
422
|
-
return Array.isArray(N) ? N.map((
|
|
416
|
+
return Array.isArray(N) ? N.map((e) => this.convertNumericFields(e, R)) : N;
|
|
423
417
|
}
|
|
424
418
|
throw S;
|
|
425
419
|
}
|
|
@@ -470,27 +464,22 @@ class jT extends dE {
|
|
|
470
464
|
return "postgres";
|
|
471
465
|
}
|
|
472
466
|
}
|
|
467
|
+
function KE(T, E) {
|
|
468
|
+
return new jT(T, E, "postgres");
|
|
469
|
+
}
|
|
473
470
|
class zT extends dE {
|
|
474
471
|
async execute(E, R) {
|
|
475
472
|
if (E && typeof E == "object" && typeof E.execute == "function") {
|
|
476
|
-
const
|
|
477
|
-
return Array.isArray(
|
|
478
|
-
}
|
|
479
|
-
try {
|
|
480
|
-
if (this.db.all) {
|
|
481
|
-
const A = this.db.all(E);
|
|
482
|
-
return Array.isArray(A) ? A.map((S) => this.convertNumericFields(S, R)) : A;
|
|
483
|
-
} else {
|
|
484
|
-
if (this.db.run)
|
|
485
|
-
return this.db.run(E);
|
|
486
|
-
throw new Error("SQLite database instance must have an all() or run() method");
|
|
487
|
-
}
|
|
488
|
-
} catch (A) {
|
|
489
|
-
throw new Error(`SQLite execution failed: ${A instanceof Error ? A.message : "Unknown error"}`);
|
|
473
|
+
const S = await E.execute();
|
|
474
|
+
return Array.isArray(S) ? S.map((I) => this.convertNumericFields(I, R)) : S;
|
|
490
475
|
}
|
|
476
|
+
if (!this.db.execute)
|
|
477
|
+
throw new Error("MySQL database instance must have an execute method");
|
|
478
|
+
const A = await this.db.execute(E);
|
|
479
|
+
return Array.isArray(A) ? A.map((S) => this.convertNumericFields(S, R)) : A;
|
|
491
480
|
}
|
|
492
481
|
/**
|
|
493
|
-
* Convert numeric string fields to numbers (
|
|
482
|
+
* Convert numeric string fields to numbers (measure fields + numeric dimensions)
|
|
494
483
|
*/
|
|
495
484
|
convertNumericFields(E, R) {
|
|
496
485
|
if (!E || typeof E != "object") return E;
|
|
@@ -513,22 +502,33 @@ class zT extends dE {
|
|
|
513
502
|
return E;
|
|
514
503
|
}
|
|
515
504
|
getEngineType() {
|
|
516
|
-
return "
|
|
505
|
+
return "mysql";
|
|
517
506
|
}
|
|
518
507
|
}
|
|
519
|
-
|
|
508
|
+
function ER(T, E) {
|
|
509
|
+
return new zT(T, E, "mysql");
|
|
510
|
+
}
|
|
511
|
+
class TR extends dE {
|
|
520
512
|
async execute(E, R) {
|
|
521
513
|
if (E && typeof E == "object" && typeof E.execute == "function") {
|
|
522
|
-
const
|
|
523
|
-
return Array.isArray(
|
|
514
|
+
const A = await E.execute();
|
|
515
|
+
return Array.isArray(A) ? A.map((S) => this.convertNumericFields(S, R)) : A;
|
|
516
|
+
}
|
|
517
|
+
try {
|
|
518
|
+
if (this.db.all) {
|
|
519
|
+
const A = this.db.all(E);
|
|
520
|
+
return Array.isArray(A) ? A.map((S) => this.convertNumericFields(S, R)) : A;
|
|
521
|
+
} else {
|
|
522
|
+
if (this.db.run)
|
|
523
|
+
return this.db.run(E);
|
|
524
|
+
throw new Error("SQLite database instance must have an all() or run() method");
|
|
525
|
+
}
|
|
526
|
+
} catch (A) {
|
|
527
|
+
throw new Error(`SQLite execution failed: ${A instanceof Error ? A.message : "Unknown error"}`);
|
|
524
528
|
}
|
|
525
|
-
if (!this.db.execute)
|
|
526
|
-
throw new Error("MySQL database instance must have an execute method");
|
|
527
|
-
const A = await this.db.execute(E);
|
|
528
|
-
return Array.isArray(A) ? A.map((S) => this.convertNumericFields(S, R)) : A;
|
|
529
529
|
}
|
|
530
530
|
/**
|
|
531
|
-
* Convert numeric string fields to numbers (measure fields
|
|
531
|
+
* Convert numeric string fields to numbers (only for measure fields)
|
|
532
532
|
*/
|
|
533
533
|
convertNumericFields(E, R) {
|
|
534
534
|
if (!E || typeof E != "object") return E;
|
|
@@ -551,17 +551,11 @@ class ER extends dE {
|
|
|
551
551
|
return E;
|
|
552
552
|
}
|
|
553
553
|
getEngineType() {
|
|
554
|
-
return "
|
|
554
|
+
return "sqlite";
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
|
-
function KE(T, E) {
|
|
558
|
-
return new jT(T, E, "postgres");
|
|
559
|
-
}
|
|
560
557
|
function yE(T, E) {
|
|
561
|
-
return new
|
|
562
|
-
}
|
|
563
|
-
function TR(T, E) {
|
|
564
|
-
return new ER(T, E, "mysql");
|
|
558
|
+
return new TR(T, E, "sqlite");
|
|
565
559
|
}
|
|
566
560
|
function $E(T, E, R) {
|
|
567
561
|
if (R)
|
|
@@ -569,7 +563,7 @@ function $E(T, E, R) {
|
|
|
569
563
|
case "postgres":
|
|
570
564
|
return KE(T, E);
|
|
571
565
|
case "mysql":
|
|
572
|
-
return
|
|
566
|
+
return ER(T, E);
|
|
573
567
|
case "sqlite":
|
|
574
568
|
return yE(T, E);
|
|
575
569
|
}
|
|
@@ -579,12 +573,6 @@ function $E(T, E, R) {
|
|
|
579
573
|
return KE(T, E);
|
|
580
574
|
throw new Error("Unable to determine database engine type. Please specify engineType parameter.");
|
|
581
575
|
}
|
|
582
|
-
function FO(T, E) {
|
|
583
|
-
return {
|
|
584
|
-
name: T,
|
|
585
|
-
...E
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
576
|
function gE(T) {
|
|
589
577
|
return typeof T == "function" ? T() : T;
|
|
590
578
|
}
|
|
@@ -604,13 +592,19 @@ function RR(T, E) {
|
|
|
604
592
|
function K(T, E) {
|
|
605
593
|
return typeof T == "function" ? T(E) : T;
|
|
606
594
|
}
|
|
607
|
-
function
|
|
595
|
+
function uO(T, E, R) {
|
|
608
596
|
return {
|
|
609
597
|
...T,
|
|
610
598
|
cubes: E,
|
|
611
599
|
currentCube: R
|
|
612
600
|
};
|
|
613
601
|
}
|
|
602
|
+
function FO(T, E) {
|
|
603
|
+
return {
|
|
604
|
+
name: T,
|
|
605
|
+
...E
|
|
606
|
+
};
|
|
607
|
+
}
|
|
614
608
|
class AR {
|
|
615
609
|
constructor(E) {
|
|
616
610
|
this.databaseAdapter = E;
|
|
@@ -623,30 +617,30 @@ class AR {
|
|
|
623
617
|
const S = {}, I = E instanceof Map ? E : /* @__PURE__ */ new Map([[E.name, E]]);
|
|
624
618
|
if (R.dimensions)
|
|
625
619
|
for (const N of R.dimensions) {
|
|
626
|
-
const [
|
|
627
|
-
if (O && O.dimensions && O.dimensions[
|
|
628
|
-
const
|
|
629
|
-
S[N] =
|
|
620
|
+
const [e, n] = N.split("."), O = I.get(e);
|
|
621
|
+
if (O && O.dimensions && O.dimensions[n]) {
|
|
622
|
+
const s = O.dimensions[n], C = K(s.sql, A);
|
|
623
|
+
S[N] = r`${C}`.as(N);
|
|
630
624
|
}
|
|
631
625
|
}
|
|
632
626
|
if (R.measures)
|
|
633
627
|
for (const N of R.measures) {
|
|
634
|
-
const [
|
|
635
|
-
if (O && O.measures && O.measures[
|
|
636
|
-
const
|
|
637
|
-
S[N] =
|
|
628
|
+
const [e, n] = N.split("."), O = I.get(e);
|
|
629
|
+
if (O && O.measures && O.measures[n]) {
|
|
630
|
+
const s = O.measures[n], C = this.buildMeasureExpression(s, A);
|
|
631
|
+
S[N] = r`${C}`.as(N);
|
|
638
632
|
}
|
|
639
633
|
}
|
|
640
634
|
if (R.timeDimensions)
|
|
641
635
|
for (const N of R.timeDimensions) {
|
|
642
|
-
const [
|
|
643
|
-
if (O && O.dimensions && O.dimensions[
|
|
644
|
-
const
|
|
645
|
-
|
|
636
|
+
const [e, n] = N.dimension.split("."), O = I.get(e);
|
|
637
|
+
if (O && O.dimensions && O.dimensions[n]) {
|
|
638
|
+
const s = O.dimensions[n], C = this.buildTimeDimensionExpression(
|
|
639
|
+
s.sql,
|
|
646
640
|
N.granularity,
|
|
647
641
|
A
|
|
648
642
|
);
|
|
649
|
-
S[N.dimension] =
|
|
643
|
+
S[N.dimension] = r`${C}`.as(N.dimension);
|
|
650
644
|
}
|
|
651
645
|
}
|
|
652
646
|
return Object.keys(S).length === 0 && (S.count = SE()), S;
|
|
@@ -656,24 +650,24 @@ class AR {
|
|
|
656
650
|
*/
|
|
657
651
|
buildHavingMeasureExpression(E, R, A, S, I) {
|
|
658
652
|
if (I && I.preAggregationCTEs) {
|
|
659
|
-
const N = I.preAggregationCTEs.find((
|
|
653
|
+
const N = I.preAggregationCTEs.find((e) => e.cube.name === E);
|
|
660
654
|
if (N && N.measures.includes(`${E}.${R}`)) {
|
|
661
|
-
const
|
|
655
|
+
const e = r`${r.identifier(N.cteAlias)}.${r.identifier(R)}`;
|
|
662
656
|
switch (A.type) {
|
|
663
657
|
case "count":
|
|
664
658
|
case "countDistinct":
|
|
665
659
|
case "sum":
|
|
666
|
-
return y(
|
|
660
|
+
return y(e);
|
|
667
661
|
case "avg":
|
|
668
|
-
return this.databaseAdapter.buildAvg(
|
|
662
|
+
return this.databaseAdapter.buildAvg(e);
|
|
669
663
|
case "min":
|
|
670
|
-
return FE(
|
|
664
|
+
return FE(e);
|
|
671
665
|
case "max":
|
|
672
|
-
return uE(
|
|
666
|
+
return uE(e);
|
|
673
667
|
case "number":
|
|
674
|
-
return y(
|
|
668
|
+
return y(e);
|
|
675
669
|
default:
|
|
676
|
-
return y(
|
|
670
|
+
return y(e);
|
|
677
671
|
}
|
|
678
672
|
}
|
|
679
673
|
}
|
|
@@ -717,7 +711,7 @@ class AR {
|
|
|
717
711
|
*/
|
|
718
712
|
buildTimeDimensionExpression(E, R, A) {
|
|
719
713
|
const S = K(E, A);
|
|
720
|
-
return R ? this.databaseAdapter.buildTimeDimension(R, S) : S instanceof yT ? S :
|
|
714
|
+
return R ? this.databaseAdapter.buildTimeDimension(R, S) : S instanceof yT ? S : r`${S}`;
|
|
721
715
|
}
|
|
722
716
|
/**
|
|
723
717
|
* Build WHERE conditions from semantic query filters (dimensions only)
|
|
@@ -726,17 +720,17 @@ class AR {
|
|
|
726
720
|
buildWhereConditions(E, R, A, S) {
|
|
727
721
|
const I = [], N = E instanceof Map ? E : /* @__PURE__ */ new Map([[E.name, E]]);
|
|
728
722
|
if (R.filters && R.filters.length > 0)
|
|
729
|
-
for (const
|
|
730
|
-
const
|
|
731
|
-
|
|
723
|
+
for (const e of R.filters) {
|
|
724
|
+
const n = this.processFilter(e, N, A, "where", S);
|
|
725
|
+
n && I.push(n);
|
|
732
726
|
}
|
|
733
727
|
if (R.timeDimensions)
|
|
734
|
-
for (const
|
|
735
|
-
const [
|
|
736
|
-
if (
|
|
737
|
-
if (S != null && S.preAggregationCTEs && S.preAggregationCTEs.some((
|
|
728
|
+
for (const e of R.timeDimensions) {
|
|
729
|
+
const [n, O] = e.dimension.split("."), s = N.get(n);
|
|
730
|
+
if (s && s.dimensions[O] && e.dateRange) {
|
|
731
|
+
if (S != null && S.preAggregationCTEs && S.preAggregationCTEs.some((U) => U.cube.name === n))
|
|
738
732
|
continue;
|
|
739
|
-
const
|
|
733
|
+
const C = s.dimensions[O], t = K(C.sql, A), i = this.buildDateRangeCondition(t, e.dateRange);
|
|
740
734
|
i && I.push(i);
|
|
741
735
|
}
|
|
742
736
|
}
|
|
@@ -749,9 +743,9 @@ class AR {
|
|
|
749
743
|
buildHavingConditions(E, R, A, S) {
|
|
750
744
|
const I = [], N = E instanceof Map ? E : /* @__PURE__ */ new Map([[E.name, E]]);
|
|
751
745
|
if (R.filters && R.filters.length > 0)
|
|
752
|
-
for (const
|
|
753
|
-
const
|
|
754
|
-
|
|
746
|
+
for (const e of R.filters) {
|
|
747
|
+
const n = this.processFilter(e, N, A, "having", S);
|
|
748
|
+
n && I.push(n);
|
|
755
749
|
}
|
|
756
750
|
return I;
|
|
757
751
|
}
|
|
@@ -763,29 +757,29 @@ class AR {
|
|
|
763
757
|
if ("and" in E || "or" in E) {
|
|
764
758
|
const i = E;
|
|
765
759
|
if (i.and) {
|
|
766
|
-
const a = i.and.map((
|
|
760
|
+
const a = i.and.map((U) => this.processFilter(U, R, A, S, I)).filter((U) => U !== null);
|
|
767
761
|
return a.length > 0 ? d(...a) : null;
|
|
768
762
|
}
|
|
769
763
|
if (i.or) {
|
|
770
|
-
const a = i.or.map((
|
|
764
|
+
const a = i.or.map((U) => this.processFilter(U, R, A, S, I)).filter((U) => U !== null);
|
|
771
765
|
return a.length > 0 ? $T(...a) : null;
|
|
772
766
|
}
|
|
773
767
|
}
|
|
774
|
-
const N = E, [
|
|
768
|
+
const N = E, [e, n] = N.member.split("."), O = R.get(e);
|
|
775
769
|
if (!O) return null;
|
|
776
|
-
const
|
|
777
|
-
if (!
|
|
778
|
-
if (S === "where" &&
|
|
779
|
-
if (I != null && I.preAggregationCTEs && I.preAggregationCTEs.some((
|
|
770
|
+
const s = O.dimensions[n], C = O.measures[n], t = s || C;
|
|
771
|
+
if (!t) return null;
|
|
772
|
+
if (S === "where" && s) {
|
|
773
|
+
if (I != null && I.preAggregationCTEs && I.preAggregationCTEs.some((U) => U.cube.name === e))
|
|
780
774
|
return null;
|
|
781
|
-
const i = K(
|
|
782
|
-
return this.buildFilterCondition(i, N.operator, N.values,
|
|
775
|
+
const i = K(s.sql, A);
|
|
776
|
+
return this.buildFilterCondition(i, N.operator, N.values, t);
|
|
783
777
|
} else {
|
|
784
|
-
if (S === "where" &&
|
|
778
|
+
if (S === "where" && C)
|
|
785
779
|
return null;
|
|
786
|
-
if (S === "having" &&
|
|
787
|
-
const i = this.buildHavingMeasureExpression(
|
|
788
|
-
return this.buildFilterCondition(i, N.operator, N.values,
|
|
780
|
+
if (S === "having" && C) {
|
|
781
|
+
const i = this.buildHavingMeasureExpression(e, n, C, A, I);
|
|
782
|
+
return this.buildFilterCondition(i, N.operator, N.values, t);
|
|
789
783
|
}
|
|
790
784
|
}
|
|
791
785
|
return null;
|
|
@@ -796,7 +790,7 @@ class AR {
|
|
|
796
790
|
buildFilterCondition(E, R, A, S) {
|
|
797
791
|
if (!A || A.length === 0)
|
|
798
792
|
return R === "equals" ? this.databaseAdapter.buildBooleanLiteral(!1) : null;
|
|
799
|
-
const I = A.filter((
|
|
793
|
+
const I = A.filter((e) => !(e == null || e === "" || typeof e == "string" && e.includes("\0"))).map(this.databaseAdapter.convertFilterValue);
|
|
800
794
|
if (I.length === 0 && !["set", "notSet"].includes(R))
|
|
801
795
|
return R === "equals" ? this.databaseAdapter.buildBooleanLiteral(!1) : null;
|
|
802
796
|
const N = I[0];
|
|
@@ -804,13 +798,13 @@ class AR {
|
|
|
804
798
|
case "equals":
|
|
805
799
|
if (I.length > 1) {
|
|
806
800
|
if ((S == null ? void 0 : S.type) === "time") {
|
|
807
|
-
const
|
|
808
|
-
return XE(E,
|
|
801
|
+
const e = I.map((n) => this.normalizeDate(n) || n);
|
|
802
|
+
return XE(E, e);
|
|
809
803
|
}
|
|
810
804
|
return XE(E, I);
|
|
811
805
|
} else if (I.length === 1) {
|
|
812
|
-
const
|
|
813
|
-
return mE(E,
|
|
806
|
+
const e = (S == null ? void 0 : S.type) === "time" && this.normalizeDate(N) || N;
|
|
807
|
+
return mE(E, e);
|
|
814
808
|
}
|
|
815
809
|
return this.databaseAdapter.buildBooleanLiteral(!1);
|
|
816
810
|
case "notEquals":
|
|
@@ -837,21 +831,21 @@ class AR {
|
|
|
837
831
|
return gT(E);
|
|
838
832
|
case "inDateRange":
|
|
839
833
|
if (I.length >= 2) {
|
|
840
|
-
const
|
|
841
|
-
if (
|
|
834
|
+
const e = this.normalizeDate(I[0]), n = this.normalizeDate(I[1]);
|
|
835
|
+
if (e && n)
|
|
842
836
|
return d(
|
|
843
|
-
Q(E,
|
|
844
|
-
Z(E,
|
|
837
|
+
Q(E, e),
|
|
838
|
+
Z(E, n)
|
|
845
839
|
);
|
|
846
840
|
}
|
|
847
841
|
return null;
|
|
848
842
|
case "beforeDate": {
|
|
849
|
-
const
|
|
850
|
-
return
|
|
843
|
+
const e = this.normalizeDate(N);
|
|
844
|
+
return e ? WE(E, e) : null;
|
|
851
845
|
}
|
|
852
846
|
case "afterDate": {
|
|
853
|
-
const
|
|
854
|
-
return
|
|
847
|
+
const e = this.normalizeDate(N);
|
|
848
|
+
return e ? fE(E, e) : null;
|
|
855
849
|
}
|
|
856
850
|
default:
|
|
857
851
|
return null;
|
|
@@ -893,75 +887,75 @@ class AR {
|
|
|
893
887
|
* Handles all 14 DATE_RANGE_OPTIONS from the client
|
|
894
888
|
*/
|
|
895
889
|
parseRelativeDateRange(E) {
|
|
896
|
-
const R = /* @__PURE__ */ new Date(), A = E.toLowerCase().trim(), S = R.getUTCFullYear(), I = R.getUTCMonth(), N = R.getUTCDate(),
|
|
890
|
+
const R = /* @__PURE__ */ new Date(), A = E.toLowerCase().trim(), S = R.getUTCFullYear(), I = R.getUTCMonth(), N = R.getUTCDate(), e = R.getUTCDay();
|
|
897
891
|
if (A === "today") {
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
const
|
|
901
|
-
return
|
|
892
|
+
const C = new Date(R);
|
|
893
|
+
C.setUTCHours(0, 0, 0, 0);
|
|
894
|
+
const t = new Date(R);
|
|
895
|
+
return t.setUTCHours(23, 59, 59, 999), { start: C, end: t };
|
|
902
896
|
}
|
|
903
897
|
if (A === "yesterday") {
|
|
904
|
-
const
|
|
905
|
-
|
|
906
|
-
const
|
|
907
|
-
return
|
|
898
|
+
const C = new Date(R);
|
|
899
|
+
C.setUTCDate(N - 1), C.setUTCHours(0, 0, 0, 0);
|
|
900
|
+
const t = new Date(R);
|
|
901
|
+
return t.setUTCDate(N - 1), t.setUTCHours(23, 59, 59, 999), { start: C, end: t };
|
|
908
902
|
}
|
|
909
903
|
if (A === "this week") {
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
-
const i = new Date(
|
|
913
|
-
return i.setUTCDate(
|
|
904
|
+
const C = e === 0 ? -6 : 1 - e, t = new Date(R);
|
|
905
|
+
t.setUTCDate(N + C), t.setUTCHours(0, 0, 0, 0);
|
|
906
|
+
const i = new Date(t);
|
|
907
|
+
return i.setUTCDate(t.getUTCDate() + 6), i.setUTCHours(23, 59, 59, 999), { start: t, end: i };
|
|
914
908
|
}
|
|
915
909
|
if (A === "this month") {
|
|
916
|
-
const
|
|
917
|
-
return { start:
|
|
910
|
+
const C = new Date(Date.UTC(S, I, 1, 0, 0, 0, 0)), t = new Date(Date.UTC(S, I + 1, 0, 23, 59, 59, 999));
|
|
911
|
+
return { start: C, end: t };
|
|
918
912
|
}
|
|
919
913
|
if (A === "this quarter") {
|
|
920
|
-
const
|
|
921
|
-
return { start:
|
|
914
|
+
const C = Math.floor(I / 3), t = new Date(Date.UTC(S, C * 3, 1, 0, 0, 0, 0)), i = new Date(Date.UTC(S, C * 3 + 3, 0, 23, 59, 59, 999));
|
|
915
|
+
return { start: t, end: i };
|
|
922
916
|
}
|
|
923
917
|
if (A === "this year") {
|
|
924
|
-
const
|
|
925
|
-
return { start:
|
|
918
|
+
const C = new Date(Date.UTC(S, 0, 1, 0, 0, 0, 0)), t = new Date(Date.UTC(S, 11, 31, 23, 59, 59, 999));
|
|
919
|
+
return { start: C, end: t };
|
|
926
920
|
}
|
|
927
|
-
const
|
|
928
|
-
if (
|
|
929
|
-
const
|
|
930
|
-
|
|
921
|
+
const n = A.match(/^last\s+(\d+)\s+days?$/);
|
|
922
|
+
if (n) {
|
|
923
|
+
const C = parseInt(n[1], 10), t = new Date(R);
|
|
924
|
+
t.setUTCDate(N - C + 1), t.setUTCHours(0, 0, 0, 0);
|
|
931
925
|
const i = new Date(R);
|
|
932
|
-
return i.setUTCHours(23, 59, 59, 999), { start:
|
|
926
|
+
return i.setUTCHours(23, 59, 59, 999), { start: t, end: i };
|
|
933
927
|
}
|
|
934
928
|
if (A === "last week") {
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
const i = new Date(
|
|
938
|
-
return i.setUTCDate(
|
|
929
|
+
const C = e === 0 ? -13 : -6 - e, t = new Date(R);
|
|
930
|
+
t.setUTCDate(N + C), t.setUTCHours(0, 0, 0, 0);
|
|
931
|
+
const i = new Date(t);
|
|
932
|
+
return i.setUTCDate(t.getUTCDate() + 6), i.setUTCHours(23, 59, 59, 999), { start: t, end: i };
|
|
939
933
|
}
|
|
940
934
|
if (A === "last month") {
|
|
941
|
-
const
|
|
942
|
-
return { start:
|
|
935
|
+
const C = new Date(Date.UTC(S, I - 1, 1, 0, 0, 0, 0)), t = new Date(Date.UTC(S, I, 0, 23, 59, 59, 999));
|
|
936
|
+
return { start: C, end: t };
|
|
943
937
|
}
|
|
944
938
|
if (A === "last quarter") {
|
|
945
|
-
const
|
|
946
|
-
return { start: a, end:
|
|
939
|
+
const C = Math.floor(I / 3), t = C === 0 ? 3 : C - 1, i = C === 0 ? S - 1 : S, a = new Date(Date.UTC(i, t * 3, 1, 0, 0, 0, 0)), U = new Date(Date.UTC(i, t * 3 + 3, 0, 23, 59, 59, 999));
|
|
940
|
+
return { start: a, end: U };
|
|
947
941
|
}
|
|
948
942
|
if (A === "last year") {
|
|
949
|
-
const
|
|
950
|
-
return { start:
|
|
943
|
+
const C = new Date(Date.UTC(S - 1, 0, 1, 0, 0, 0, 0)), t = new Date(Date.UTC(S - 1, 11, 31, 23, 59, 59, 999));
|
|
944
|
+
return { start: C, end: t };
|
|
951
945
|
}
|
|
952
946
|
if (A === "last 12 months") {
|
|
953
|
-
const
|
|
954
|
-
return
|
|
947
|
+
const C = new Date(Date.UTC(S, I - 11, 1, 0, 0, 0, 0)), t = new Date(R);
|
|
948
|
+
return t.setUTCHours(23, 59, 59, 999), { start: C, end: t };
|
|
955
949
|
}
|
|
956
950
|
const O = A.match(/^last\s+(\d+)\s+months?$/);
|
|
957
951
|
if (O) {
|
|
958
|
-
const
|
|
959
|
-
return i.setUTCHours(23, 59, 59, 999), { start:
|
|
952
|
+
const C = parseInt(O[1], 10), t = new Date(Date.UTC(S, I - C + 1, 1, 0, 0, 0, 0)), i = new Date(R);
|
|
953
|
+
return i.setUTCHours(23, 59, 59, 999), { start: t, end: i };
|
|
960
954
|
}
|
|
961
|
-
const
|
|
962
|
-
if (
|
|
963
|
-
const
|
|
964
|
-
return i.setUTCHours(23, 59, 59, 999), { start:
|
|
955
|
+
const s = A.match(/^last\s+(\d+)\s+years?$/);
|
|
956
|
+
if (s) {
|
|
957
|
+
const C = parseInt(s[1], 10), t = new Date(Date.UTC(S - C, 0, 1, 0, 0, 0, 0)), i = new Date(R);
|
|
958
|
+
return i.setUTCHours(23, 59, 59, 999), { start: t, end: i };
|
|
965
959
|
}
|
|
966
960
|
return null;
|
|
967
961
|
}
|
|
@@ -990,49 +984,49 @@ class AR {
|
|
|
990
984
|
* Works for both single and multi-cube queries
|
|
991
985
|
*/
|
|
992
986
|
buildGroupByFields(E, R, A, S) {
|
|
993
|
-
var
|
|
987
|
+
var n, O;
|
|
994
988
|
const I = [];
|
|
995
989
|
if (!(R.measures && R.measures.length > 0))
|
|
996
990
|
return [];
|
|
997
|
-
const
|
|
991
|
+
const e = E instanceof Map ? E : /* @__PURE__ */ new Map([[E.name, E]]);
|
|
998
992
|
if (R.dimensions)
|
|
999
|
-
for (const
|
|
1000
|
-
const [
|
|
1001
|
-
if (i && i.dimensions && i.dimensions[
|
|
1002
|
-
if ((
|
|
1003
|
-
const
|
|
993
|
+
for (const s of R.dimensions) {
|
|
994
|
+
const [C, t] = s.split("."), i = e.get(C);
|
|
995
|
+
if (i && i.dimensions && i.dimensions[t])
|
|
996
|
+
if ((n = S == null ? void 0 : S.preAggregationCTEs) == null ? void 0 : n.some((U) => U.cube.name === C)) {
|
|
997
|
+
const U = S.preAggregationCTEs.find((G) => G.cube.name === C), o = U.joinKeys.find((G) => G.targetColumn === t);
|
|
1004
998
|
if (o && o.sourceColumnObj)
|
|
1005
999
|
I.push(o.sourceColumnObj);
|
|
1006
1000
|
else {
|
|
1007
|
-
const G =
|
|
1001
|
+
const G = r`${r.identifier(U.cteAlias)}.${r.identifier(t)}`;
|
|
1008
1002
|
I.push(G);
|
|
1009
1003
|
}
|
|
1010
1004
|
} else {
|
|
1011
|
-
const
|
|
1005
|
+
const U = i.dimensions[t], o = K(U.sql, A);
|
|
1012
1006
|
I.push(o);
|
|
1013
1007
|
}
|
|
1014
1008
|
}
|
|
1015
1009
|
if (R.timeDimensions)
|
|
1016
|
-
for (const
|
|
1017
|
-
const [
|
|
1018
|
-
if (i && i.dimensions && i.dimensions[
|
|
1019
|
-
if ((O = S == null ? void 0 : S.preAggregationCTEs) == null ? void 0 : O.some((
|
|
1020
|
-
const
|
|
1010
|
+
for (const s of R.timeDimensions) {
|
|
1011
|
+
const [C, t] = s.dimension.split("."), i = e.get(C);
|
|
1012
|
+
if (i && i.dimensions && i.dimensions[t])
|
|
1013
|
+
if ((O = S == null ? void 0 : S.preAggregationCTEs) == null ? void 0 : O.some((U) => U.cube.name === C)) {
|
|
1014
|
+
const U = S.preAggregationCTEs.find((G) => G.cube.name === C), o = U.joinKeys.find((G) => G.targetColumn === t);
|
|
1021
1015
|
if (o && o.sourceColumnObj) {
|
|
1022
1016
|
const G = this.buildTimeDimensionExpression(
|
|
1023
1017
|
o.sourceColumnObj,
|
|
1024
|
-
|
|
1018
|
+
s.granularity,
|
|
1025
1019
|
A
|
|
1026
1020
|
);
|
|
1027
1021
|
I.push(G);
|
|
1028
1022
|
} else {
|
|
1029
|
-
const G =
|
|
1023
|
+
const G = r`${r.identifier(U.cteAlias)}.${r.identifier(t)}`;
|
|
1030
1024
|
I.push(G);
|
|
1031
1025
|
}
|
|
1032
1026
|
} else {
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
|
|
1027
|
+
const U = i.dimensions[t], o = this.buildTimeDimensionExpression(
|
|
1028
|
+
U.sql,
|
|
1029
|
+
s.granularity,
|
|
1036
1030
|
A
|
|
1037
1031
|
);
|
|
1038
1032
|
I.push(o);
|
|
@@ -1051,18 +1045,18 @@ class AR {
|
|
|
1051
1045
|
...((I = E.timeDimensions) == null ? void 0 : I.map((N) => N.dimension)) || []
|
|
1052
1046
|
];
|
|
1053
1047
|
if (E.order && Object.keys(E.order).length > 0)
|
|
1054
|
-
for (const [N,
|
|
1048
|
+
for (const [N, e] of Object.entries(E.order)) {
|
|
1055
1049
|
if (!S.includes(N))
|
|
1056
1050
|
throw new Error(`Cannot order by '${N}': field is not selected in the query`);
|
|
1057
|
-
const
|
|
1058
|
-
A.push(
|
|
1051
|
+
const n = e === "desc" ? vT(r.identifier(N)) : bE(r.identifier(N));
|
|
1052
|
+
A.push(n);
|
|
1059
1053
|
}
|
|
1060
1054
|
if (E.timeDimensions && E.timeDimensions.length > 0) {
|
|
1061
|
-
const N = new Set(Object.keys(E.order || {})),
|
|
1062
|
-
(
|
|
1055
|
+
const N = new Set(Object.keys(E.order || {})), e = [...E.timeDimensions].sort(
|
|
1056
|
+
(n, O) => n.dimension.localeCompare(O.dimension)
|
|
1063
1057
|
);
|
|
1064
|
-
for (const
|
|
1065
|
-
N.has(
|
|
1058
|
+
for (const n of e)
|
|
1059
|
+
N.has(n.dimension) || A.push(bE(r.identifier(n.dimension)));
|
|
1066
1060
|
}
|
|
1067
1061
|
return A;
|
|
1068
1062
|
}
|
|
@@ -1074,9 +1068,9 @@ class AR {
|
|
|
1074
1068
|
const A = [], S = E instanceof Map ? E : /* @__PURE__ */ new Map([[E.name, E]]);
|
|
1075
1069
|
if (R.measures && A.push(...R.measures), R.dimensions)
|
|
1076
1070
|
for (const I of R.dimensions) {
|
|
1077
|
-
const [N,
|
|
1078
|
-
if (
|
|
1079
|
-
const O =
|
|
1071
|
+
const [N, e] = I.split("."), n = S.get(N);
|
|
1072
|
+
if (n) {
|
|
1073
|
+
const O = n.dimensions[e];
|
|
1080
1074
|
O && O.type === "number" && A.push(I);
|
|
1081
1075
|
}
|
|
1082
1076
|
}
|
|
@@ -1177,12 +1171,12 @@ class SR {
|
|
|
1177
1171
|
const S = this.analyzeCubeUsage(R), I = Array.from(S);
|
|
1178
1172
|
if (I.length === 0)
|
|
1179
1173
|
throw new Error("No cubes found in query");
|
|
1180
|
-
const N = this.choosePrimaryCube(I, R, E),
|
|
1181
|
-
if (!
|
|
1174
|
+
const N = this.choosePrimaryCube(I, R, E), e = E.get(N);
|
|
1175
|
+
if (!e)
|
|
1182
1176
|
throw new Error(`Primary cube '${N}' not found`);
|
|
1183
1177
|
if (I.length === 1)
|
|
1184
1178
|
return {
|
|
1185
|
-
primaryCube:
|
|
1179
|
+
primaryCube: e,
|
|
1186
1180
|
joinCubes: [],
|
|
1187
1181
|
// Empty for single cube
|
|
1188
1182
|
selections: {},
|
|
@@ -1192,10 +1186,10 @@ class SR {
|
|
|
1192
1186
|
groupByFields: []
|
|
1193
1187
|
// Will be built by QueryBuilder
|
|
1194
1188
|
};
|
|
1195
|
-
const
|
|
1189
|
+
const n = this.buildJoinPlan(E, e, I), O = this.planPreAggregationCTEs(E, e, n, R);
|
|
1196
1190
|
return {
|
|
1197
|
-
primaryCube:
|
|
1198
|
-
joinCubes:
|
|
1191
|
+
primaryCube: e,
|
|
1192
|
+
joinCubes: n,
|
|
1199
1193
|
selections: {},
|
|
1200
1194
|
// Will be built by QueryBuilder
|
|
1201
1195
|
whereConditions: [],
|
|
@@ -1215,22 +1209,22 @@ class SR {
|
|
|
1215
1209
|
for (const N of S)
|
|
1216
1210
|
I.set(N, (I.get(N) || 0) + 1);
|
|
1217
1211
|
if (I.size > 0) {
|
|
1218
|
-
const N = Math.max(...I.values()),
|
|
1219
|
-
for (const
|
|
1220
|
-
if (this.canReachAllCubes(
|
|
1221
|
-
return
|
|
1212
|
+
const N = Math.max(...I.values()), e = [...I.entries()].filter(([, n]) => n === N).map(([n]) => n).sort();
|
|
1213
|
+
for (const n of e)
|
|
1214
|
+
if (this.canReachAllCubes(n, E, A))
|
|
1215
|
+
return n;
|
|
1222
1216
|
}
|
|
1223
1217
|
}
|
|
1224
1218
|
if (A) {
|
|
1225
1219
|
const S = /* @__PURE__ */ new Map();
|
|
1226
1220
|
for (const I of E)
|
|
1227
1221
|
if (this.canReachAllCubes(I, E, A)) {
|
|
1228
|
-
const N = A.get(I),
|
|
1229
|
-
S.set(I,
|
|
1222
|
+
const N = A.get(I), e = N != null && N.joins ? Object.keys(N.joins).length : 0;
|
|
1223
|
+
S.set(I, e);
|
|
1230
1224
|
}
|
|
1231
1225
|
if (S.size > 0) {
|
|
1232
1226
|
const I = Math.max(...S.values());
|
|
1233
|
-
return [...S.entries()].filter(([
|
|
1227
|
+
return [...S.entries()].filter(([, e]) => e === I).map(([e]) => e).sort()[0];
|
|
1234
1228
|
}
|
|
1235
1229
|
}
|
|
1236
1230
|
return [...E].sort()[0];
|
|
@@ -1251,48 +1245,47 @@ class SR {
|
|
|
1251
1245
|
* Build join plan for multi-cube query
|
|
1252
1246
|
* Supports both direct joins and transitive joins through intermediate cubes
|
|
1253
1247
|
*/
|
|
1254
|
-
buildJoinPlan(E, R, A
|
|
1255
|
-
const
|
|
1256
|
-
for (const
|
|
1257
|
-
if (
|
|
1248
|
+
buildJoinPlan(E, R, A) {
|
|
1249
|
+
const S = [], I = /* @__PURE__ */ new Set([R.name]), N = A.filter((e) => e !== R.name);
|
|
1250
|
+
for (const e of N) {
|
|
1251
|
+
if (I.has(e))
|
|
1258
1252
|
continue;
|
|
1259
|
-
const
|
|
1260
|
-
if (!
|
|
1261
|
-
throw new Error(`No join path found from '${R.name}' to '${
|
|
1262
|
-
for (const {
|
|
1263
|
-
if (
|
|
1253
|
+
const n = this.findJoinPath(E, R.name, e, I);
|
|
1254
|
+
if (!n || n.length === 0)
|
|
1255
|
+
throw new Error(`No join path found from '${R.name}' to '${e}'`);
|
|
1256
|
+
for (const { toCube: O, joinDef: s } of n) {
|
|
1257
|
+
if (I.has(O))
|
|
1264
1258
|
continue;
|
|
1265
|
-
const
|
|
1266
|
-
if (!
|
|
1267
|
-
throw new Error(`Cube '${
|
|
1268
|
-
const
|
|
1259
|
+
const C = E.get(O);
|
|
1260
|
+
if (!C)
|
|
1261
|
+
throw new Error(`Cube '${O}' not found`);
|
|
1262
|
+
const t = this.buildJoinCondition(
|
|
1269
1263
|
s,
|
|
1270
1264
|
null,
|
|
1271
1265
|
// No source alias needed - use the actual column
|
|
1272
|
-
null
|
|
1266
|
+
null
|
|
1273
1267
|
// No target alias needed - use the actual column
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
}), N.add(e);
|
|
1268
|
+
), i = RR(s.relationship, s.sqlJoinType);
|
|
1269
|
+
S.push({
|
|
1270
|
+
cube: C,
|
|
1271
|
+
alias: `${O.toLowerCase()}_cube`,
|
|
1272
|
+
joinType: i,
|
|
1273
|
+
joinCondition: t
|
|
1274
|
+
}), I.add(O);
|
|
1282
1275
|
}
|
|
1283
1276
|
}
|
|
1284
|
-
return
|
|
1277
|
+
return S;
|
|
1285
1278
|
}
|
|
1286
1279
|
/**
|
|
1287
1280
|
* Build join condition from new array-based join definition
|
|
1288
1281
|
*/
|
|
1289
|
-
buildJoinCondition(E, R, A
|
|
1290
|
-
const
|
|
1291
|
-
for (const
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1282
|
+
buildJoinCondition(E, R, A) {
|
|
1283
|
+
const S = [];
|
|
1284
|
+
for (const I of E.on) {
|
|
1285
|
+
const N = R ? r`${r.identifier(R)}.${r.identifier(I.source.name)}` : I.source, e = A ? r`${r.identifier(A)}.${r.identifier(I.target.name)}` : I.target, n = I.as || mE;
|
|
1286
|
+
S.push(n(N, e));
|
|
1294
1287
|
}
|
|
1295
|
-
return d(...
|
|
1288
|
+
return d(...S);
|
|
1296
1289
|
}
|
|
1297
1290
|
/**
|
|
1298
1291
|
* Find join path from source cube to target cube
|
|
@@ -1305,20 +1298,20 @@ class SR {
|
|
|
1305
1298
|
{ cube: R, path: [] }
|
|
1306
1299
|
], N = /* @__PURE__ */ new Set([R, ...S]);
|
|
1307
1300
|
for (; I.length > 0; ) {
|
|
1308
|
-
const { cube:
|
|
1301
|
+
const { cube: e, path: n } = I.shift(), O = E.get(e);
|
|
1309
1302
|
if (O != null && O.joins)
|
|
1310
|
-
for (const [
|
|
1311
|
-
const
|
|
1312
|
-
if (N.has(
|
|
1303
|
+
for (const [, s] of Object.entries(O.joins)) {
|
|
1304
|
+
const t = gE(s.targetCube).name;
|
|
1305
|
+
if (N.has(t))
|
|
1313
1306
|
continue;
|
|
1314
|
-
const
|
|
1315
|
-
fromCube:
|
|
1316
|
-
toCube:
|
|
1317
|
-
joinDef:
|
|
1307
|
+
const i = [...n, {
|
|
1308
|
+
fromCube: e,
|
|
1309
|
+
toCube: t,
|
|
1310
|
+
joinDef: s
|
|
1318
1311
|
}];
|
|
1319
|
-
if (
|
|
1320
|
-
return
|
|
1321
|
-
N.add(
|
|
1312
|
+
if (t === A)
|
|
1313
|
+
return i;
|
|
1314
|
+
N.add(t), I.push({ cube: t, path: i });
|
|
1322
1315
|
}
|
|
1323
1316
|
}
|
|
1324
1317
|
return null;
|
|
@@ -1331,26 +1324,26 @@ class SR {
|
|
|
1331
1324
|
if (!S.measures || S.measures.length === 0)
|
|
1332
1325
|
return I;
|
|
1333
1326
|
for (const N of A) {
|
|
1334
|
-
const
|
|
1335
|
-
if (!
|
|
1327
|
+
const e = this.findHasManyJoinDef(R, N.cube.name);
|
|
1328
|
+
if (!e)
|
|
1336
1329
|
continue;
|
|
1337
|
-
const
|
|
1338
|
-
(
|
|
1339
|
-
) : [], O = this.extractMeasuresFromFilters(S, N.cube.name),
|
|
1340
|
-
if (
|
|
1330
|
+
const n = S.measures ? S.measures.filter(
|
|
1331
|
+
(t) => t.startsWith(N.cube.name + ".")
|
|
1332
|
+
) : [], O = this.extractMeasuresFromFilters(S, N.cube.name), s = [.../* @__PURE__ */ new Set([...n, ...O])];
|
|
1333
|
+
if (s.length === 0)
|
|
1341
1334
|
continue;
|
|
1342
|
-
const
|
|
1343
|
-
sourceColumn:
|
|
1344
|
-
targetColumn:
|
|
1345
|
-
sourceColumnObj:
|
|
1346
|
-
targetColumnObj:
|
|
1335
|
+
const C = e.on.map((t) => ({
|
|
1336
|
+
sourceColumn: t.source.name,
|
|
1337
|
+
targetColumn: t.target.name,
|
|
1338
|
+
sourceColumnObj: t.source,
|
|
1339
|
+
targetColumnObj: t.target
|
|
1347
1340
|
}));
|
|
1348
1341
|
I.push({
|
|
1349
1342
|
cube: N.cube,
|
|
1350
1343
|
alias: N.alias,
|
|
1351
1344
|
cteAlias: `${N.cube.name.toLowerCase()}_agg`,
|
|
1352
|
-
joinKeys:
|
|
1353
|
-
measures:
|
|
1345
|
+
joinKeys: C,
|
|
1346
|
+
measures: s
|
|
1354
1347
|
});
|
|
1355
1348
|
}
|
|
1356
1349
|
return I;
|
|
@@ -1361,9 +1354,9 @@ class SR {
|
|
|
1361
1354
|
findHasManyJoinDef(E, R) {
|
|
1362
1355
|
if (!E.joins)
|
|
1363
1356
|
return null;
|
|
1364
|
-
for (const [
|
|
1365
|
-
if (gE(
|
|
1366
|
-
return
|
|
1357
|
+
for (const [, A] of Object.entries(E.joins))
|
|
1358
|
+
if (gE(A.targetCube).name === R && A.relationship === "hasMany")
|
|
1359
|
+
return A;
|
|
1367
1360
|
return null;
|
|
1368
1361
|
}
|
|
1369
1362
|
}
|
|
@@ -1388,24 +1381,24 @@ class IE {
|
|
|
1388
1381
|
db: this.dbExecutor.db,
|
|
1389
1382
|
schema: this.dbExecutor.schema,
|
|
1390
1383
|
securityContext: A
|
|
1391
|
-
}, N = this.queryPlanner.createQueryPlan(E, R, I),
|
|
1392
|
-
const i = { ...
|
|
1384
|
+
}, N = this.queryPlanner.createQueryPlan(E, R, I), e = this.buildUnifiedQuery(N, R, I), n = this.queryBuilder.collectNumericFields(E, R), O = await this.dbExecutor.execute(e, n), s = Array.isArray(O) ? O.map((t) => {
|
|
1385
|
+
const i = { ...t };
|
|
1393
1386
|
if (R.timeDimensions) {
|
|
1394
1387
|
for (const a of R.timeDimensions)
|
|
1395
1388
|
if (a.dimension in i) {
|
|
1396
|
-
let
|
|
1397
|
-
if (typeof
|
|
1398
|
-
const o =
|
|
1399
|
-
|
|
1389
|
+
let U = i[a.dimension];
|
|
1390
|
+
if (typeof U == "string" && U.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)) {
|
|
1391
|
+
const o = U.replace(" ", "T"), G = !o.endsWith("Z") && !o.includes("+") ? o + "Z" : o;
|
|
1392
|
+
U = new Date(G);
|
|
1400
1393
|
}
|
|
1401
|
-
|
|
1394
|
+
U = this.databaseAdapter.convertTimeDimensionResult(U), i[a.dimension] = U;
|
|
1402
1395
|
}
|
|
1403
1396
|
}
|
|
1404
1397
|
return i;
|
|
1405
|
-
}) : [O],
|
|
1398
|
+
}) : [O], C = this.generateAnnotations(N, R);
|
|
1406
1399
|
return {
|
|
1407
|
-
data:
|
|
1408
|
-
annotation:
|
|
1400
|
+
data: s,
|
|
1401
|
+
annotation: C
|
|
1409
1402
|
};
|
|
1410
1403
|
} catch (S) {
|
|
1411
1404
|
throw new Error(`Query execution failed: ${S instanceof Error ? S.message : "Unknown error"}`);
|
|
@@ -1422,68 +1415,68 @@ class IE {
|
|
|
1422
1415
|
* Build pre-aggregation CTE for hasMany relationships
|
|
1423
1416
|
*/
|
|
1424
1417
|
buildPreAggregationCTE(E, R, A, S) {
|
|
1425
|
-
var
|
|
1426
|
-
const I = E.cube, N = I.sql(A),
|
|
1418
|
+
var U;
|
|
1419
|
+
const I = E.cube, N = I.sql(A), e = {};
|
|
1427
1420
|
for (const o of E.joinKeys)
|
|
1428
1421
|
if (o.targetColumnObj) {
|
|
1429
|
-
|
|
1422
|
+
e[o.targetColumn] = o.targetColumnObj;
|
|
1430
1423
|
for (const [G, P] of Object.entries(I.dimensions || {}))
|
|
1431
|
-
P.sql === o.targetColumnObj && G !== o.targetColumn && (
|
|
1424
|
+
P.sql === o.targetColumnObj && G !== o.targetColumn && (e[G] = r`${o.targetColumnObj}`.as(G));
|
|
1432
1425
|
}
|
|
1433
1426
|
for (const o of E.measures) {
|
|
1434
1427
|
const [, G] = o.split(".");
|
|
1435
1428
|
if (I.measures && I.measures[G]) {
|
|
1436
1429
|
const P = I.measures[G], H = this.queryBuilder.buildMeasureExpression(P, A);
|
|
1437
|
-
|
|
1430
|
+
e[G] = r`${H}`.as(G);
|
|
1438
1431
|
}
|
|
1439
1432
|
}
|
|
1440
|
-
const
|
|
1433
|
+
const n = I.name;
|
|
1441
1434
|
if (R.dimensions)
|
|
1442
1435
|
for (const o of R.dimensions) {
|
|
1443
1436
|
const [G, P] = o.split(".");
|
|
1444
|
-
if (G ===
|
|
1437
|
+
if (G === n && I.dimensions && I.dimensions[P]) {
|
|
1445
1438
|
const H = I.dimensions[P], l = this.queryBuilder.buildMeasureExpression({ sql: H.sql, type: "number" }, A);
|
|
1446
|
-
|
|
1439
|
+
e[P] = r`${l}`.as(P);
|
|
1447
1440
|
}
|
|
1448
1441
|
}
|
|
1449
1442
|
if (R.timeDimensions)
|
|
1450
1443
|
for (const o of R.timeDimensions) {
|
|
1451
1444
|
const [G, P] = o.dimension.split(".");
|
|
1452
|
-
if (G ===
|
|
1445
|
+
if (G === n && I.dimensions && I.dimensions[P]) {
|
|
1453
1446
|
const H = I.dimensions[P], l = this.queryBuilder.buildTimeDimensionExpression(H.sql, o.granularity, A);
|
|
1454
|
-
|
|
1447
|
+
e[P] = r`${l}`.as(P);
|
|
1455
1448
|
}
|
|
1456
1449
|
}
|
|
1457
|
-
if (Object.keys(
|
|
1450
|
+
if (Object.keys(e).length === 0)
|
|
1458
1451
|
return null;
|
|
1459
|
-
let O = A.db.select(
|
|
1460
|
-
const
|
|
1452
|
+
let O = A.db.select(e).from(N.from);
|
|
1453
|
+
const s = S ? {
|
|
1461
1454
|
...S,
|
|
1462
|
-
preAggregationCTEs: (
|
|
1463
|
-
} : void 0,
|
|
1455
|
+
preAggregationCTEs: (U = S.preAggregationCTEs) == null ? void 0 : U.filter((o) => o.cube.name !== I.name)
|
|
1456
|
+
} : void 0, C = this.queryBuilder.buildWhereConditions(I, R, A, s), t = [];
|
|
1464
1457
|
if (R.timeDimensions)
|
|
1465
1458
|
for (const o of R.timeDimensions) {
|
|
1466
1459
|
const [G, P] = o.dimension.split(".");
|
|
1467
|
-
if (G ===
|
|
1460
|
+
if (G === n && I.dimensions && I.dimensions[P] && o.dateRange) {
|
|
1468
1461
|
const H = I.dimensions[P], l = this.queryBuilder.buildMeasureExpression({ sql: H.sql, type: "number" }, A), B = this.queryBuilder.buildDateRangeCondition(l, o.dateRange);
|
|
1469
|
-
B &&
|
|
1462
|
+
B && t.push(B);
|
|
1470
1463
|
}
|
|
1471
1464
|
}
|
|
1472
1465
|
if (R.filters) {
|
|
1473
1466
|
for (const o of R.filters)
|
|
1474
1467
|
if (!("and" in o) && !("or" in o) && "member" in o && "operator" in o) {
|
|
1475
1468
|
const G = o, [P, H] = G.member.split(".");
|
|
1476
|
-
if (P ===
|
|
1469
|
+
if (P === n && I.dimensions && I.dimensions[H]) {
|
|
1477
1470
|
const l = I.dimensions[H];
|
|
1478
1471
|
if (G.operator === "inDateRange") {
|
|
1479
1472
|
const B = this.queryBuilder.buildMeasureExpression({ sql: l.sql, type: "number" }, A), u = this.queryBuilder.buildDateRangeCondition(B, G.values);
|
|
1480
|
-
u &&
|
|
1473
|
+
u && t.push(u);
|
|
1481
1474
|
}
|
|
1482
1475
|
}
|
|
1483
1476
|
}
|
|
1484
1477
|
}
|
|
1485
1478
|
const i = [];
|
|
1486
|
-
if (N.where && i.push(N.where), i.push(...
|
|
1479
|
+
if (N.where && i.push(N.where), i.push(...C, ...t), i.length > 0) {
|
|
1487
1480
|
const o = i.length === 1 ? i[0] : d(...i);
|
|
1488
1481
|
O = O.where(o);
|
|
1489
1482
|
}
|
|
@@ -1493,7 +1486,7 @@ class IE {
|
|
|
1493
1486
|
if (R.dimensions)
|
|
1494
1487
|
for (const o of R.dimensions) {
|
|
1495
1488
|
const [G, P] = o.split(".");
|
|
1496
|
-
if (G ===
|
|
1489
|
+
if (G === n && I.dimensions && I.dimensions[P]) {
|
|
1497
1490
|
const H = I.dimensions[P], l = K(H.sql, A);
|
|
1498
1491
|
a.push(l);
|
|
1499
1492
|
}
|
|
@@ -1501,7 +1494,7 @@ class IE {
|
|
|
1501
1494
|
if (R.timeDimensions)
|
|
1502
1495
|
for (const o of R.timeDimensions) {
|
|
1503
1496
|
const [G, P] = o.dimension.split(".");
|
|
1504
|
-
if (G ===
|
|
1497
|
+
if (G === n && I.dimensions && I.dimensions[P]) {
|
|
1505
1498
|
const H = I.dimensions[P], l = this.queryBuilder.buildTimeDimensionExpression(H.sql, o.granularity, A);
|
|
1506
1499
|
a.push(l);
|
|
1507
1500
|
}
|
|
@@ -1514,13 +1507,13 @@ class IE {
|
|
|
1514
1507
|
*/
|
|
1515
1508
|
buildCTEJoinCondition(E, R, A) {
|
|
1516
1509
|
var N;
|
|
1517
|
-
const S = (N = A.preAggregationCTEs) == null ? void 0 : N.find((
|
|
1510
|
+
const S = (N = A.preAggregationCTEs) == null ? void 0 : N.find((e) => e.cube.name === E.cube.name);
|
|
1518
1511
|
if (!S)
|
|
1519
1512
|
throw new Error(`CTE info not found for cube ${E.cube.name}`);
|
|
1520
1513
|
const I = [];
|
|
1521
|
-
for (const
|
|
1522
|
-
const
|
|
1523
|
-
I.push(mE(
|
|
1514
|
+
for (const e of S.joinKeys) {
|
|
1515
|
+
const n = e.sourceColumnObj || r.identifier(e.sourceColumn), O = r`${r.identifier(R)}.${r.identifier(e.targetColumn)}`;
|
|
1516
|
+
I.push(mE(n, O));
|
|
1524
1517
|
}
|
|
1525
1518
|
return I.length === 1 ? I[0] : d(...I);
|
|
1526
1519
|
}
|
|
@@ -1528,14 +1521,14 @@ class IE {
|
|
|
1528
1521
|
* Build unified query that works for both single and multi-cube queries
|
|
1529
1522
|
*/
|
|
1530
1523
|
buildUnifiedQuery(E, R, A) {
|
|
1531
|
-
var
|
|
1524
|
+
var U, o, G;
|
|
1532
1525
|
const S = [], I = /* @__PURE__ */ new Map();
|
|
1533
1526
|
if (E.preAggregationCTEs && E.preAggregationCTEs.length > 0)
|
|
1534
1527
|
for (const P of E.preAggregationCTEs) {
|
|
1535
1528
|
const H = this.buildPreAggregationCTE(P, R, A, E);
|
|
1536
1529
|
H && (S.push(H), I.set(P.cube.name, P.cteAlias));
|
|
1537
1530
|
}
|
|
1538
|
-
const N = E.primaryCube.sql(A),
|
|
1531
|
+
const N = E.primaryCube.sql(A), n = { ...this.queryBuilder.buildSelections(
|
|
1539
1532
|
E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
|
|
1540
1533
|
// Single cube
|
|
1541
1534
|
R,
|
|
@@ -1545,10 +1538,10 @@ class IE {
|
|
|
1545
1538
|
for (const P of E.preAggregationCTEs) {
|
|
1546
1539
|
const H = P.cube.name;
|
|
1547
1540
|
for (const l of P.measures)
|
|
1548
|
-
if (
|
|
1541
|
+
if (n[l]) {
|
|
1549
1542
|
const [, B] = l.split("."), u = this.getCubesFromPlan(E).get(H);
|
|
1550
1543
|
if (u && u.measures && u.measures[B]) {
|
|
1551
|
-
const p = u.measures[B], W =
|
|
1544
|
+
const p = u.measures[B], W = r`${r.identifier(P.cteAlias)}.${r.identifier(B)}`;
|
|
1552
1545
|
let h;
|
|
1553
1546
|
switch (p.type) {
|
|
1554
1547
|
case "count":
|
|
@@ -1571,26 +1564,26 @@ class IE {
|
|
|
1571
1564
|
default:
|
|
1572
1565
|
h = y(W);
|
|
1573
1566
|
}
|
|
1574
|
-
|
|
1567
|
+
n[l] = r`${h}`.as(l);
|
|
1575
1568
|
}
|
|
1576
1569
|
}
|
|
1577
|
-
for (const l in
|
|
1570
|
+
for (const l in n) {
|
|
1578
1571
|
const [B, u] = l.split(".");
|
|
1579
1572
|
if (B === H) {
|
|
1580
|
-
const p = this.getCubesFromPlan(E).get(H), W = p && ((
|
|
1573
|
+
const p = this.getCubesFromPlan(E).get(H), W = p && ((U = p.dimensions) == null ? void 0 : U[u]), h = l.startsWith(H + ".");
|
|
1581
1574
|
if (W || h) {
|
|
1582
1575
|
let RE = P.joinKeys.find((AE) => AE.targetColumn === u);
|
|
1583
1576
|
if (!RE && ((o = p == null ? void 0 : p.dimensions) != null && o[u])) {
|
|
1584
1577
|
const AE = p.dimensions[u].sql;
|
|
1585
1578
|
RE = P.joinKeys.find((WT) => WT.targetColumnObj === AE);
|
|
1586
1579
|
}
|
|
1587
|
-
RE ?
|
|
1580
|
+
RE ? n[l] = r`${r.identifier(P.cteAlias)}.${r.identifier(u)}`.as(l) : h && ((G = p == null ? void 0 : p.dimensions) != null && G[u]) && (n[l] = r`${r.identifier(P.cteAlias)}.${r.identifier(u)}`.as(l));
|
|
1588
1581
|
}
|
|
1589
1582
|
}
|
|
1590
1583
|
}
|
|
1591
1584
|
}
|
|
1592
|
-
let O = A.db.select(
|
|
1593
|
-
if (S.length > 0 && (O = A.db.with(...S).select(
|
|
1585
|
+
let O = A.db.select(n).from(N.from);
|
|
1586
|
+
if (S.length > 0 && (O = A.db.with(...S).select(n).from(N.from)), N.joins)
|
|
1594
1587
|
for (const P of N.joins)
|
|
1595
1588
|
switch (P.type || "left") {
|
|
1596
1589
|
case "left":
|
|
@@ -1610,7 +1603,7 @@ class IE {
|
|
|
1610
1603
|
for (const P of E.joinCubes) {
|
|
1611
1604
|
const H = I.get(P.cube.name);
|
|
1612
1605
|
let l, B;
|
|
1613
|
-
H ? (l =
|
|
1606
|
+
H ? (l = r`${r.identifier(H)}`, B = this.buildCTEJoinCondition(P, H, E)) : (l = P.cube.sql(A).from, B = P.joinCondition);
|
|
1614
1607
|
try {
|
|
1615
1608
|
switch (P.joinType || "left") {
|
|
1616
1609
|
case "left":
|
|
@@ -1629,15 +1622,15 @@ class IE {
|
|
|
1629
1622
|
} catch {
|
|
1630
1623
|
}
|
|
1631
1624
|
}
|
|
1632
|
-
const
|
|
1633
|
-
if (N.where &&
|
|
1625
|
+
const s = [];
|
|
1626
|
+
if (N.where && s.push(N.where), E.joinCubes && E.joinCubes.length > 0)
|
|
1634
1627
|
for (const P of E.joinCubes) {
|
|
1635
1628
|
if (I.get(P.cube.name))
|
|
1636
1629
|
continue;
|
|
1637
1630
|
const l = P.cube.sql(A);
|
|
1638
|
-
l.where &&
|
|
1631
|
+
l.where && s.push(l.where);
|
|
1639
1632
|
}
|
|
1640
|
-
const
|
|
1633
|
+
const C = this.queryBuilder.buildWhereConditions(
|
|
1641
1634
|
E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
|
|
1642
1635
|
// Single cube
|
|
1643
1636
|
R,
|
|
@@ -1645,11 +1638,11 @@ class IE {
|
|
|
1645
1638
|
E
|
|
1646
1639
|
// Pass the queryPlan to handle CTE scenarios
|
|
1647
1640
|
);
|
|
1648
|
-
if (
|
|
1649
|
-
const P =
|
|
1641
|
+
if (C.length > 0 && s.push(...C), s.length > 0) {
|
|
1642
|
+
const P = s.length === 1 ? s[0] : d(...s);
|
|
1650
1643
|
O = O.where(P);
|
|
1651
1644
|
}
|
|
1652
|
-
const
|
|
1645
|
+
const t = this.queryBuilder.buildGroupByFields(
|
|
1653
1646
|
E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
|
|
1654
1647
|
// Single cube
|
|
1655
1648
|
R,
|
|
@@ -1657,7 +1650,7 @@ class IE {
|
|
|
1657
1650
|
E
|
|
1658
1651
|
// Pass the queryPlan to handle CTE scenarios
|
|
1659
1652
|
);
|
|
1660
|
-
|
|
1653
|
+
t.length > 0 && (O = O.groupBy(...t));
|
|
1661
1654
|
const i = this.queryBuilder.buildHavingConditions(
|
|
1662
1655
|
E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
|
|
1663
1656
|
// Single cube
|
|
@@ -1704,10 +1697,10 @@ class IE {
|
|
|
1704
1697
|
db: this.dbExecutor.db,
|
|
1705
1698
|
schema: this.dbExecutor.schema,
|
|
1706
1699
|
securityContext: A
|
|
1707
|
-
}, I = this.queryPlanner.createQueryPlan(E, R, S),
|
|
1700
|
+
}, I = this.queryPlanner.createQueryPlan(E, R, S), e = this.buildUnifiedQuery(I, R, S).toSQL();
|
|
1708
1701
|
return {
|
|
1709
|
-
sql:
|
|
1710
|
-
params:
|
|
1702
|
+
sql: e.sql,
|
|
1703
|
+
params: e.params
|
|
1711
1704
|
};
|
|
1712
1705
|
}
|
|
1713
1706
|
/**
|
|
@@ -1715,40 +1708,40 @@ class IE {
|
|
|
1715
1708
|
*/
|
|
1716
1709
|
generateAnnotations(E, R) {
|
|
1717
1710
|
const A = {}, S = {}, I = {}, N = [E.primaryCube];
|
|
1718
|
-
if (E.joinCubes && E.joinCubes.length > 0 && N.push(...E.joinCubes.map((
|
|
1719
|
-
for (const
|
|
1720
|
-
const [
|
|
1721
|
-
if (
|
|
1722
|
-
const
|
|
1723
|
-
A[
|
|
1724
|
-
title:
|
|
1725
|
-
shortTitle:
|
|
1726
|
-
type:
|
|
1711
|
+
if (E.joinCubes && E.joinCubes.length > 0 && N.push(...E.joinCubes.map((e) => e.cube)), R.measures)
|
|
1712
|
+
for (const e of R.measures) {
|
|
1713
|
+
const [n, O] = e.split("."), s = N.find((C) => C.name === n);
|
|
1714
|
+
if (s && s.measures[O]) {
|
|
1715
|
+
const C = s.measures[O];
|
|
1716
|
+
A[e] = {
|
|
1717
|
+
title: C.title || O,
|
|
1718
|
+
shortTitle: C.title || O,
|
|
1719
|
+
type: C.type
|
|
1727
1720
|
};
|
|
1728
1721
|
}
|
|
1729
1722
|
}
|
|
1730
1723
|
if (R.dimensions)
|
|
1731
|
-
for (const
|
|
1732
|
-
const [
|
|
1733
|
-
if (
|
|
1734
|
-
const
|
|
1735
|
-
S[
|
|
1736
|
-
title:
|
|
1737
|
-
shortTitle:
|
|
1738
|
-
type:
|
|
1724
|
+
for (const e of R.dimensions) {
|
|
1725
|
+
const [n, O] = e.split("."), s = N.find((C) => C.name === n);
|
|
1726
|
+
if (s && s.dimensions[O]) {
|
|
1727
|
+
const C = s.dimensions[O];
|
|
1728
|
+
S[e] = {
|
|
1729
|
+
title: C.title || O,
|
|
1730
|
+
shortTitle: C.title || O,
|
|
1731
|
+
type: C.type
|
|
1739
1732
|
};
|
|
1740
1733
|
}
|
|
1741
1734
|
}
|
|
1742
1735
|
if (R.timeDimensions)
|
|
1743
|
-
for (const
|
|
1744
|
-
const [
|
|
1745
|
-
if (
|
|
1746
|
-
const
|
|
1747
|
-
I[
|
|
1748
|
-
title:
|
|
1749
|
-
shortTitle:
|
|
1750
|
-
type:
|
|
1751
|
-
granularity:
|
|
1736
|
+
for (const e of R.timeDimensions) {
|
|
1737
|
+
const [n, O] = e.dimension.split("."), s = N.find((C) => C.name === n);
|
|
1738
|
+
if (s && s.dimensions && s.dimensions[O]) {
|
|
1739
|
+
const C = s.dimensions[O];
|
|
1740
|
+
I[e.dimension] = {
|
|
1741
|
+
title: C.title || O,
|
|
1742
|
+
shortTitle: C.title || O,
|
|
1743
|
+
type: C.type,
|
|
1744
|
+
granularity: e.granularity
|
|
1752
1745
|
};
|
|
1753
1746
|
}
|
|
1754
1747
|
}
|
|
@@ -17273,7 +17266,7 @@ const YS = [
|
|
|
17273
17266
|
"[": "]",
|
|
17274
17267
|
"(": ")",
|
|
17275
17268
|
"{": "}"
|
|
17276
|
-
}, E = "{left}(?:(?!{right}').)*?{right}", R = Object.entries(T).map(([N,
|
|
17269
|
+
}, E = "{left}(?:(?!{right}').)*?{right}", R = Object.entries(T).map(([N, e]) => E.replace(/{left}/g, V(N)).replace(/{right}/g, V(e))), A = V(Object.keys(T).join(""));
|
|
17277
17270
|
return `[Qq]'(?:${String.raw`(?<tag>[^\s${A}])(?:(?!\k<tag>').)*?\k<tag>`}|${R.join("|")})'`;
|
|
17278
17271
|
}, _T = {
|
|
17279
17272
|
// - backtick quoted (using `` to escape)
|
|
@@ -17301,8 +17294,8 @@ const YS = [
|
|
|
17301
17294
|
// Oracle q'' strings: q'<text>' q'|text|' ...
|
|
17302
17295
|
"q''": fI()
|
|
17303
17296
|
}, cT = (T) => typeof T == "string" ? _T[T] : "regex" in T ? T.regex : dI(T) + _T[T.quote], WI = (T) => g(T.map((E) => "regex" in E ? E.regex : cT(E)).join("|")), lT = (T) => T.map(cT).join("|"), rT = (T) => g(lT(T)), XI = (T = {}) => g(HT(T)), HT = ({ first: T, rest: E, dashes: R, allowFirstCharNumber: A } = {}) => {
|
|
17304
|
-
const S = "\\p{Alphabetic}\\p{Mark}_", I = "\\p{Decimal_Number}", N = V(T ?? ""),
|
|
17305
|
-
return R ? pI(
|
|
17297
|
+
const S = "\\p{Alphabetic}\\p{Mark}_", I = "\\p{Decimal_Number}", N = V(T ?? ""), e = V(E ?? ""), n = A ? `[${S}${I}${N}][${S}${I}${e}]*` : `[${S}${N}][${S}${I}${e}]*`;
|
|
17298
|
+
return R ? pI(n) : n;
|
|
17306
17299
|
};
|
|
17307
17300
|
function BT(T, E) {
|
|
17308
17301
|
const R = T.slice(0, E).split(/\n/);
|
|
@@ -17586,43 +17579,43 @@ class gI {
|
|
|
17586
17579
|
// These rules can't be blindly cached as the paramTypesOverrides object
|
|
17587
17580
|
// can differ on each invocation of the format() function.
|
|
17588
17581
|
buildParamRules(E, R) {
|
|
17589
|
-
var A, S, I, N,
|
|
17590
|
-
const
|
|
17582
|
+
var A, S, I, N, e;
|
|
17583
|
+
const n = {
|
|
17591
17584
|
named: (R == null ? void 0 : R.named) || ((A = E.paramTypes) === null || A === void 0 ? void 0 : A.named) || [],
|
|
17592
17585
|
quoted: (R == null ? void 0 : R.quoted) || ((S = E.paramTypes) === null || S === void 0 ? void 0 : S.quoted) || [],
|
|
17593
17586
|
numbered: (R == null ? void 0 : R.numbered) || ((I = E.paramTypes) === null || I === void 0 ? void 0 : I.numbered) || [],
|
|
17594
17587
|
positional: typeof (R == null ? void 0 : R.positional) == "boolean" ? R.positional : (N = E.paramTypes) === null || N === void 0 ? void 0 : N.positional,
|
|
17595
|
-
custom: (R == null ? void 0 : R.custom) || ((
|
|
17588
|
+
custom: (R == null ? void 0 : R.custom) || ((e = E.paramTypes) === null || e === void 0 ? void 0 : e.custom) || []
|
|
17596
17589
|
};
|
|
17597
17590
|
return this.validRules([
|
|
17598
17591
|
{
|
|
17599
17592
|
type: D.NAMED_PARAMETER,
|
|
17600
|
-
regex: lE(
|
|
17593
|
+
regex: lE(n.named, HT(E.paramChars || E.identChars)),
|
|
17601
17594
|
key: (O) => O.slice(1)
|
|
17602
17595
|
},
|
|
17603
17596
|
{
|
|
17604
17597
|
type: D.QUOTED_PARAMETER,
|
|
17605
|
-
regex: lE(
|
|
17606
|
-
key: (O) => (({ tokenKey:
|
|
17598
|
+
regex: lE(n.quoted, lT(E.identTypes)),
|
|
17599
|
+
key: (O) => (({ tokenKey: s, quoteChar: C }) => s.replace(new RegExp(V("\\" + C), "gu"), C))({
|
|
17607
17600
|
tokenKey: O.slice(2, -1),
|
|
17608
17601
|
quoteChar: O.slice(-1)
|
|
17609
17602
|
})
|
|
17610
17603
|
},
|
|
17611
17604
|
{
|
|
17612
17605
|
type: D.NUMBERED_PARAMETER,
|
|
17613
|
-
regex: lE(
|
|
17606
|
+
regex: lE(n.numbered, "[0-9]+"),
|
|
17614
17607
|
key: (O) => O.slice(1)
|
|
17615
17608
|
},
|
|
17616
17609
|
{
|
|
17617
17610
|
type: D.POSITIONAL_PARAMETER,
|
|
17618
|
-
regex:
|
|
17611
|
+
regex: n.positional ? /[?]/y : void 0
|
|
17619
17612
|
},
|
|
17620
|
-
...
|
|
17621
|
-
var
|
|
17613
|
+
...n.custom.map((O) => {
|
|
17614
|
+
var s;
|
|
17622
17615
|
return {
|
|
17623
17616
|
type: D.CUSTOM_PARAMETER,
|
|
17624
17617
|
regex: g(O.regex),
|
|
17625
|
-
key: (
|
|
17618
|
+
key: (s = O.key) !== null && s !== void 0 ? s : (C) => C
|
|
17626
17619
|
};
|
|
17627
17620
|
})
|
|
17628
17621
|
]);
|
|
@@ -17684,40 +17677,40 @@ var uT = { exports: {} };
|
|
|
17684
17677
|
(function(E, R) {
|
|
17685
17678
|
T.exports ? T.exports = R() : E.nearley = R();
|
|
17686
17679
|
})(ZI, function() {
|
|
17687
|
-
function E(O,
|
|
17688
|
-
return this.id = ++E.highestId, this.name = O, this.symbols =
|
|
17680
|
+
function E(O, s, C) {
|
|
17681
|
+
return this.id = ++E.highestId, this.name = O, this.symbols = s, this.postprocess = C, this;
|
|
17689
17682
|
}
|
|
17690
17683
|
E.highestId = 0, E.prototype.toString = function(O) {
|
|
17691
|
-
var
|
|
17692
|
-
return this.name + " → " +
|
|
17684
|
+
var s = typeof O > "u" ? this.symbols.map(n).join(" ") : this.symbols.slice(0, O).map(n).join(" ") + " ● " + this.symbols.slice(O).map(n).join(" ");
|
|
17685
|
+
return this.name + " → " + s;
|
|
17693
17686
|
};
|
|
17694
|
-
function R(O,
|
|
17695
|
-
this.rule = O, this.dot =
|
|
17687
|
+
function R(O, s, C, t) {
|
|
17688
|
+
this.rule = O, this.dot = s, this.reference = C, this.data = [], this.wantedBy = t, this.isComplete = this.dot === O.symbols.length;
|
|
17696
17689
|
}
|
|
17697
17690
|
R.prototype.toString = function() {
|
|
17698
17691
|
return "{" + this.rule.toString(this.dot) + "}, from: " + (this.reference || 0);
|
|
17699
17692
|
}, R.prototype.nextState = function(O) {
|
|
17700
|
-
var
|
|
17701
|
-
return
|
|
17693
|
+
var s = new R(this.rule, this.dot + 1, this.reference, this.wantedBy);
|
|
17694
|
+
return s.left = this, s.right = O, s.isComplete && (s.data = s.build(), s.right = void 0), s;
|
|
17702
17695
|
}, R.prototype.build = function() {
|
|
17703
|
-
var O = [],
|
|
17696
|
+
var O = [], s = this;
|
|
17704
17697
|
do
|
|
17705
|
-
O.push(
|
|
17706
|
-
while (
|
|
17698
|
+
O.push(s.right.data), s = s.left;
|
|
17699
|
+
while (s.left);
|
|
17707
17700
|
return O.reverse(), O;
|
|
17708
17701
|
}, R.prototype.finish = function() {
|
|
17709
17702
|
this.rule.postprocess && (this.data = this.rule.postprocess(this.data, this.reference, N.fail));
|
|
17710
17703
|
};
|
|
17711
|
-
function A(O,
|
|
17712
|
-
this.grammar = O, this.index =
|
|
17704
|
+
function A(O, s) {
|
|
17705
|
+
this.grammar = O, this.index = s, this.states = [], this.wants = {}, this.scannable = [], this.completed = {};
|
|
17713
17706
|
}
|
|
17714
17707
|
A.prototype.process = function(O) {
|
|
17715
|
-
for (var
|
|
17716
|
-
var a =
|
|
17708
|
+
for (var s = this.states, C = this.wants, t = this.completed, i = 0; i < s.length; i++) {
|
|
17709
|
+
var a = s[i];
|
|
17717
17710
|
if (a.isComplete) {
|
|
17718
17711
|
if (a.finish(), a.data !== N.fail) {
|
|
17719
|
-
for (var
|
|
17720
|
-
var G =
|
|
17712
|
+
for (var U = a.wantedBy, o = U.length; o--; ) {
|
|
17713
|
+
var G = U[o];
|
|
17721
17714
|
this.complete(G, a);
|
|
17722
17715
|
}
|
|
17723
17716
|
if (a.reference === this.index) {
|
|
@@ -17731,45 +17724,45 @@ var uT = { exports: {} };
|
|
|
17731
17724
|
this.scannable.push(a);
|
|
17732
17725
|
continue;
|
|
17733
17726
|
}
|
|
17734
|
-
if (
|
|
17735
|
-
if (
|
|
17736
|
-
for (var H =
|
|
17727
|
+
if (C[P]) {
|
|
17728
|
+
if (C[P].push(a), t.hasOwnProperty(P))
|
|
17729
|
+
for (var H = t[P], o = 0; o < H.length; o++) {
|
|
17737
17730
|
var l = H[o];
|
|
17738
17731
|
this.complete(a, l);
|
|
17739
17732
|
}
|
|
17740
17733
|
} else
|
|
17741
|
-
|
|
17734
|
+
C[P] = [a], this.predict(P);
|
|
17742
17735
|
}
|
|
17743
17736
|
}
|
|
17744
17737
|
}, A.prototype.predict = function(O) {
|
|
17745
|
-
for (var
|
|
17746
|
-
var
|
|
17738
|
+
for (var s = this.grammar.byName[O] || [], C = 0; C < s.length; C++) {
|
|
17739
|
+
var t = s[C], i = this.wants[O], a = new R(t, 0, this.index, i);
|
|
17747
17740
|
this.states.push(a);
|
|
17748
17741
|
}
|
|
17749
|
-
}, A.prototype.complete = function(O,
|
|
17750
|
-
var
|
|
17751
|
-
this.states.push(
|
|
17742
|
+
}, A.prototype.complete = function(O, s) {
|
|
17743
|
+
var C = O.nextState(s);
|
|
17744
|
+
this.states.push(C);
|
|
17752
17745
|
};
|
|
17753
|
-
function S(O,
|
|
17754
|
-
this.rules = O, this.start =
|
|
17755
|
-
var
|
|
17756
|
-
this.rules.forEach(function(
|
|
17757
|
-
|
|
17746
|
+
function S(O, s) {
|
|
17747
|
+
this.rules = O, this.start = s || this.rules[0].name;
|
|
17748
|
+
var C = this.byName = {};
|
|
17749
|
+
this.rules.forEach(function(t) {
|
|
17750
|
+
C.hasOwnProperty(t.name) || (C[t.name] = []), C[t.name].push(t);
|
|
17758
17751
|
});
|
|
17759
17752
|
}
|
|
17760
|
-
S.fromCompiled = function(
|
|
17761
|
-
var
|
|
17762
|
-
|
|
17763
|
-
var
|
|
17753
|
+
S.fromCompiled = function(t, s) {
|
|
17754
|
+
var C = t.Lexer;
|
|
17755
|
+
t.ParserStart && (s = t.ParserStart, t = t.ParserRules);
|
|
17756
|
+
var t = t.map(function(a) {
|
|
17764
17757
|
return new E(a.name, a.symbols, a.postprocess);
|
|
17765
|
-
}), i = new S(
|
|
17766
|
-
return i.lexer =
|
|
17758
|
+
}), i = new S(t, s);
|
|
17759
|
+
return i.lexer = C, i;
|
|
17767
17760
|
};
|
|
17768
17761
|
function I() {
|
|
17769
17762
|
this.reset("");
|
|
17770
17763
|
}
|
|
17771
|
-
I.prototype.reset = function(O,
|
|
17772
|
-
this.buffer = O, this.index = 0, this.line =
|
|
17764
|
+
I.prototype.reset = function(O, s) {
|
|
17765
|
+
this.buffer = O, this.index = 0, this.line = s ? s.line : 1, this.lastLineBreak = s ? -s.col : 0;
|
|
17773
17766
|
}, I.prototype.next = function() {
|
|
17774
17767
|
if (this.index < this.buffer.length) {
|
|
17775
17768
|
var O = this.buffer[this.index++];
|
|
@@ -17781,144 +17774,144 @@ var uT = { exports: {} };
|
|
|
17781
17774
|
line: this.line,
|
|
17782
17775
|
col: this.index - this.lastLineBreak
|
|
17783
17776
|
};
|
|
17784
|
-
}, I.prototype.formatError = function(O,
|
|
17785
|
-
var
|
|
17786
|
-
if (typeof
|
|
17787
|
-
var
|
|
17777
|
+
}, I.prototype.formatError = function(O, s) {
|
|
17778
|
+
var C = this.buffer;
|
|
17779
|
+
if (typeof C == "string") {
|
|
17780
|
+
var t = C.split(`
|
|
17788
17781
|
`).slice(
|
|
17789
17782
|
Math.max(0, this.line - 5),
|
|
17790
17783
|
this.line
|
|
17791
|
-
), i =
|
|
17784
|
+
), i = C.indexOf(`
|
|
17792
17785
|
`, this.index);
|
|
17793
|
-
i === -1 && (i =
|
|
17794
|
-
var a = this.index - this.lastLineBreak,
|
|
17795
|
-
return
|
|
17786
|
+
i === -1 && (i = C.length);
|
|
17787
|
+
var a = this.index - this.lastLineBreak, U = String(this.line).length;
|
|
17788
|
+
return s += " at line " + this.line + " col " + a + `:
|
|
17796
17789
|
|
|
17797
|
-
`,
|
|
17798
|
-
return o(this.line -
|
|
17790
|
+
`, s += t.map(function(G, P) {
|
|
17791
|
+
return o(this.line - t.length + P + 1, U) + " " + G;
|
|
17799
17792
|
}, this).join(`
|
|
17800
|
-
`),
|
|
17801
|
-
` + o("",
|
|
17802
|
-
`,
|
|
17793
|
+
`), s += `
|
|
17794
|
+
` + o("", U + a) + `^
|
|
17795
|
+
`, s;
|
|
17803
17796
|
} else
|
|
17804
|
-
return
|
|
17797
|
+
return s + " at index " + (this.index - 1);
|
|
17805
17798
|
function o(G, P) {
|
|
17806
17799
|
var H = String(G);
|
|
17807
17800
|
return Array(P - H.length + 1).join(" ") + H;
|
|
17808
17801
|
}
|
|
17809
17802
|
};
|
|
17810
|
-
function N(O,
|
|
17803
|
+
function N(O, s, C) {
|
|
17811
17804
|
if (O instanceof S)
|
|
17812
|
-
var
|
|
17805
|
+
var t = O, C = s;
|
|
17813
17806
|
else
|
|
17814
|
-
var
|
|
17815
|
-
this.grammar =
|
|
17807
|
+
var t = S.fromCompiled(O, s);
|
|
17808
|
+
this.grammar = t, this.options = {
|
|
17816
17809
|
keepHistory: !1,
|
|
17817
|
-
lexer:
|
|
17810
|
+
lexer: t.lexer || new I()
|
|
17818
17811
|
};
|
|
17819
|
-
for (var i in
|
|
17820
|
-
this.options[i] =
|
|
17812
|
+
for (var i in C || {})
|
|
17813
|
+
this.options[i] = C[i];
|
|
17821
17814
|
this.lexer = this.options.lexer, this.lexerState = void 0;
|
|
17822
|
-
var a = new A(
|
|
17823
|
-
this.table = [a], a.wants[
|
|
17815
|
+
var a = new A(t, 0);
|
|
17816
|
+
this.table = [a], a.wants[t.start] = [], a.predict(t.start), a.process(), this.current = 0;
|
|
17824
17817
|
}
|
|
17825
17818
|
N.fail = {}, N.prototype.feed = function(O) {
|
|
17826
|
-
var
|
|
17827
|
-
|
|
17828
|
-
for (var
|
|
17819
|
+
var s = this.lexer;
|
|
17820
|
+
s.reset(O, this.lexerState);
|
|
17821
|
+
for (var C; ; ) {
|
|
17829
17822
|
try {
|
|
17830
|
-
if (
|
|
17823
|
+
if (C = s.next(), !C)
|
|
17831
17824
|
break;
|
|
17832
17825
|
} catch (p) {
|
|
17833
|
-
var
|
|
17834
|
-
this.table.push(
|
|
17835
|
-
var
|
|
17836
|
-
throw
|
|
17826
|
+
var U = new A(this.grammar, this.current + 1);
|
|
17827
|
+
this.table.push(U);
|
|
17828
|
+
var t = new Error(this.reportLexerError(p));
|
|
17829
|
+
throw t.offset = this.current, t.token = p.token, t;
|
|
17837
17830
|
}
|
|
17838
17831
|
var i = this.table[this.current];
|
|
17839
17832
|
this.options.keepHistory || delete this.table[this.current - 1];
|
|
17840
|
-
var a = this.current + 1,
|
|
17841
|
-
this.table.push(
|
|
17842
|
-
for (var o =
|
|
17833
|
+
var a = this.current + 1, U = new A(this.grammar, a);
|
|
17834
|
+
this.table.push(U);
|
|
17835
|
+
for (var o = C.text !== void 0 ? C.text : C.value, G = s.constructor === I ? C.value : C, P = i.scannable, H = P.length; H--; ) {
|
|
17843
17836
|
var l = P[H], B = l.rule.symbols[l.dot];
|
|
17844
|
-
if (B.test ? B.test(G) : B.type ? B.type ===
|
|
17845
|
-
var u = l.nextState({ data: G, token:
|
|
17846
|
-
|
|
17837
|
+
if (B.test ? B.test(G) : B.type ? B.type === C.type : B.literal === o) {
|
|
17838
|
+
var u = l.nextState({ data: G, token: C, isToken: !0, reference: a - 1 });
|
|
17839
|
+
U.states.push(u);
|
|
17847
17840
|
}
|
|
17848
17841
|
}
|
|
17849
|
-
if (
|
|
17850
|
-
var
|
|
17851
|
-
throw
|
|
17842
|
+
if (U.process(), U.states.length === 0) {
|
|
17843
|
+
var t = new Error(this.reportError(C));
|
|
17844
|
+
throw t.offset = this.current, t.token = C, t;
|
|
17852
17845
|
}
|
|
17853
|
-
this.options.keepHistory && (i.lexerState =
|
|
17846
|
+
this.options.keepHistory && (i.lexerState = s.save()), this.current++;
|
|
17854
17847
|
}
|
|
17855
|
-
return i && (this.lexerState =
|
|
17848
|
+
return i && (this.lexerState = s.save()), this.results = this.finish(), this;
|
|
17856
17849
|
}, N.prototype.reportLexerError = function(O) {
|
|
17857
|
-
var
|
|
17858
|
-
return
|
|
17850
|
+
var s, C, t = O.token;
|
|
17851
|
+
return t ? (s = "input " + JSON.stringify(t.text[0]) + " (lexer error)", C = this.lexer.formatError(t, "Syntax error")) : (s = "input (lexer error)", C = O.message), this.reportErrorCommon(C, s);
|
|
17859
17852
|
}, N.prototype.reportError = function(O) {
|
|
17860
|
-
var
|
|
17861
|
-
return this.reportErrorCommon(
|
|
17862
|
-
}, N.prototype.reportErrorCommon = function(O,
|
|
17863
|
-
var
|
|
17864
|
-
|
|
17865
|
-
var
|
|
17853
|
+
var s = (O.type ? O.type + " token: " : "") + JSON.stringify(O.value !== void 0 ? O.value : O), C = this.lexer.formatError(O, "Syntax error");
|
|
17854
|
+
return this.reportErrorCommon(C, s);
|
|
17855
|
+
}, N.prototype.reportErrorCommon = function(O, s) {
|
|
17856
|
+
var C = [];
|
|
17857
|
+
C.push(O);
|
|
17858
|
+
var t = this.table.length - 2, i = this.table[t], a = i.states.filter(function(o) {
|
|
17866
17859
|
var G = o.rule.symbols[o.dot];
|
|
17867
17860
|
return G && typeof G != "string";
|
|
17868
17861
|
});
|
|
17869
17862
|
if (a.length === 0)
|
|
17870
|
-
|
|
17871
|
-
`), this.displayStateStack(i.states,
|
|
17863
|
+
C.push("Unexpected " + s + `. I did not expect any more input. Here is the state of my parse table:
|
|
17864
|
+
`), this.displayStateStack(i.states, C);
|
|
17872
17865
|
else {
|
|
17873
|
-
|
|
17866
|
+
C.push("Unexpected " + s + `. Instead, I was expecting to see one of the following:
|
|
17874
17867
|
`);
|
|
17875
|
-
var
|
|
17868
|
+
var U = a.map(function(o) {
|
|
17876
17869
|
return this.buildFirstStateStack(o, []) || [o];
|
|
17877
17870
|
}, this);
|
|
17878
|
-
|
|
17871
|
+
U.forEach(function(o) {
|
|
17879
17872
|
var G = o[0], P = G.rule.symbols[G.dot], H = this.getSymbolDisplay(P);
|
|
17880
|
-
|
|
17873
|
+
C.push("A " + H + " based on:"), this.displayStateStack(o, C);
|
|
17881
17874
|
}, this);
|
|
17882
17875
|
}
|
|
17883
|
-
return
|
|
17876
|
+
return C.push(""), C.join(`
|
|
17884
17877
|
`);
|
|
17885
|
-
}, N.prototype.displayStateStack = function(O,
|
|
17886
|
-
for (var
|
|
17887
|
-
var a = O[i],
|
|
17888
|
-
|
|
17878
|
+
}, N.prototype.displayStateStack = function(O, s) {
|
|
17879
|
+
for (var C, t = 0, i = 0; i < O.length; i++) {
|
|
17880
|
+
var a = O[i], U = a.rule.toString(a.dot);
|
|
17881
|
+
U === C ? t++ : (t > 0 && s.push(" ^ " + t + " more lines identical to this"), t = 0, s.push(" " + U)), C = U;
|
|
17889
17882
|
}
|
|
17890
17883
|
}, N.prototype.getSymbolDisplay = function(O) {
|
|
17891
|
-
return
|
|
17892
|
-
}, N.prototype.buildFirstStateStack = function(O,
|
|
17893
|
-
if (
|
|
17884
|
+
return e(O);
|
|
17885
|
+
}, N.prototype.buildFirstStateStack = function(O, s) {
|
|
17886
|
+
if (s.indexOf(O) !== -1)
|
|
17894
17887
|
return null;
|
|
17895
17888
|
if (O.wantedBy.length === 0)
|
|
17896
17889
|
return [O];
|
|
17897
|
-
var
|
|
17890
|
+
var C = O.wantedBy[0], t = [O].concat(s), i = this.buildFirstStateStack(C, t);
|
|
17898
17891
|
return i === null ? null : [O].concat(i);
|
|
17899
17892
|
}, N.prototype.save = function() {
|
|
17900
17893
|
var O = this.table[this.current];
|
|
17901
17894
|
return O.lexerState = this.lexerState, O;
|
|
17902
17895
|
}, N.prototype.restore = function(O) {
|
|
17903
|
-
var
|
|
17904
|
-
this.current =
|
|
17896
|
+
var s = O.index;
|
|
17897
|
+
this.current = s, this.table[s] = O, this.table.splice(s + 1), this.lexerState = O.lexerState, this.results = this.finish();
|
|
17905
17898
|
}, N.prototype.rewind = function(O) {
|
|
17906
17899
|
if (!this.options.keepHistory)
|
|
17907
17900
|
throw new Error("set option `keepHistory` to enable rewinding");
|
|
17908
17901
|
this.restore(this.table[O]);
|
|
17909
17902
|
}, N.prototype.finish = function() {
|
|
17910
|
-
var O = [],
|
|
17911
|
-
return
|
|
17912
|
-
|
|
17913
|
-
}), O.map(function(
|
|
17914
|
-
return
|
|
17903
|
+
var O = [], s = this.grammar.start, C = this.table[this.table.length - 1];
|
|
17904
|
+
return C.states.forEach(function(t) {
|
|
17905
|
+
t.rule.name === s && t.dot === t.rule.symbols.length && t.reference === 0 && t.data !== N.fail && O.push(t);
|
|
17906
|
+
}), O.map(function(t) {
|
|
17907
|
+
return t.data;
|
|
17915
17908
|
});
|
|
17916
17909
|
};
|
|
17917
|
-
function
|
|
17918
|
-
var
|
|
17919
|
-
if (
|
|
17910
|
+
function e(O) {
|
|
17911
|
+
var s = typeof O;
|
|
17912
|
+
if (s === "string")
|
|
17920
17913
|
return O;
|
|
17921
|
-
if (
|
|
17914
|
+
if (s === "object") {
|
|
17922
17915
|
if (O.literal)
|
|
17923
17916
|
return JSON.stringify(O.literal);
|
|
17924
17917
|
if (O instanceof RegExp)
|
|
@@ -17930,11 +17923,11 @@ var uT = { exports: {} };
|
|
|
17930
17923
|
throw new Error("Unknown symbol type: " + O);
|
|
17931
17924
|
}
|
|
17932
17925
|
}
|
|
17933
|
-
function
|
|
17934
|
-
var
|
|
17935
|
-
if (
|
|
17926
|
+
function n(O) {
|
|
17927
|
+
var s = typeof O;
|
|
17928
|
+
if (s === "string")
|
|
17936
17929
|
return O;
|
|
17937
|
-
if (
|
|
17930
|
+
if (s === "object") {
|
|
17938
17931
|
if (O.literal)
|
|
17939
17932
|
return JSON.stringify(O.literal);
|
|
17940
17933
|
if (O instanceof RegExp)
|
|
@@ -18022,20 +18015,20 @@ class mT {
|
|
|
18022
18015
|
return E in D;
|
|
18023
18016
|
}
|
|
18024
18017
|
}
|
|
18025
|
-
var
|
|
18018
|
+
var M;
|
|
18026
18019
|
(function(T) {
|
|
18027
18020
|
T.statement = "statement", T.clause = "clause", T.set_operation = "set_operation", T.function_call = "function_call", T.parameterized_data_type = "parameterized_data_type", T.array_subscript = "array_subscript", T.property_access = "property_access", T.parenthesis = "parenthesis", T.between_predicate = "between_predicate", T.case_expression = "case_expression", T.case_when = "case_when", T.case_else = "case_else", T.limit_clause = "limit_clause", T.all_columns_asterisk = "all_columns_asterisk", T.literal = "literal", T.identifier = "identifier", T.keyword = "keyword", T.data_type = "data_type", T.parameter = "parameter", T.operator = "operator", T.comma = "comma", T.line_comment = "line_comment", T.block_comment = "block_comment", T.disable_comment = "disable_comment";
|
|
18028
|
-
})(
|
|
18021
|
+
})(M = M || (M = {}));
|
|
18029
18022
|
function HE(T) {
|
|
18030
18023
|
return T[0];
|
|
18031
18024
|
}
|
|
18032
18025
|
const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
18033
|
-
type:
|
|
18026
|
+
type: M.keyword,
|
|
18034
18027
|
tokenType: T.type,
|
|
18035
18028
|
text: T.text,
|
|
18036
18029
|
raw: T.raw
|
|
18037
18030
|
}), iT = (T) => ({
|
|
18038
|
-
type:
|
|
18031
|
+
type: M.data_type,
|
|
18039
18032
|
text: T.text,
|
|
18040
18033
|
raw: T.raw
|
|
18041
18034
|
}), m = (T, { leading: E, trailing: R }) => (E != null && E.length && (T = Object.assign(Object.assign({}, T), { leadingComments: E })), R != null && R.length && (T = Object.assign(Object.assign({}, T), { trailingComments: R })), T), NO = (T, { leading: E, trailing: R }) => {
|
|
@@ -18067,7 +18060,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18067
18060
|
name: "statement",
|
|
18068
18061
|
symbols: ["expressions_or_clauses", "statement$subexpression$1"],
|
|
18069
18062
|
postprocess: ([T, [E]]) => ({
|
|
18070
|
-
type:
|
|
18063
|
+
type: M.statement,
|
|
18071
18064
|
children: T,
|
|
18072
18065
|
hasSemicolon: E.type === D.DELIMITER
|
|
18073
18066
|
})
|
|
@@ -18098,14 +18091,14 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18098
18091
|
if (A) {
|
|
18099
18092
|
const [S, I] = A;
|
|
18100
18093
|
return {
|
|
18101
|
-
type:
|
|
18094
|
+
type: M.limit_clause,
|
|
18102
18095
|
limitKw: m(Y(T), { trailing: E }),
|
|
18103
18096
|
offset: R,
|
|
18104
18097
|
count: I
|
|
18105
18098
|
};
|
|
18106
18099
|
} else
|
|
18107
18100
|
return {
|
|
18108
|
-
type:
|
|
18101
|
+
type: M.limit_clause,
|
|
18109
18102
|
limitKw: m(Y(T), { trailing: E }),
|
|
18110
18103
|
count: R
|
|
18111
18104
|
};
|
|
@@ -18121,7 +18114,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18121
18114
|
name: "select_clause",
|
|
18122
18115
|
symbols: [c.has("RESERVED_SELECT") ? { type: "RESERVED_SELECT" } : RESERVED_SELECT, "select_clause$subexpression$1"],
|
|
18123
18116
|
postprocess: ([T, [E, R]]) => ({
|
|
18124
|
-
type:
|
|
18117
|
+
type: M.clause,
|
|
18125
18118
|
nameKw: Y(T),
|
|
18126
18119
|
children: [E, ...R]
|
|
18127
18120
|
})
|
|
@@ -18130,7 +18123,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18130
18123
|
name: "select_clause",
|
|
18131
18124
|
symbols: [c.has("RESERVED_SELECT") ? { type: "RESERVED_SELECT" } : RESERVED_SELECT],
|
|
18132
18125
|
postprocess: ([T]) => ({
|
|
18133
|
-
type:
|
|
18126
|
+
type: M.clause,
|
|
18134
18127
|
nameKw: Y(T),
|
|
18135
18128
|
children: []
|
|
18136
18129
|
})
|
|
@@ -18138,7 +18131,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18138
18131
|
{
|
|
18139
18132
|
name: "all_columns_asterisk",
|
|
18140
18133
|
symbols: [c.has("ASTERISK") ? { type: "ASTERISK" } : ASTERISK],
|
|
18141
|
-
postprocess: () => ({ type:
|
|
18134
|
+
postprocess: () => ({ type: M.all_columns_asterisk })
|
|
18142
18135
|
},
|
|
18143
18136
|
{ name: "other_clause$ebnf$1", symbols: [] },
|
|
18144
18137
|
{ name: "other_clause$ebnf$1", symbols: ["other_clause$ebnf$1", "free_form_sql"], postprocess: (T) => T[0].concat([T[1]]) },
|
|
@@ -18146,7 +18139,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18146
18139
|
name: "other_clause",
|
|
18147
18140
|
symbols: [c.has("RESERVED_CLAUSE") ? { type: "RESERVED_CLAUSE" } : RESERVED_CLAUSE, "other_clause$ebnf$1"],
|
|
18148
18141
|
postprocess: ([T, E]) => ({
|
|
18149
|
-
type:
|
|
18142
|
+
type: M.clause,
|
|
18150
18143
|
nameKw: Y(T),
|
|
18151
18144
|
children: E
|
|
18152
18145
|
})
|
|
@@ -18157,7 +18150,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18157
18150
|
name: "set_operation",
|
|
18158
18151
|
symbols: [c.has("RESERVED_SET_OPERATION") ? { type: "RESERVED_SET_OPERATION" } : RESERVED_SET_OPERATION, "set_operation$ebnf$1"],
|
|
18159
18152
|
postprocess: ([T, E]) => ({
|
|
18160
|
-
type:
|
|
18153
|
+
type: M.set_operation,
|
|
18161
18154
|
nameKw: Y(T),
|
|
18162
18155
|
children: E
|
|
18163
18156
|
})
|
|
@@ -18230,8 +18223,8 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18230
18223
|
name: "array_subscript",
|
|
18231
18224
|
symbols: [c.has("ARRAY_IDENTIFIER") ? { type: "ARRAY_IDENTIFIER" } : ARRAY_IDENTIFIER, "_", "square_brackets"],
|
|
18232
18225
|
postprocess: ([T, E, R]) => ({
|
|
18233
|
-
type:
|
|
18234
|
-
array: m({ type:
|
|
18226
|
+
type: M.array_subscript,
|
|
18227
|
+
array: m({ type: M.identifier, quoted: !1, text: T.text }, { trailing: E }),
|
|
18235
18228
|
parenthesis: R
|
|
18236
18229
|
})
|
|
18237
18230
|
},
|
|
@@ -18239,7 +18232,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18239
18232
|
name: "array_subscript",
|
|
18240
18233
|
symbols: [c.has("ARRAY_KEYWORD") ? { type: "ARRAY_KEYWORD" } : ARRAY_KEYWORD, "_", "square_brackets"],
|
|
18241
18234
|
postprocess: ([T, E, R]) => ({
|
|
18242
|
-
type:
|
|
18235
|
+
type: M.array_subscript,
|
|
18243
18236
|
array: m(Y(T), { trailing: E }),
|
|
18244
18237
|
parenthesis: R
|
|
18245
18238
|
})
|
|
@@ -18248,7 +18241,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18248
18241
|
name: "function_call",
|
|
18249
18242
|
symbols: [c.has("RESERVED_FUNCTION_NAME") ? { type: "RESERVED_FUNCTION_NAME" } : RESERVED_FUNCTION_NAME, "_", "parenthesis"],
|
|
18250
18243
|
postprocess: ([T, E, R]) => ({
|
|
18251
|
-
type:
|
|
18244
|
+
type: M.function_call,
|
|
18252
18245
|
nameKw: m(Y(T), { trailing: E }),
|
|
18253
18246
|
parenthesis: R
|
|
18254
18247
|
})
|
|
@@ -18257,7 +18250,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18257
18250
|
name: "parenthesis",
|
|
18258
18251
|
symbols: [{ literal: "(" }, "expressions_or_clauses", { literal: ")" }],
|
|
18259
18252
|
postprocess: ([T, E, R]) => ({
|
|
18260
|
-
type:
|
|
18253
|
+
type: M.parenthesis,
|
|
18261
18254
|
children: E,
|
|
18262
18255
|
openParen: "(",
|
|
18263
18256
|
closeParen: ")"
|
|
@@ -18269,7 +18262,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18269
18262
|
name: "curly_braces",
|
|
18270
18263
|
symbols: [{ literal: "{" }, "curly_braces$ebnf$1", { literal: "}" }],
|
|
18271
18264
|
postprocess: ([T, E, R]) => ({
|
|
18272
|
-
type:
|
|
18265
|
+
type: M.parenthesis,
|
|
18273
18266
|
children: E,
|
|
18274
18267
|
openParen: "{",
|
|
18275
18268
|
closeParen: "}"
|
|
@@ -18281,7 +18274,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18281
18274
|
name: "square_brackets",
|
|
18282
18275
|
symbols: [{ literal: "[" }, "square_brackets$ebnf$1", { literal: "]" }],
|
|
18283
18276
|
postprocess: ([T, E, R]) => ({
|
|
18284
|
-
type:
|
|
18277
|
+
type: M.parenthesis,
|
|
18285
18278
|
children: E,
|
|
18286
18279
|
openParen: "[",
|
|
18287
18280
|
closeParen: "]"
|
|
@@ -18300,7 +18293,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18300
18293
|
// but we currently can't do that because of another hack that requires
|
|
18301
18294
|
// %ARRAY_IDENTIFIER on the left side of <array_subscript>.
|
|
18302
18295
|
([T, E, R, A, [S]]) => ({
|
|
18303
|
-
type:
|
|
18296
|
+
type: M.property_access,
|
|
18304
18297
|
object: m(T, { trailing: E }),
|
|
18305
18298
|
operator: R.text,
|
|
18306
18299
|
property: m(S, { leading: A })
|
|
@@ -18311,7 +18304,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18311
18304
|
name: "between_predicate",
|
|
18312
18305
|
symbols: [c.has("BETWEEN") ? { type: "BETWEEN" } : BETWEEN, "_", "andless_expression_chain", "_", c.has("AND") ? { type: "AND" } : AND, "_", "andless_expression"],
|
|
18313
18306
|
postprocess: ([T, E, R, A, S, I, N]) => ({
|
|
18314
|
-
type:
|
|
18307
|
+
type: M.between_predicate,
|
|
18315
18308
|
betweenKw: Y(T),
|
|
18316
18309
|
expr1: NO(R, { leading: E, trailing: A }),
|
|
18317
18310
|
andKw: Y(S),
|
|
@@ -18326,7 +18319,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18326
18319
|
name: "case_expression",
|
|
18327
18320
|
symbols: [c.has("CASE") ? { type: "CASE" } : CASE, "_", "case_expression$ebnf$1", "case_expression$ebnf$2", c.has("END") ? { type: "END" } : END],
|
|
18328
18321
|
postprocess: ([T, E, R, A, S]) => ({
|
|
18329
|
-
type:
|
|
18322
|
+
type: M.case_expression,
|
|
18330
18323
|
caseKw: m(Y(T), { trailing: E }),
|
|
18331
18324
|
endKw: Y(S),
|
|
18332
18325
|
expr: R || [],
|
|
@@ -18337,7 +18330,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18337
18330
|
name: "case_clause",
|
|
18338
18331
|
symbols: [c.has("WHEN") ? { type: "WHEN" } : WHEN, "_", "expression_chain_", c.has("THEN") ? { type: "THEN" } : THEN, "_", "expression_chain_"],
|
|
18339
18332
|
postprocess: ([T, E, R, A, S, I]) => ({
|
|
18340
|
-
type:
|
|
18333
|
+
type: M.case_when,
|
|
18341
18334
|
whenKw: m(Y(T), { trailing: E }),
|
|
18342
18335
|
thenKw: m(Y(A), { trailing: S }),
|
|
18343
18336
|
condition: R,
|
|
@@ -18348,30 +18341,30 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18348
18341
|
name: "case_clause",
|
|
18349
18342
|
symbols: [c.has("ELSE") ? { type: "ELSE" } : ELSE, "_", "expression_chain_"],
|
|
18350
18343
|
postprocess: ([T, E, R]) => ({
|
|
18351
|
-
type:
|
|
18344
|
+
type: M.case_else,
|
|
18352
18345
|
elseKw: m(Y(T), { trailing: E }),
|
|
18353
18346
|
result: R
|
|
18354
18347
|
})
|
|
18355
18348
|
},
|
|
18356
18349
|
{ name: "comma$subexpression$1", symbols: [c.has("COMMA") ? { type: "COMMA" } : COMMA] },
|
|
18357
|
-
{ name: "comma", symbols: ["comma$subexpression$1"], postprocess: ([[T]]) => ({ type:
|
|
18350
|
+
{ name: "comma", symbols: ["comma$subexpression$1"], postprocess: ([[T]]) => ({ type: M.comma }) },
|
|
18358
18351
|
{ name: "asterisk$subexpression$1", symbols: [c.has("ASTERISK") ? { type: "ASTERISK" } : ASTERISK] },
|
|
18359
|
-
{ name: "asterisk", symbols: ["asterisk$subexpression$1"], postprocess: ([[T]]) => ({ type:
|
|
18352
|
+
{ name: "asterisk", symbols: ["asterisk$subexpression$1"], postprocess: ([[T]]) => ({ type: M.operator, text: T.text }) },
|
|
18360
18353
|
{ name: "operator$subexpression$1", symbols: [c.has("OPERATOR") ? { type: "OPERATOR" } : OPERATOR] },
|
|
18361
|
-
{ name: "operator", symbols: ["operator$subexpression$1"], postprocess: ([[T]]) => ({ type:
|
|
18354
|
+
{ name: "operator", symbols: ["operator$subexpression$1"], postprocess: ([[T]]) => ({ type: M.operator, text: T.text }) },
|
|
18362
18355
|
{ name: "identifier$subexpression$1", symbols: [c.has("IDENTIFIER") ? { type: "IDENTIFIER" } : IDENTIFIER] },
|
|
18363
18356
|
{ name: "identifier$subexpression$1", symbols: [c.has("QUOTED_IDENTIFIER") ? { type: "QUOTED_IDENTIFIER" } : QUOTED_IDENTIFIER] },
|
|
18364
18357
|
{ name: "identifier$subexpression$1", symbols: [c.has("VARIABLE") ? { type: "VARIABLE" } : VARIABLE] },
|
|
18365
|
-
{ name: "identifier", symbols: ["identifier$subexpression$1"], postprocess: ([[T]]) => ({ type:
|
|
18358
|
+
{ name: "identifier", symbols: ["identifier$subexpression$1"], postprocess: ([[T]]) => ({ type: M.identifier, quoted: T.type !== "IDENTIFIER", text: T.text }) },
|
|
18366
18359
|
{ name: "parameter$subexpression$1", symbols: [c.has("NAMED_PARAMETER") ? { type: "NAMED_PARAMETER" } : NAMED_PARAMETER] },
|
|
18367
18360
|
{ name: "parameter$subexpression$1", symbols: [c.has("QUOTED_PARAMETER") ? { type: "QUOTED_PARAMETER" } : QUOTED_PARAMETER] },
|
|
18368
18361
|
{ name: "parameter$subexpression$1", symbols: [c.has("NUMBERED_PARAMETER") ? { type: "NUMBERED_PARAMETER" } : NUMBERED_PARAMETER] },
|
|
18369
18362
|
{ name: "parameter$subexpression$1", symbols: [c.has("POSITIONAL_PARAMETER") ? { type: "POSITIONAL_PARAMETER" } : POSITIONAL_PARAMETER] },
|
|
18370
18363
|
{ name: "parameter$subexpression$1", symbols: [c.has("CUSTOM_PARAMETER") ? { type: "CUSTOM_PARAMETER" } : CUSTOM_PARAMETER] },
|
|
18371
|
-
{ name: "parameter", symbols: ["parameter$subexpression$1"], postprocess: ([[T]]) => ({ type:
|
|
18364
|
+
{ name: "parameter", symbols: ["parameter$subexpression$1"], postprocess: ([[T]]) => ({ type: M.parameter, key: T.key, text: T.text }) },
|
|
18372
18365
|
{ name: "literal$subexpression$1", symbols: [c.has("NUMBER") ? { type: "NUMBER" } : NUMBER] },
|
|
18373
18366
|
{ name: "literal$subexpression$1", symbols: [c.has("STRING") ? { type: "STRING" } : STRING] },
|
|
18374
|
-
{ name: "literal", symbols: ["literal$subexpression$1"], postprocess: ([[T]]) => ({ type:
|
|
18367
|
+
{ name: "literal", symbols: ["literal$subexpression$1"], postprocess: ([[T]]) => ({ type: M.literal, text: T.text }) },
|
|
18375
18368
|
{ name: "keyword$subexpression$1", symbols: [c.has("RESERVED_KEYWORD") ? { type: "RESERVED_KEYWORD" } : RESERVED_KEYWORD] },
|
|
18376
18369
|
{ name: "keyword$subexpression$1", symbols: [c.has("RESERVED_PHRASE") ? { type: "RESERVED_PHRASE" } : RESERVED_PHRASE] },
|
|
18377
18370
|
{ name: "keyword$subexpression$1", symbols: [c.has("RESERVED_JOIN") ? { type: "RESERVED_JOIN" } : RESERVED_JOIN] },
|
|
@@ -18390,7 +18383,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18390
18383
|
name: "data_type",
|
|
18391
18384
|
symbols: [c.has("RESERVED_PARAMETERIZED_DATA_TYPE") ? { type: "RESERVED_PARAMETERIZED_DATA_TYPE" } : RESERVED_PARAMETERIZED_DATA_TYPE, "_", "parenthesis"],
|
|
18392
18385
|
postprocess: ([T, E, R]) => ({
|
|
18393
|
-
type:
|
|
18386
|
+
type: M.parameterized_data_type,
|
|
18394
18387
|
dataType: m(iT(T), { trailing: E }),
|
|
18395
18388
|
parenthesis: R
|
|
18396
18389
|
})
|
|
@@ -18419,7 +18412,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18419
18412
|
name: "comment",
|
|
18420
18413
|
symbols: [c.has("LINE_COMMENT") ? { type: "LINE_COMMENT" } : LINE_COMMENT],
|
|
18421
18414
|
postprocess: ([T]) => ({
|
|
18422
|
-
type:
|
|
18415
|
+
type: M.line_comment,
|
|
18423
18416
|
text: T.text,
|
|
18424
18417
|
precedingWhitespace: T.precedingWhitespace
|
|
18425
18418
|
})
|
|
@@ -18428,7 +18421,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18428
18421
|
name: "comment",
|
|
18429
18422
|
symbols: [c.has("BLOCK_COMMENT") ? { type: "BLOCK_COMMENT" } : BLOCK_COMMENT],
|
|
18430
18423
|
postprocess: ([T]) => ({
|
|
18431
|
-
type:
|
|
18424
|
+
type: M.block_comment,
|
|
18432
18425
|
text: T.text,
|
|
18433
18426
|
precedingWhitespace: T.precedingWhitespace
|
|
18434
18427
|
})
|
|
@@ -18437,7 +18430,7 @@ const c = new mT((T) => []), b = ([[T]]) => T, Y = (T) => ({
|
|
|
18437
18430
|
name: "comment",
|
|
18438
18431
|
symbols: [c.has("DISABLE_COMMENT") ? { type: "DISABLE_COMMENT" } : DISABLE_COMMENT],
|
|
18439
18432
|
postprocess: ([T]) => ({
|
|
18440
|
-
type:
|
|
18433
|
+
type: M.disable_comment,
|
|
18441
18434
|
text: T.text,
|
|
18442
18435
|
precedingWhitespace: T.precedingWhitespace
|
|
18443
18436
|
})
|
|
@@ -18647,51 +18640,51 @@ class EE {
|
|
|
18647
18640
|
}
|
|
18648
18641
|
formatNodeWithoutComments(E) {
|
|
18649
18642
|
switch (E.type) {
|
|
18650
|
-
case
|
|
18643
|
+
case M.function_call:
|
|
18651
18644
|
return this.formatFunctionCall(E);
|
|
18652
|
-
case
|
|
18645
|
+
case M.parameterized_data_type:
|
|
18653
18646
|
return this.formatParameterizedDataType(E);
|
|
18654
|
-
case
|
|
18647
|
+
case M.array_subscript:
|
|
18655
18648
|
return this.formatArraySubscript(E);
|
|
18656
|
-
case
|
|
18649
|
+
case M.property_access:
|
|
18657
18650
|
return this.formatPropertyAccess(E);
|
|
18658
|
-
case
|
|
18651
|
+
case M.parenthesis:
|
|
18659
18652
|
return this.formatParenthesis(E);
|
|
18660
|
-
case
|
|
18653
|
+
case M.between_predicate:
|
|
18661
18654
|
return this.formatBetweenPredicate(E);
|
|
18662
|
-
case
|
|
18655
|
+
case M.case_expression:
|
|
18663
18656
|
return this.formatCaseExpression(E);
|
|
18664
|
-
case
|
|
18657
|
+
case M.case_when:
|
|
18665
18658
|
return this.formatCaseWhen(E);
|
|
18666
|
-
case
|
|
18659
|
+
case M.case_else:
|
|
18667
18660
|
return this.formatCaseElse(E);
|
|
18668
|
-
case
|
|
18661
|
+
case M.clause:
|
|
18669
18662
|
return this.formatClause(E);
|
|
18670
|
-
case
|
|
18663
|
+
case M.set_operation:
|
|
18671
18664
|
return this.formatSetOperation(E);
|
|
18672
|
-
case
|
|
18665
|
+
case M.limit_clause:
|
|
18673
18666
|
return this.formatLimitClause(E);
|
|
18674
|
-
case
|
|
18667
|
+
case M.all_columns_asterisk:
|
|
18675
18668
|
return this.formatAllColumnsAsterisk(E);
|
|
18676
|
-
case
|
|
18669
|
+
case M.literal:
|
|
18677
18670
|
return this.formatLiteral(E);
|
|
18678
|
-
case
|
|
18671
|
+
case M.identifier:
|
|
18679
18672
|
return this.formatIdentifier(E);
|
|
18680
|
-
case
|
|
18673
|
+
case M.parameter:
|
|
18681
18674
|
return this.formatParameter(E);
|
|
18682
|
-
case
|
|
18675
|
+
case M.operator:
|
|
18683
18676
|
return this.formatOperator(E);
|
|
18684
|
-
case
|
|
18677
|
+
case M.comma:
|
|
18685
18678
|
return this.formatComma(E);
|
|
18686
|
-
case
|
|
18679
|
+
case M.line_comment:
|
|
18687
18680
|
return this.formatLineComment(E);
|
|
18688
|
-
case
|
|
18681
|
+
case M.block_comment:
|
|
18689
18682
|
return this.formatBlockComment(E);
|
|
18690
|
-
case
|
|
18683
|
+
case M.disable_comment:
|
|
18691
18684
|
return this.formatBlockComment(E);
|
|
18692
|
-
case
|
|
18685
|
+
case M.data_type:
|
|
18693
18686
|
return this.formatDataType(E);
|
|
18694
|
-
case
|
|
18687
|
+
case M.keyword:
|
|
18695
18688
|
return this.formatKeywordNode(E);
|
|
18696
18689
|
}
|
|
18697
18690
|
}
|
|
@@ -18708,10 +18701,10 @@ class EE {
|
|
|
18708
18701
|
formatArraySubscript(E) {
|
|
18709
18702
|
let R;
|
|
18710
18703
|
switch (E.array.type) {
|
|
18711
|
-
case
|
|
18704
|
+
case M.data_type:
|
|
18712
18705
|
R = this.showDataType(E.array);
|
|
18713
18706
|
break;
|
|
18714
|
-
case
|
|
18707
|
+
case M.keyword:
|
|
18715
18708
|
R = this.showKw(E.array);
|
|
18716
18709
|
break;
|
|
18717
18710
|
default:
|
|
@@ -18787,14 +18780,14 @@ class EE {
|
|
|
18787
18780
|
}
|
|
18788
18781
|
formatComments(E) {
|
|
18789
18782
|
E && E.forEach((R) => {
|
|
18790
|
-
R.type ===
|
|
18783
|
+
R.type === M.line_comment ? this.formatLineComment(R) : this.formatBlockComment(R);
|
|
18791
18784
|
});
|
|
18792
18785
|
}
|
|
18793
18786
|
formatLineComment(E) {
|
|
18794
18787
|
cE(E.precedingWhitespace || "") ? this.layout.add(_.NEWLINE, _.INDENT, E.text, _.MANDATORY_NEWLINE, _.INDENT) : this.layout.getLayoutItems().length > 0 ? this.layout.add(_.NO_NEWLINE, _.SPACE, E.text, _.MANDATORY_NEWLINE, _.INDENT) : this.layout.add(E.text, _.MANDATORY_NEWLINE, _.INDENT);
|
|
18795
18788
|
}
|
|
18796
18789
|
formatBlockComment(E) {
|
|
18797
|
-
E.type ===
|
|
18790
|
+
E.type === M.block_comment && this.isMultilineBlockComment(E) ? (this.splitBlockComment(E.text).forEach((R) => {
|
|
18798
18791
|
this.layout.add(_.NEWLINE, _.INDENT, R);
|
|
18799
18792
|
}), this.layout.add(_.NEWLINE, _.INDENT)) : this.layout.add(E.text, _.SPACE);
|
|
18800
18793
|
}
|
|
@@ -19171,27 +19164,27 @@ class hE {
|
|
|
19171
19164
|
generateCubeMetadata(E) {
|
|
19172
19165
|
const R = Object.keys(E.measures), A = Object.keys(E.dimensions), S = new Array(R.length), I = new Array(A.length);
|
|
19173
19166
|
for (let N = 0; N < R.length; N++) {
|
|
19174
|
-
const
|
|
19167
|
+
const e = R[N], n = E.measures[e];
|
|
19175
19168
|
S[N] = {
|
|
19176
|
-
name: `${E.name}.${
|
|
19177
|
-
title:
|
|
19178
|
-
shortTitle:
|
|
19179
|
-
type:
|
|
19169
|
+
name: `${E.name}.${e}`,
|
|
19170
|
+
title: n.title || e,
|
|
19171
|
+
shortTitle: n.title || e,
|
|
19172
|
+
type: n.type,
|
|
19180
19173
|
format: void 0,
|
|
19181
19174
|
// Measure doesn't have format field
|
|
19182
|
-
description:
|
|
19175
|
+
description: n.description
|
|
19183
19176
|
};
|
|
19184
19177
|
}
|
|
19185
19178
|
for (let N = 0; N < A.length; N++) {
|
|
19186
|
-
const
|
|
19179
|
+
const e = A[N], n = E.dimensions[e];
|
|
19187
19180
|
I[N] = {
|
|
19188
|
-
name: `${E.name}.${
|
|
19189
|
-
title:
|
|
19190
|
-
shortTitle:
|
|
19191
|
-
type:
|
|
19181
|
+
name: `${E.name}.${e}`,
|
|
19182
|
+
title: n.title || e,
|
|
19183
|
+
shortTitle: n.title || e,
|
|
19184
|
+
type: n.type,
|
|
19192
19185
|
format: void 0,
|
|
19193
19186
|
// Dimension doesn't have format field
|
|
19194
|
-
description:
|
|
19187
|
+
description: n.description
|
|
19195
19188
|
};
|
|
19196
19189
|
}
|
|
19197
19190
|
return {
|
|
@@ -19213,9 +19206,9 @@ class hE {
|
|
|
19213
19206
|
throw new Error(`Cube '${E}' not found`);
|
|
19214
19207
|
if (!this.dbExecutor)
|
|
19215
19208
|
throw new Error("Database executor not configured");
|
|
19216
|
-
const N = await new IE(this.dbExecutor).generateSQL(S, R, A),
|
|
19209
|
+
const N = await new IE(this.dbExecutor).generateSQL(S, R, A), e = this.dbExecutor.getEngineType();
|
|
19217
19210
|
return {
|
|
19218
|
-
sql: aT(N.sql,
|
|
19211
|
+
sql: aT(N.sql, e),
|
|
19219
19212
|
params: N.params
|
|
19220
19213
|
};
|
|
19221
19214
|
}
|
|
@@ -19281,12 +19274,12 @@ function hT(T, E) {
|
|
|
19281
19274
|
continue;
|
|
19282
19275
|
}
|
|
19283
19276
|
A.add(I);
|
|
19284
|
-
const
|
|
19285
|
-
if (!
|
|
19277
|
+
const e = T.get(I);
|
|
19278
|
+
if (!e) {
|
|
19286
19279
|
R.push(`Cube '${I}' not found (referenced in measure '${S}')`);
|
|
19287
19280
|
continue;
|
|
19288
19281
|
}
|
|
19289
|
-
|
|
19282
|
+
e.measures[N] || R.push(`Measure '${N}' not found on cube '${I}'`);
|
|
19290
19283
|
}
|
|
19291
19284
|
if (E.dimensions)
|
|
19292
19285
|
for (const S of E.dimensions) {
|
|
@@ -19296,12 +19289,12 @@ function hT(T, E) {
|
|
|
19296
19289
|
continue;
|
|
19297
19290
|
}
|
|
19298
19291
|
A.add(I);
|
|
19299
|
-
const
|
|
19300
|
-
if (!
|
|
19292
|
+
const e = T.get(I);
|
|
19293
|
+
if (!e) {
|
|
19301
19294
|
R.push(`Cube '${I}' not found (referenced in dimension '${S}')`);
|
|
19302
19295
|
continue;
|
|
19303
19296
|
}
|
|
19304
|
-
|
|
19297
|
+
e.dimensions[N] || R.push(`Dimension '${N}' not found on cube '${I}'`);
|
|
19305
19298
|
}
|
|
19306
19299
|
if (E.timeDimensions)
|
|
19307
19300
|
for (const S of E.timeDimensions) {
|
|
@@ -19311,12 +19304,12 @@ function hT(T, E) {
|
|
|
19311
19304
|
continue;
|
|
19312
19305
|
}
|
|
19313
19306
|
A.add(I);
|
|
19314
|
-
const
|
|
19315
|
-
if (!
|
|
19307
|
+
const e = T.get(I);
|
|
19308
|
+
if (!e) {
|
|
19316
19309
|
R.push(`Cube '${I}' not found (referenced in timeDimension '${S.dimension}')`);
|
|
19317
19310
|
continue;
|
|
19318
19311
|
}
|
|
19319
|
-
|
|
19312
|
+
e.dimensions[N] || R.push(`TimeDimension '${N}' not found on cube '${I}' (must be a dimension with time type)`);
|
|
19320
19313
|
}
|
|
19321
19314
|
if (E.filters)
|
|
19322
19315
|
for (const S of E.filters)
|
|
@@ -19328,9 +19321,9 @@ function hT(T, E) {
|
|
|
19328
19321
|
}
|
|
19329
19322
|
function fT(T, E, R, A) {
|
|
19330
19323
|
if ("and" in T || "or" in T) {
|
|
19331
|
-
const
|
|
19332
|
-
for (const
|
|
19333
|
-
fT(
|
|
19324
|
+
const e = T.and || T.or || [];
|
|
19325
|
+
for (const n of e)
|
|
19326
|
+
fT(n, E, R, A);
|
|
19334
19327
|
return;
|
|
19335
19328
|
}
|
|
19336
19329
|
if (!("member" in T)) {
|
|
@@ -19350,17 +19343,17 @@ function fT(T, E, R, A) {
|
|
|
19350
19343
|
}
|
|
19351
19344
|
!N.dimensions[I] && !N.measures[I] && R.push(`Filter field '${I}' not found on cube '${S}' (must be a dimension or measure)`);
|
|
19352
19345
|
}
|
|
19353
|
-
function
|
|
19346
|
+
function YO(T) {
|
|
19354
19347
|
return new hE(T);
|
|
19355
19348
|
}
|
|
19356
|
-
const lO = new hE(),
|
|
19357
|
-
function
|
|
19349
|
+
const lO = new hE(), mO = lO;
|
|
19350
|
+
function pO(T) {
|
|
19358
19351
|
return new hE({
|
|
19359
19352
|
drizzle: T.drizzle,
|
|
19360
19353
|
schema: T.schema
|
|
19361
19354
|
});
|
|
19362
19355
|
}
|
|
19363
|
-
const
|
|
19356
|
+
const dO = {
|
|
19364
19357
|
/**
|
|
19365
19358
|
* Create a simple query builder
|
|
19366
19359
|
*/
|
|
@@ -19468,24 +19461,23 @@ const VO = {
|
|
|
19468
19461
|
};
|
|
19469
19462
|
export {
|
|
19470
19463
|
dE as BaseDatabaseExecutor,
|
|
19471
|
-
|
|
19464
|
+
zT as MySQLExecutor,
|
|
19472
19465
|
jT as PostgresExecutor,
|
|
19473
19466
|
AR as QueryBuilder,
|
|
19474
19467
|
IE as QueryExecutor,
|
|
19475
19468
|
SR as QueryPlanner,
|
|
19476
|
-
|
|
19469
|
+
TR as SQLiteExecutor,
|
|
19477
19470
|
hE as SemanticLayerCompiler,
|
|
19478
|
-
|
|
19471
|
+
dO as SemanticLayerUtils,
|
|
19479
19472
|
$E as createDatabaseExecutor,
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
|
|
19473
|
+
pO as createDrizzleSemanticLayer,
|
|
19474
|
+
uO as createMultiCubeContext,
|
|
19475
|
+
ER as createMySQLExecutor,
|
|
19483
19476
|
KE as createPostgresExecutor,
|
|
19484
19477
|
yE as createSQLiteExecutor,
|
|
19485
|
-
|
|
19486
|
-
|
|
19478
|
+
YO as createSemanticLayer,
|
|
19479
|
+
mO as defaultSemanticLayer,
|
|
19487
19480
|
FO as defineCube,
|
|
19488
|
-
uO as defineLegacyCube,
|
|
19489
19481
|
RR as getJoinType,
|
|
19490
19482
|
gE as resolveCubeReference,
|
|
19491
19483
|
K as resolveSqlExpression,
|