drizzle-cube 0.1.68 → 0.2.0
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-CghsDLXl.cjs → compiler-DP1pPIcg.cjs} +9 -9
- package/dist/adapters/{compiler-BnHK-nxh.js → compiler-gcKytLwd.js} +12 -13
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +1 -1
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +1 -1
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/client/charts/ChartLoader.d.ts +56 -0
- package/dist/client/charts/lazyChartConfigRegistry.d.ts +90 -0
- package/dist/client/charts.d.ts +6 -0
- package/dist/client/charts.js +38 -15
- package/dist/client/charts.js.map +1 -1
- package/dist/client/chunks/chart-activitygridchart-BRk9BNnp.js +3713 -0
- package/dist/client/chunks/chart-activitygridchart-BRk9BNnp.js.map +1 -0
- package/dist/client/chunks/chart-activitygridchart-config-D9CgNH02.js +51 -0
- package/dist/client/chunks/chart-activitygridchart-config-D9CgNH02.js.map +1 -0
- package/dist/client/chunks/chart-areachart-Beu8sO9v.js +204 -0
- package/dist/client/chunks/chart-areachart-Beu8sO9v.js.map +1 -0
- package/dist/client/chunks/chart-areachart-config-InZgxubz.js +66 -0
- package/dist/client/chunks/chart-areachart-config-InZgxubz.js.map +1 -0
- package/dist/client/chunks/chart-barchart-BzoejYkT.js +177 -0
- package/dist/client/chunks/chart-barchart-BzoejYkT.js.map +1 -0
- package/dist/client/chunks/chart-barchart-config-DxatOnVV.js +59 -0
- package/dist/client/chunks/chart-barchart-config-DxatOnVV.js.map +1 -0
- package/dist/client/chunks/chart-bubblechart-Dg7sT_Mm.js +210 -0
- package/dist/client/chunks/chart-bubblechart-Dg7sT_Mm.js.map +1 -0
- package/dist/client/chunks/chart-bubblechart-config-CcZTMTCx.js +59 -0
- package/dist/client/chunks/chart-bubblechart-config-CcZTMTCx.js.map +1 -0
- package/dist/client/chunks/chart-chartcontainer-CdwzIKP1.js +103 -0
- package/dist/client/chunks/chart-chartcontainer-CdwzIKP1.js.map +1 -0
- package/dist/client/chunks/chart-charttooltip-NrFVM1cJ.js +26 -0
- package/dist/client/chunks/chart-charttooltip-NrFVM1cJ.js.map +1 -0
- package/dist/client/chunks/chart-datatable-BvV7gLPZ.js +57 -0
- package/dist/client/chunks/chart-datatable-BvV7gLPZ.js.map +1 -0
- package/dist/client/chunks/chart-datatable-config-D7mojhYA.js +22 -0
- package/dist/client/chunks/chart-datatable-config-D7mojhYA.js.map +1 -0
- package/dist/client/chunks/chart-kpidelta-config-icJXuFxe.js +99 -0
- package/dist/client/chunks/chart-kpidelta-config-icJXuFxe.js.map +1 -0
- package/dist/client/chunks/chart-kpidelta-p1lVVG5v.js +434 -0
- package/dist/client/chunks/chart-kpidelta-p1lVVG5v.js.map +1 -0
- package/dist/client/chunks/chart-kpinumber-BFtxFeqq.js +398 -0
- package/dist/client/chunks/chart-kpinumber-BFtxFeqq.js.map +1 -0
- package/dist/client/chunks/chart-kpinumber-config-T39g03ud.js +77 -0
- package/dist/client/chunks/chart-kpinumber-config-T39g03ud.js.map +1 -0
- package/dist/client/chunks/chart-kpitext-CX1s1u8B.js +165 -0
- package/dist/client/chunks/chart-kpitext-CX1s1u8B.js.map +1 -0
- package/dist/client/chunks/chart-kpitext-config-BbJGXAVk.js +49 -0
- package/dist/client/chunks/chart-kpitext-config-BbJGXAVk.js.map +1 -0
- package/dist/client/chunks/chart-linechart-Dgb10zbj.js +155 -0
- package/dist/client/chunks/chart-linechart-Dgb10zbj.js.map +1 -0
- package/dist/client/chunks/chart-linechart-config-BS1qVC8K.js +54 -0
- package/dist/client/chunks/chart-linechart-config-BS1qVC8K.js.map +1 -0
- package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js +254 -0
- package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js.map +1 -0
- package/dist/client/chunks/chart-markdownchart-config-DMCD8phf.js +62 -0
- package/dist/client/chunks/chart-markdownchart-config-DMCD8phf.js.map +1 -0
- package/dist/client/chunks/chart-piechart-B-0BQh-d.js +121 -0
- package/dist/client/chunks/chart-piechart-B-0BQh-d.js.map +1 -0
- package/dist/client/chunks/chart-piechart-config-6ZK8XaSX.js +32 -0
- package/dist/client/chunks/chart-piechart-config-6ZK8XaSX.js.map +1 -0
- package/dist/client/chunks/chart-radarchart-BwZM1yTd.js +124 -0
- package/dist/client/chunks/chart-radarchart-BwZM1yTd.js.map +1 -0
- package/dist/client/chunks/chart-radarchart-config-CCWOkkwO.js +38 -0
- package/dist/client/chunks/chart-radarchart-config-CCWOkkwO.js.map +1 -0
- package/dist/client/chunks/chart-radialbarchart-CythI1zx.js +109 -0
- package/dist/client/chunks/chart-radialbarchart-CythI1zx.js.map +1 -0
- package/dist/client/chunks/chart-radialbarchart-config-DicXYrMW.js +31 -0
- package/dist/client/chunks/chart-radialbarchart-config-DicXYrMW.js.map +1 -0
- package/dist/client/chunks/chart-scatterchart-config-DgYa-5vm.js +41 -0
- package/dist/client/chunks/chart-scatterchart-config-DgYa-5vm.js.map +1 -0
- package/dist/client/chunks/chart-scatterchart-om9-qmtE.js +201 -0
- package/dist/client/chunks/chart-scatterchart-om9-qmtE.js.map +1 -0
- package/dist/client/chunks/chart-treemapchart-Dc35Miif.js +253 -0
- package/dist/client/chunks/chart-treemapchart-Dc35Miif.js.map +1 -0
- package/dist/client/chunks/chart-treemapchart-config-DGhteyBe.js +40 -0
- package/dist/client/chunks/chart-treemapchart-config-DGhteyBe.js.map +1 -0
- package/dist/client/chunks/charts-DL9XOlaK.js +286 -0
- package/dist/client/chunks/charts-DL9XOlaK.js.map +1 -0
- package/dist/client/chunks/{icons-Bky5w1eH.js → icons-D-n_woAP.js} +833 -783
- package/dist/client/chunks/icons-D-n_woAP.js.map +1 -0
- package/dist/client/chunks/index-DpEuGmcW.js +8707 -0
- package/dist/client/chunks/index-DpEuGmcW.js.map +1 -0
- package/dist/client/components/QueryBuilder/ShareWarningModal.d.ts +9 -0
- package/dist/client/components/QueryBuilder/shareUtils.d.ts +59 -0
- package/dist/client/components/QueryBuilder/types.d.ts +21 -1
- package/dist/client/components.js +11 -11
- package/dist/client/hooks.js +3 -3
- package/dist/client/index.d.ts +18 -1
- package/dist/client/index.js +9135 -39
- package/dist/client/index.js.map +1 -1
- package/dist/client/providers.js +4 -4
- package/dist/client/styles.css +1 -1
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +16 -16
- package/dist/server/index.d.ts +0 -286
- package/dist/server/index.js +767 -881
- package/package.json +8 -2
- package/dist/client/chunks/charts-jwgcWeFt.js +0 -2580
- package/dist/client/chunks/charts-jwgcWeFt.js.map +0 -1
- package/dist/client/chunks/components-fN-QOY6G.js +0 -21835
- package/dist/client/chunks/components-fN-QOY6G.js.map +0 -1
- package/dist/client/chunks/icons-Bky5w1eH.js.map +0 -1
- package/dist/client/chunks/providers-D7zRgZrO.js +0 -308
- package/dist/client/chunks/providers-D7zRgZrO.js.map +0 -1
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sql as _, eq as x, and as F, StringChunk as
|
|
1
|
+
import { sql as _, eq as x, and as F, StringChunk as vT, count as SE, sum as f, max as j, min as q, countDistinct as QT, SQL as ZT, or as IE, arrayContained as jT, arrayOverlaps as qT, arrayContains as kT, isNotNull as gE, ne as KE, isNull as $E, notInArray as wE, inArray as OE, lt as NE, gt as tE, gte as K, lte as $, desc as zT, asc as JE } from "drizzle-orm";
|
|
2
2
|
class WE {
|
|
3
3
|
/**
|
|
4
4
|
* Default implementation returns template unchanged
|
|
@@ -25,7 +25,7 @@ class WE {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
class
|
|
28
|
+
class Ee extends WE {
|
|
29
29
|
getEngineType() {
|
|
30
30
|
return "postgres";
|
|
31
31
|
}
|
|
@@ -149,7 +149,7 @@ class Te extends WE {
|
|
|
149
149
|
return E;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
class
|
|
152
|
+
class BT extends WE {
|
|
153
153
|
getEngineType() {
|
|
154
154
|
return "mysql";
|
|
155
155
|
}
|
|
@@ -274,7 +274,7 @@ class dT extends WE {
|
|
|
274
274
|
return E;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
class
|
|
277
|
+
class Te extends WE {
|
|
278
278
|
getEngineType() {
|
|
279
279
|
return "sqlite";
|
|
280
280
|
}
|
|
@@ -426,7 +426,7 @@ class ee extends WE {
|
|
|
426
426
|
return E;
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
class
|
|
429
|
+
class ee extends BT {
|
|
430
430
|
getEngineType() {
|
|
431
431
|
return "singlestore";
|
|
432
432
|
}
|
|
@@ -439,16 +439,16 @@ class Re extends dT {
|
|
|
439
439
|
// These limitations are typically handled at the query building level
|
|
440
440
|
// rather than in the adapter, but can be addressed here if needed
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function Re(e) {
|
|
443
443
|
switch (e) {
|
|
444
444
|
case "postgres":
|
|
445
|
-
return new
|
|
445
|
+
return new Ee();
|
|
446
446
|
case "mysql":
|
|
447
|
-
return new
|
|
447
|
+
return new BT();
|
|
448
448
|
case "sqlite":
|
|
449
|
-
return new
|
|
449
|
+
return new Te();
|
|
450
450
|
case "singlestore":
|
|
451
|
-
return new
|
|
451
|
+
return new ee();
|
|
452
452
|
default:
|
|
453
453
|
throw new Error(`Unsupported database engine: ${e}`);
|
|
454
454
|
}
|
|
@@ -457,11 +457,11 @@ class bE {
|
|
|
457
457
|
constructor(E, T, R) {
|
|
458
458
|
this.db = E, this.schema = T;
|
|
459
459
|
const A = R || this.getEngineType();
|
|
460
|
-
this.databaseAdapter =
|
|
460
|
+
this.databaseAdapter = Re(A);
|
|
461
461
|
}
|
|
462
462
|
databaseAdapter;
|
|
463
463
|
}
|
|
464
|
-
class
|
|
464
|
+
class Ae extends bE {
|
|
465
465
|
async execute(E, T) {
|
|
466
466
|
if (E && typeof E == "object" && typeof E.execute == "function") {
|
|
467
467
|
const A = await E.execute();
|
|
@@ -512,8 +512,8 @@ class Se extends bE {
|
|
|
512
512
|
return "postgres";
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
return new
|
|
515
|
+
function xE(e, E) {
|
|
516
|
+
return new Ae(e, E, "postgres");
|
|
517
517
|
}
|
|
518
518
|
class mT extends bE {
|
|
519
519
|
async execute(E, T) {
|
|
@@ -553,10 +553,10 @@ class mT extends bE {
|
|
|
553
553
|
return "mysql";
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function Se(e, E) {
|
|
557
557
|
return new mT(e, E, "mysql");
|
|
558
558
|
}
|
|
559
|
-
class
|
|
559
|
+
class Ie extends bE {
|
|
560
560
|
async execute(E, T) {
|
|
561
561
|
if (E && typeof E == "object" && typeof E.execute == "function") {
|
|
562
562
|
const R = await E.execute();
|
|
@@ -602,10 +602,10 @@ class Oe extends bE {
|
|
|
602
602
|
return "sqlite";
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
function
|
|
606
|
-
return new
|
|
605
|
+
function vE(e, E) {
|
|
606
|
+
return new Ie(e, E, "sqlite");
|
|
607
607
|
}
|
|
608
|
-
class
|
|
608
|
+
class Oe extends mT {
|
|
609
609
|
getEngineType() {
|
|
610
610
|
return "singlestore";
|
|
611
611
|
}
|
|
@@ -613,25 +613,25 @@ class Ne extends mT {
|
|
|
613
613
|
// For now, we inherit all behavior from MySQLExecutor since
|
|
614
614
|
// SingleStore is largely MySQL-compatible
|
|
615
615
|
}
|
|
616
|
-
function
|
|
617
|
-
return new
|
|
616
|
+
function Ne(e, E) {
|
|
617
|
+
return new Oe(e, E);
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function QE(e, E, T) {
|
|
620
620
|
if (T)
|
|
621
621
|
switch (T) {
|
|
622
622
|
case "postgres":
|
|
623
|
-
return
|
|
623
|
+
return xE(e, E);
|
|
624
624
|
case "mysql":
|
|
625
|
-
return
|
|
625
|
+
return Se(e, E);
|
|
626
626
|
case "sqlite":
|
|
627
|
-
return
|
|
627
|
+
return vE(e, E);
|
|
628
628
|
case "singlestore":
|
|
629
|
-
return
|
|
629
|
+
return Ne(e, E);
|
|
630
630
|
}
|
|
631
631
|
if (e.all && e.run)
|
|
632
|
-
return QE(e, E);
|
|
633
|
-
if (e.execute)
|
|
634
632
|
return vE(e, E);
|
|
633
|
+
if (e.execute)
|
|
634
|
+
return xE(e, E);
|
|
635
635
|
throw new Error("Unable to determine database engine type. Please specify engineType parameter.");
|
|
636
636
|
}
|
|
637
637
|
function sE(e) {
|
|
@@ -656,27 +656,27 @@ function fE(e, E) {
|
|
|
656
656
|
return "left";
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function te(e) {
|
|
660
660
|
return e && typeof e == "object" ? _`${_`${e}`}` : e;
|
|
661
661
|
}
|
|
662
662
|
function b(e, E) {
|
|
663
663
|
const T = typeof e == "function" ? e(E) : e;
|
|
664
|
-
return
|
|
664
|
+
return te(T);
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function tO(e, E, T) {
|
|
667
667
|
return {
|
|
668
668
|
...e,
|
|
669
669
|
cubes: E,
|
|
670
670
|
currentCube: T
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function sO(e, E) {
|
|
674
674
|
return {
|
|
675
675
|
name: e,
|
|
676
676
|
...E
|
|
677
677
|
};
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function se(e, E) {
|
|
680
680
|
if (e.relationship !== "belongsToMany" || !e.through)
|
|
681
681
|
throw new Error("expandBelongsToManyJoin can only be called on belongsToMany relationships with through configuration");
|
|
682
682
|
const { table: T, sourceKey: R, targetKey: A, securitySql: S } = e.through, I = [];
|
|
@@ -932,37 +932,37 @@ class X {
|
|
|
932
932
|
return E.type === "calculated" && !!E.calculatedSql;
|
|
933
933
|
}
|
|
934
934
|
}
|
|
935
|
-
function
|
|
935
|
+
function Ce(e, E) {
|
|
936
936
|
const { cube: T, allCubes: R, resolvedMeasures: A } = E, S = XE(e), I = /* @__PURE__ */ new Map();
|
|
937
937
|
for (const C of S) {
|
|
938
|
-
const { originalRef:
|
|
938
|
+
const { originalRef: n, cubeName: L, fieldName: i } = C, a = L || T.name;
|
|
939
939
|
if (!R.get(a))
|
|
940
940
|
throw new Error(
|
|
941
|
-
`Cannot substitute {${
|
|
941
|
+
`Cannot substitute {${n}}: cube '${a}' not found`
|
|
942
942
|
);
|
|
943
943
|
const P = `${a}.${i}`, U = A.get(P);
|
|
944
944
|
if (!U)
|
|
945
945
|
throw new Error(
|
|
946
|
-
`Cannot substitute {${
|
|
946
|
+
`Cannot substitute {${n}}: measure '${P}' not resolved yet. Ensure measures are resolved in dependency order.`
|
|
947
947
|
);
|
|
948
948
|
const M = U(), G = _`${M}`;
|
|
949
|
-
I.set(
|
|
949
|
+
I.set(n, G);
|
|
950
950
|
}
|
|
951
951
|
const t = [], s = [];
|
|
952
952
|
let O = 0;
|
|
953
953
|
for (const C of S) {
|
|
954
|
-
const
|
|
954
|
+
const n = `{${C.originalRef}}`, L = e.indexOf(n, O);
|
|
955
955
|
if (L >= 0) {
|
|
956
956
|
t.push(e.substring(O, L));
|
|
957
957
|
const i = I.get(C.originalRef);
|
|
958
|
-
i && s.push(i), O = L +
|
|
958
|
+
i && s.push(i), O = L + n.length;
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
if (t.push(e.substring(O)), s.length === 0)
|
|
962
962
|
return _.raw(e);
|
|
963
963
|
const N = [];
|
|
964
964
|
for (let C = 0; C < t.length; C++)
|
|
965
|
-
t[C] && N.push(new
|
|
965
|
+
t[C] && N.push(new vT(t[C])), C < s.length && N.push(s[C]);
|
|
966
966
|
return _.join(N, _.raw(""));
|
|
967
967
|
}
|
|
968
968
|
function XE(e) {
|
|
@@ -985,7 +985,7 @@ function XE(e) {
|
|
|
985
985
|
}
|
|
986
986
|
return R;
|
|
987
987
|
}
|
|
988
|
-
function
|
|
988
|
+
function Le(e) {
|
|
989
989
|
const E = [];
|
|
990
990
|
let T = 0;
|
|
991
991
|
for (let I = 0; I < e.length; I++)
|
|
@@ -1038,9 +1038,9 @@ class ne {
|
|
|
1038
1038
|
for (const N of T.values())
|
|
1039
1039
|
O.buildGraph(N);
|
|
1040
1040
|
for (const N of E) {
|
|
1041
|
-
const [C,
|
|
1042
|
-
if (L && L.measures && L.measures[
|
|
1043
|
-
const i = L.measures[
|
|
1041
|
+
const [C, n] = N.split("."), L = T.get(C);
|
|
1042
|
+
if (L && L.measures && L.measures[n]) {
|
|
1043
|
+
const i = L.measures[n];
|
|
1044
1044
|
X.isCalculatedMeasure(i) ? (t.push(N), CE(i.calculatedSql, C).forEach((P) => s.add(P)), O.getAllDependencies(N).forEach((P) => {
|
|
1045
1045
|
const [U, M] = P.split("."), G = T.get(U);
|
|
1046
1046
|
if (G && G.measures[M]) {
|
|
@@ -1051,14 +1051,14 @@ class ne {
|
|
|
1051
1051
|
}
|
|
1052
1052
|
}
|
|
1053
1053
|
for (const N of s) {
|
|
1054
|
-
const [C,
|
|
1055
|
-
if (L && L.measures && L.measures[
|
|
1056
|
-
const i = L.measures[
|
|
1054
|
+
const [C, n] = N.split("."), L = T.get(C);
|
|
1055
|
+
if (L && L.measures && L.measures[n]) {
|
|
1056
|
+
const i = L.measures[n];
|
|
1057
1057
|
X.isCalculatedMeasure(i) ? t.includes(N) || t.push(N) : I.includes(N) || I.push(N);
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
1060
|
for (const N of I) {
|
|
1061
|
-
const [C,
|
|
1061
|
+
const [C, n] = N.split("."), L = T.get(C), i = L.measures[n];
|
|
1062
1062
|
if (A) {
|
|
1063
1063
|
const a = A(N, i, L);
|
|
1064
1064
|
S.set(N, () => a);
|
|
@@ -1068,7 +1068,7 @@ class ne {
|
|
|
1068
1068
|
if (t.length > 0) {
|
|
1069
1069
|
const N = O.topologicalSort(t);
|
|
1070
1070
|
for (const C of N) {
|
|
1071
|
-
const [
|
|
1071
|
+
const [n, L] = C.split("."), i = T.get(n), a = i.measures[L];
|
|
1072
1072
|
S.set(C, () => this.buildCalculatedMeasure(
|
|
1073
1073
|
a,
|
|
1074
1074
|
i,
|
|
@@ -1133,7 +1133,7 @@ class ne {
|
|
|
1133
1133
|
`Calculated measure '${T.name}.${E.name}' missing calculatedSql property`
|
|
1134
1134
|
);
|
|
1135
1135
|
const I = this.databaseAdapter.preprocessCalculatedTemplate(E.calculatedSql);
|
|
1136
|
-
return
|
|
1136
|
+
return Ce(I, {
|
|
1137
1137
|
cube: T,
|
|
1138
1138
|
allCubes: R,
|
|
1139
1139
|
resolvedMeasures: A
|
|
@@ -1162,11 +1162,11 @@ class ne {
|
|
|
1162
1162
|
for (const s of t) {
|
|
1163
1163
|
const [O, N] = s.split("."), C = A.get(O);
|
|
1164
1164
|
if (C && C.measures[N]) {
|
|
1165
|
-
const
|
|
1165
|
+
const n = C.measures[N];
|
|
1166
1166
|
if (R.measures.includes(s)) {
|
|
1167
1167
|
const L = _`${_.identifier(R.cteAlias)}.${_.identifier(N)}`;
|
|
1168
1168
|
let i;
|
|
1169
|
-
switch (
|
|
1169
|
+
switch (n.type) {
|
|
1170
1170
|
case "count":
|
|
1171
1171
|
case "countDistinct":
|
|
1172
1172
|
case "sum":
|
|
@@ -1273,7 +1273,7 @@ class ne {
|
|
|
1273
1273
|
case "count":
|
|
1274
1274
|
return SE(R);
|
|
1275
1275
|
case "countDistinct":
|
|
1276
|
-
return
|
|
1276
|
+
return QT(R);
|
|
1277
1277
|
case "sum":
|
|
1278
1278
|
return f(R);
|
|
1279
1279
|
case "avg":
|
|
@@ -1293,7 +1293,7 @@ class ne {
|
|
|
1293
1293
|
*/
|
|
1294
1294
|
buildTimeDimensionExpression(E, T, R) {
|
|
1295
1295
|
const A = b(E, R);
|
|
1296
|
-
return T ? this.databaseAdapter.buildTimeDimension(T, A) : A instanceof
|
|
1296
|
+
return T ? this.databaseAdapter.buildTimeDimension(T, A) : A instanceof ZT ? A : _`${A}`;
|
|
1297
1297
|
}
|
|
1298
1298
|
/**
|
|
1299
1299
|
* Build WHERE conditions from semantic query filters (dimensions only)
|
|
@@ -1312,7 +1312,7 @@ class ne {
|
|
|
1312
1312
|
if (N && N.dimensions[O] && t.dateRange) {
|
|
1313
1313
|
if (A?.preAggregationCTEs && A.preAggregationCTEs.some((a) => a.cube.name === s))
|
|
1314
1314
|
continue;
|
|
1315
|
-
const C = N.dimensions[O],
|
|
1315
|
+
const C = N.dimensions[O], n = b(C.sql, R), L = this.buildDateRangeCondition(n, t.dateRange);
|
|
1316
1316
|
L && S.push(L);
|
|
1317
1317
|
}
|
|
1318
1318
|
}
|
|
@@ -1349,8 +1349,8 @@ class ne {
|
|
|
1349
1349
|
}
|
|
1350
1350
|
const I = E, [t, s] = I.member.split("."), O = T.get(t);
|
|
1351
1351
|
if (!O) return null;
|
|
1352
|
-
const N = O.dimensions[s], C = O.measures[s],
|
|
1353
|
-
if (!
|
|
1352
|
+
const N = O.dimensions[s], C = O.measures[s], n = N || C;
|
|
1353
|
+
if (!n) return null;
|
|
1354
1354
|
if (A === "where" && N) {
|
|
1355
1355
|
if (S?.preAggregationCTEs && S.preAggregationCTEs.some((l) => l.cube.name === t))
|
|
1356
1356
|
return null;
|
|
@@ -1359,7 +1359,7 @@ class ne {
|
|
|
1359
1359
|
i,
|
|
1360
1360
|
I.operator,
|
|
1361
1361
|
I.values,
|
|
1362
|
-
|
|
1362
|
+
n,
|
|
1363
1363
|
I.dateRange
|
|
1364
1364
|
);
|
|
1365
1365
|
} else {
|
|
@@ -1371,7 +1371,7 @@ class ne {
|
|
|
1371
1371
|
L,
|
|
1372
1372
|
I.operator,
|
|
1373
1373
|
I.values,
|
|
1374
|
-
|
|
1374
|
+
n,
|
|
1375
1375
|
I.dateRange
|
|
1376
1376
|
);
|
|
1377
1377
|
}
|
|
@@ -1413,7 +1413,7 @@ class ne {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
return this.databaseAdapter.buildBooleanLiteral(!1);
|
|
1415
1415
|
case "notEquals":
|
|
1416
|
-
return I.length > 1 ?
|
|
1416
|
+
return I.length > 1 ? wE(E, I) : I.length === 1 ? KE(E, t) : null;
|
|
1417
1417
|
case "contains":
|
|
1418
1418
|
return this.databaseAdapter.buildStringCondition(E, "contains", t);
|
|
1419
1419
|
case "notContains":
|
|
@@ -1431,9 +1431,9 @@ class ne {
|
|
|
1431
1431
|
case "lte":
|
|
1432
1432
|
return $(E, t);
|
|
1433
1433
|
case "set":
|
|
1434
|
-
return
|
|
1434
|
+
return gE(E);
|
|
1435
1435
|
case "notSet":
|
|
1436
|
-
return
|
|
1436
|
+
return $E(E);
|
|
1437
1437
|
case "inDateRange":
|
|
1438
1438
|
if (I.length >= 2) {
|
|
1439
1439
|
const s = this.normalizeDate(I[0]);
|
|
@@ -1441,8 +1441,8 @@ class ne {
|
|
|
1441
1441
|
if (s && O) {
|
|
1442
1442
|
const N = R[1];
|
|
1443
1443
|
if (typeof N == "string" && /^\d{4}-\d{2}-\d{2}$/.test(N.trim())) {
|
|
1444
|
-
const C = typeof O == "number" ? new Date(O * (this.databaseAdapter.getEngineType() === "sqlite" ? 1e3 : 1)) : new Date(O),
|
|
1445
|
-
|
|
1444
|
+
const C = typeof O == "number" ? new Date(O * (this.databaseAdapter.getEngineType() === "sqlite" ? 1e3 : 1)) : new Date(O), n = new Date(C);
|
|
1445
|
+
n.setUTCHours(23, 59, 59, 999), this.databaseAdapter.isTimestampInteger() ? O = this.databaseAdapter.getEngineType() === "sqlite" ? Math.floor(n.getTime() / 1e3) : n.getTime() : O = n.toISOString();
|
|
1446
1446
|
}
|
|
1447
1447
|
return F(
|
|
1448
1448
|
K(E, s),
|
|
@@ -1472,7 +1472,7 @@ class ne {
|
|
|
1472
1472
|
case "in":
|
|
1473
1473
|
return I.length > 0 ? OE(E, I) : null;
|
|
1474
1474
|
case "notIn":
|
|
1475
|
-
return I.length > 0 ?
|
|
1475
|
+
return I.length > 0 ? wE(E, I) : null;
|
|
1476
1476
|
case "like":
|
|
1477
1477
|
return this.databaseAdapter.buildStringCondition(E, "like", t);
|
|
1478
1478
|
case "notLike":
|
|
@@ -1485,22 +1485,22 @@ class ne {
|
|
|
1485
1485
|
return this.databaseAdapter.buildStringCondition(E, "notRegex", t);
|
|
1486
1486
|
case "isEmpty":
|
|
1487
1487
|
return IE(
|
|
1488
|
-
|
|
1488
|
+
$E(E),
|
|
1489
1489
|
x(E, "")
|
|
1490
1490
|
);
|
|
1491
1491
|
case "isNotEmpty":
|
|
1492
1492
|
return F(
|
|
1493
|
-
|
|
1494
|
-
|
|
1493
|
+
gE(E),
|
|
1494
|
+
KE(E, "")
|
|
1495
1495
|
);
|
|
1496
1496
|
// PostgreSQL array operators - silent no-op for other databases
|
|
1497
1497
|
// These use Drizzle's built-in array operator functions
|
|
1498
1498
|
case "arrayContains":
|
|
1499
|
-
return this.databaseAdapter.getEngineType() === "postgres" ? zT(E, I) : null;
|
|
1500
|
-
case "arrayOverlaps":
|
|
1501
1499
|
return this.databaseAdapter.getEngineType() === "postgres" ? kT(E, I) : null;
|
|
1502
|
-
case "
|
|
1500
|
+
case "arrayOverlaps":
|
|
1503
1501
|
return this.databaseAdapter.getEngineType() === "postgres" ? qT(E, I) : null;
|
|
1502
|
+
case "arrayContained":
|
|
1503
|
+
return this.databaseAdapter.getEngineType() === "postgres" ? jT(E, I) : null;
|
|
1504
1504
|
default:
|
|
1505
1505
|
return null;
|
|
1506
1506
|
}
|
|
@@ -1553,39 +1553,39 @@ class ne {
|
|
|
1553
1553
|
parseRelativeDateRange(E) {
|
|
1554
1554
|
const T = /* @__PURE__ */ new Date(), R = E.toLowerCase().trim(), A = T.getUTCFullYear(), S = T.getUTCMonth(), I = T.getUTCDate(), t = T.getUTCDay();
|
|
1555
1555
|
if (R === "today") {
|
|
1556
|
-
const
|
|
1557
|
-
|
|
1556
|
+
const n = new Date(T);
|
|
1557
|
+
n.setUTCHours(0, 0, 0, 0);
|
|
1558
1558
|
const L = new Date(T);
|
|
1559
|
-
return L.setUTCHours(23, 59, 59, 999), { start:
|
|
1559
|
+
return L.setUTCHours(23, 59, 59, 999), { start: n, end: L };
|
|
1560
1560
|
}
|
|
1561
1561
|
if (R === "yesterday") {
|
|
1562
|
-
const
|
|
1563
|
-
|
|
1562
|
+
const n = new Date(T);
|
|
1563
|
+
n.setUTCDate(I - 1), n.setUTCHours(0, 0, 0, 0);
|
|
1564
1564
|
const L = new Date(T);
|
|
1565
|
-
return L.setUTCDate(I - 1), L.setUTCHours(23, 59, 59, 999), { start:
|
|
1565
|
+
return L.setUTCDate(I - 1), L.setUTCHours(23, 59, 59, 999), { start: n, end: L };
|
|
1566
1566
|
}
|
|
1567
1567
|
if (R === "this week") {
|
|
1568
|
-
const
|
|
1569
|
-
L.setUTCDate(I +
|
|
1568
|
+
const n = t === 0 ? -6 : 1 - t, L = new Date(T);
|
|
1569
|
+
L.setUTCDate(I + n), L.setUTCHours(0, 0, 0, 0);
|
|
1570
1570
|
const i = new Date(L);
|
|
1571
1571
|
return i.setUTCDate(L.getUTCDate() + 6), i.setUTCHours(23, 59, 59, 999), { start: L, end: i };
|
|
1572
1572
|
}
|
|
1573
1573
|
if (R === "this month") {
|
|
1574
|
-
const
|
|
1575
|
-
return { start:
|
|
1574
|
+
const n = new Date(Date.UTC(A, S, 1, 0, 0, 0, 0)), L = new Date(Date.UTC(A, S + 1, 0, 23, 59, 59, 999));
|
|
1575
|
+
return { start: n, end: L };
|
|
1576
1576
|
}
|
|
1577
1577
|
if (R === "this quarter") {
|
|
1578
|
-
const
|
|
1578
|
+
const n = Math.floor(S / 3), L = new Date(Date.UTC(A, n * 3, 1, 0, 0, 0, 0)), i = new Date(Date.UTC(A, n * 3 + 3, 0, 23, 59, 59, 999));
|
|
1579
1579
|
return { start: L, end: i };
|
|
1580
1580
|
}
|
|
1581
1581
|
if (R === "this year") {
|
|
1582
|
-
const
|
|
1583
|
-
return { start:
|
|
1582
|
+
const n = new Date(Date.UTC(A, 0, 1, 0, 0, 0, 0)), L = new Date(Date.UTC(A, 11, 31, 23, 59, 59, 999));
|
|
1583
|
+
return { start: n, end: L };
|
|
1584
1584
|
}
|
|
1585
1585
|
const s = R.match(/^last\s+(\d+)\s+days?$/);
|
|
1586
1586
|
if (s) {
|
|
1587
|
-
const
|
|
1588
|
-
L.setUTCDate(I -
|
|
1587
|
+
const n = parseInt(s[1], 10), L = new Date(T);
|
|
1588
|
+
L.setUTCDate(I - n + 1), L.setUTCHours(0, 0, 0, 0);
|
|
1589
1589
|
const i = new Date(T);
|
|
1590
1590
|
return i.setUTCHours(23, 59, 59, 999), { start: L, end: i };
|
|
1591
1591
|
}
|
|
@@ -1597,35 +1597,35 @@ class ne {
|
|
|
1597
1597
|
return a.setUTCHours(23, 59, 59, 999), { start: i, end: a };
|
|
1598
1598
|
}
|
|
1599
1599
|
if (R === "last week") {
|
|
1600
|
-
const
|
|
1601
|
-
L.setUTCDate(I +
|
|
1600
|
+
const n = t === 0 ? -13 : -6 - t, L = new Date(T);
|
|
1601
|
+
L.setUTCDate(I + n), L.setUTCHours(0, 0, 0, 0);
|
|
1602
1602
|
const i = new Date(L);
|
|
1603
1603
|
return i.setUTCDate(L.getUTCDate() + 6), i.setUTCHours(23, 59, 59, 999), { start: L, end: i };
|
|
1604
1604
|
}
|
|
1605
1605
|
if (R === "last month") {
|
|
1606
|
-
const
|
|
1607
|
-
return { start:
|
|
1606
|
+
const n = new Date(Date.UTC(A, S - 1, 1, 0, 0, 0, 0)), L = new Date(Date.UTC(A, S, 0, 23, 59, 59, 999));
|
|
1607
|
+
return { start: n, end: L };
|
|
1608
1608
|
}
|
|
1609
1609
|
if (R === "last quarter") {
|
|
1610
|
-
const
|
|
1610
|
+
const n = Math.floor(S / 3), L = n === 0 ? 3 : n - 1, i = n === 0 ? A - 1 : A, a = new Date(Date.UTC(i, L * 3, 1, 0, 0, 0, 0)), l = new Date(Date.UTC(i, L * 3 + 3, 0, 23, 59, 59, 999));
|
|
1611
1611
|
return { start: a, end: l };
|
|
1612
1612
|
}
|
|
1613
1613
|
if (R === "last year") {
|
|
1614
|
-
const
|
|
1615
|
-
return { start:
|
|
1614
|
+
const n = new Date(Date.UTC(A - 1, 0, 1, 0, 0, 0, 0)), L = new Date(Date.UTC(A - 1, 11, 31, 23, 59, 59, 999));
|
|
1615
|
+
return { start: n, end: L };
|
|
1616
1616
|
}
|
|
1617
1617
|
if (R === "last 12 months") {
|
|
1618
|
-
const
|
|
1619
|
-
return L.setUTCHours(23, 59, 59, 999), { start:
|
|
1618
|
+
const n = new Date(Date.UTC(A, S - 11, 1, 0, 0, 0, 0)), L = new Date(T);
|
|
1619
|
+
return L.setUTCHours(23, 59, 59, 999), { start: n, end: L };
|
|
1620
1620
|
}
|
|
1621
1621
|
const N = R.match(/^last\s+(\d+)\s+months?$/);
|
|
1622
1622
|
if (N) {
|
|
1623
|
-
const
|
|
1623
|
+
const n = parseInt(N[1], 10), L = new Date(Date.UTC(A, S - n + 1, 1, 0, 0, 0, 0)), i = new Date(T);
|
|
1624
1624
|
return i.setUTCHours(23, 59, 59, 999), { start: L, end: i };
|
|
1625
1625
|
}
|
|
1626
1626
|
const C = R.match(/^last\s+(\d+)\s+years?$/);
|
|
1627
1627
|
if (C) {
|
|
1628
|
-
const
|
|
1628
|
+
const n = parseInt(C[1], 10), L = new Date(Date.UTC(A - n, 0, 1, 0, 0, 0, 0)), i = new Date(T);
|
|
1629
1629
|
return i.setUTCHours(23, 59, 59, 999), { start: L, end: i };
|
|
1630
1630
|
}
|
|
1631
1631
|
return null;
|
|
@@ -1721,7 +1721,7 @@ class ne {
|
|
|
1721
1721
|
for (const [S, I] of Object.entries(E.order)) {
|
|
1722
1722
|
if (!A.includes(S))
|
|
1723
1723
|
throw new Error(`Cannot order by '${S}': field is not selected in the query`);
|
|
1724
|
-
const t = I === "desc" ?
|
|
1724
|
+
const t = I === "desc" ? zT(_.identifier(S)) : JE(_.identifier(S));
|
|
1725
1725
|
R.push(t);
|
|
1726
1726
|
}
|
|
1727
1727
|
if (E.timeDimensions && E.timeDimensions.length > 0) {
|
|
@@ -1729,7 +1729,7 @@ class ne {
|
|
|
1729
1729
|
(t, s) => t.dimension.localeCompare(s.dimension)
|
|
1730
1730
|
);
|
|
1731
1731
|
for (const t of I)
|
|
1732
|
-
S.has(t.dimension) || R.push(
|
|
1732
|
+
S.has(t.dimension) || R.push(JE(_.identifier(t.dimension)));
|
|
1733
1733
|
}
|
|
1734
1734
|
return R;
|
|
1735
1735
|
}
|
|
@@ -1770,7 +1770,7 @@ class ne {
|
|
|
1770
1770
|
return A;
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
|
-
class
|
|
1773
|
+
class dT {
|
|
1774
1774
|
/**
|
|
1775
1775
|
* Analyze a semantic query to determine which cubes are involved
|
|
1776
1776
|
*/
|
|
@@ -1929,13 +1929,13 @@ class pT {
|
|
|
1929
1929
|
for (const { toCube: N, joinDef: C } of O) {
|
|
1930
1930
|
if (I.has(N))
|
|
1931
1931
|
continue;
|
|
1932
|
-
const
|
|
1933
|
-
if (!
|
|
1932
|
+
const n = E.get(N);
|
|
1933
|
+
if (!n)
|
|
1934
1934
|
throw new Error(`Cube '${N}' not found`);
|
|
1935
1935
|
if (C.relationship === "belongsToMany" && C.through) {
|
|
1936
|
-
const L =
|
|
1936
|
+
const L = se(C, A.securityContext);
|
|
1937
1937
|
S.push({
|
|
1938
|
-
cube:
|
|
1938
|
+
cube: n,
|
|
1939
1939
|
alias: `${N.toLowerCase()}_cube`,
|
|
1940
1940
|
joinType: L.junctionJoins[1].joinType,
|
|
1941
1941
|
// Use the target join type
|
|
@@ -1958,7 +1958,7 @@ class pT {
|
|
|
1958
1958
|
// No target alias needed - use the actual column
|
|
1959
1959
|
), i = fE(C.relationship, C.sqlJoinType);
|
|
1960
1960
|
S.push({
|
|
1961
|
-
cube:
|
|
1961
|
+
cube: n,
|
|
1962
1962
|
alias: `${N.toLowerCase()}_cube`,
|
|
1963
1963
|
joinType: i,
|
|
1964
1964
|
joinCondition: L
|
|
@@ -1994,17 +1994,17 @@ class pT {
|
|
|
1994
1994
|
const { cube: t, path: s } = S.shift(), O = E.get(t);
|
|
1995
1995
|
if (O?.joins)
|
|
1996
1996
|
for (const [, N] of Object.entries(O.joins)) {
|
|
1997
|
-
const
|
|
1998
|
-
if (I.has(
|
|
1997
|
+
const n = sE(N.targetCube).name;
|
|
1998
|
+
if (I.has(n))
|
|
1999
1999
|
continue;
|
|
2000
2000
|
const L = [...s, {
|
|
2001
2001
|
fromCube: t,
|
|
2002
|
-
toCube:
|
|
2002
|
+
toCube: n,
|
|
2003
2003
|
joinDef: N
|
|
2004
2004
|
}];
|
|
2005
|
-
if (
|
|
2005
|
+
if (n === R)
|
|
2006
2006
|
return L;
|
|
2007
|
-
I.add(
|
|
2007
|
+
I.add(n), S.push({ cube: n, path: L });
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
2010
|
return null;
|
|
@@ -2030,7 +2030,7 @@ class pT {
|
|
|
2030
2030
|
const C = this.expandCalculatedMeasureDependencies(
|
|
2031
2031
|
I.cube,
|
|
2032
2032
|
N
|
|
2033
|
-
),
|
|
2033
|
+
), n = t.on.map((L) => ({
|
|
2034
2034
|
sourceColumn: L.source.name,
|
|
2035
2035
|
targetColumn: L.target.name,
|
|
2036
2036
|
sourceColumnObj: L.source,
|
|
@@ -2040,7 +2040,7 @@ class pT {
|
|
|
2040
2040
|
cube: I.cube,
|
|
2041
2041
|
alias: I.alias,
|
|
2042
2042
|
cteAlias: `${I.cube.name.toLowerCase()}_agg`,
|
|
2043
|
-
joinKeys:
|
|
2043
|
+
joinKeys: n,
|
|
2044
2044
|
measures: C
|
|
2045
2045
|
});
|
|
2046
2046
|
}
|
|
@@ -2145,9 +2145,9 @@ class pT {
|
|
|
2145
2145
|
O,
|
|
2146
2146
|
T
|
|
2147
2147
|
));
|
|
2148
|
-
const C = s.joinPaths.filter((L) => L.pathFound),
|
|
2148
|
+
const C = s.joinPaths.filter((L) => L.pathFound), n = s.joinPaths.filter((L) => !L.pathFound);
|
|
2149
2149
|
s.querySummary.joinCount = C.length, s.querySummary.cteCount = s.preAggregations.length, s.querySummary.hasPreAggregation = s.preAggregations.length > 0, s.preAggregations.length > 0 ? s.querySummary.queryType = "multi_cube_cte" : s.querySummary.queryType = "multi_cube_join";
|
|
2150
|
-
for (const L of
|
|
2150
|
+
for (const L of n)
|
|
2151
2151
|
s.warnings.push(
|
|
2152
2152
|
`No join path found to cube '${L.targetCube}'. Check that joins are defined correctly.`
|
|
2153
2153
|
);
|
|
@@ -2168,18 +2168,18 @@ class pT {
|
|
|
2168
2168
|
for (const O of S)
|
|
2169
2169
|
I.set(O, (I.get(O) || 0) + 1);
|
|
2170
2170
|
for (const O of E) {
|
|
2171
|
-
const N = R.get(O), C = I.get(O) || 0,
|
|
2171
|
+
const N = R.get(O), C = I.get(O) || 0, n = N?.joins ? Object.keys(N.joins).length : 0, L = this.canReachAllCubes(O, E, R);
|
|
2172
2172
|
A.push({
|
|
2173
2173
|
cubeName: O,
|
|
2174
2174
|
dimensionCount: C,
|
|
2175
|
-
joinCount:
|
|
2175
|
+
joinCount: n,
|
|
2176
2176
|
canReachAll: L
|
|
2177
2177
|
});
|
|
2178
2178
|
}
|
|
2179
2179
|
if (T.dimensions && T.dimensions.length > 0) {
|
|
2180
2180
|
const O = Math.max(...A.map((N) => N.dimensionCount));
|
|
2181
2181
|
if (O > 0) {
|
|
2182
|
-
const N = A.filter((C) => C.dimensionCount === O).sort((C,
|
|
2182
|
+
const N = A.filter((C) => C.dimensionCount === O).sort((C, n) => C.cubeName.localeCompare(n.cubeName));
|
|
2183
2183
|
for (const C of N)
|
|
2184
2184
|
if (C.canReachAll)
|
|
2185
2185
|
return {
|
|
@@ -2192,7 +2192,7 @@ class pT {
|
|
|
2192
2192
|
}
|
|
2193
2193
|
const t = A.filter((O) => O.canReachAll);
|
|
2194
2194
|
if (t.length > 0) {
|
|
2195
|
-
const O = Math.max(...t.map((C) => C.joinCount)), N = t.filter((C) => C.joinCount === O).sort((C,
|
|
2195
|
+
const O = Math.max(...t.map((C) => C.joinCount)), N = t.filter((C) => C.joinCount === O).sort((C, n) => C.cubeName.localeCompare(n.cubeName))[0];
|
|
2196
2196
|
return {
|
|
2197
2197
|
selectedCube: N.cubeName,
|
|
2198
2198
|
reason: "most_connected",
|
|
@@ -2216,16 +2216,16 @@ class pT {
|
|
|
2216
2216
|
const { cube: t, path: s } = S.shift(), O = E.get(t);
|
|
2217
2217
|
if (O?.joins)
|
|
2218
2218
|
for (const [, N] of Object.entries(O.joins)) {
|
|
2219
|
-
const
|
|
2220
|
-
if (I.has(
|
|
2219
|
+
const n = sE(N.targetCube).name;
|
|
2220
|
+
if (I.has(n))
|
|
2221
2221
|
continue;
|
|
2222
|
-
A.push(
|
|
2222
|
+
A.push(n), I.add(n);
|
|
2223
2223
|
const L = [...s, {
|
|
2224
2224
|
fromCube: t,
|
|
2225
|
-
toCube:
|
|
2225
|
+
toCube: n,
|
|
2226
2226
|
joinDef: N
|
|
2227
2227
|
}];
|
|
2228
|
-
if (
|
|
2228
|
+
if (n === R) {
|
|
2229
2229
|
const i = L.map((a) => {
|
|
2230
2230
|
const l = fE(a.joinDef.relationship, a.joinDef.sqlJoinType), P = a.joinDef.on.map((M) => ({
|
|
2231
2231
|
sourceColumn: M.source.name,
|
|
@@ -2255,7 +2255,7 @@ class pT {
|
|
|
2255
2255
|
visitedCubes: A
|
|
2256
2256
|
};
|
|
2257
2257
|
}
|
|
2258
|
-
S.push({ cube:
|
|
2258
|
+
S.push({ cube: n, path: L });
|
|
2259
2259
|
}
|
|
2260
2260
|
}
|
|
2261
2261
|
return {
|
|
@@ -2296,15 +2296,15 @@ class pT {
|
|
|
2296
2296
|
return S;
|
|
2297
2297
|
}
|
|
2298
2298
|
}
|
|
2299
|
-
function
|
|
2299
|
+
function re(e, E, T) {
|
|
2300
2300
|
const R = [];
|
|
2301
|
-
let A =
|
|
2302
|
-
const S =
|
|
2301
|
+
let A = ZE(new Date(e), T);
|
|
2302
|
+
const S = ZE(new Date(E), T), I = 1e4;
|
|
2303
2303
|
for (; A <= S && R.length < I; )
|
|
2304
|
-
R.push(new Date(A)), A =
|
|
2304
|
+
R.push(new Date(A)), A = _e(A, T);
|
|
2305
2305
|
return R;
|
|
2306
2306
|
}
|
|
2307
|
-
function
|
|
2307
|
+
function ZE(e, E) {
|
|
2308
2308
|
const T = new Date(e);
|
|
2309
2309
|
switch (E) {
|
|
2310
2310
|
case "second":
|
|
@@ -2338,7 +2338,7 @@ function jE(e, E) {
|
|
|
2338
2338
|
}
|
|
2339
2339
|
return T;
|
|
2340
2340
|
}
|
|
2341
|
-
function
|
|
2341
|
+
function _e(e, E) {
|
|
2342
2342
|
const T = new Date(e);
|
|
2343
2343
|
switch (E) {
|
|
2344
2344
|
case "second":
|
|
@@ -2368,7 +2368,7 @@ function ie(e, E) {
|
|
|
2368
2368
|
}
|
|
2369
2369
|
return T;
|
|
2370
2370
|
}
|
|
2371
|
-
function
|
|
2371
|
+
function ie(e) {
|
|
2372
2372
|
if (e instanceof Date)
|
|
2373
2373
|
return e.toISOString();
|
|
2374
2374
|
if (typeof e == "string") {
|
|
@@ -2378,24 +2378,24 @@ function ae(e) {
|
|
|
2378
2378
|
}
|
|
2379
2379
|
return String(e);
|
|
2380
2380
|
}
|
|
2381
|
-
function
|
|
2381
|
+
function ae(e, E) {
|
|
2382
2382
|
return E.length === 0 ? "__all__" : E.map((T) => String(e[T] ?? "")).join("|||");
|
|
2383
2383
|
}
|
|
2384
|
-
function
|
|
2385
|
-
const { timeDimensionKey: T, granularity: R, dateRange: A, fillValue: S, measures: I, dimensions: t } = E, s =
|
|
2384
|
+
function oe(e, E) {
|
|
2385
|
+
const { timeDimensionKey: T, granularity: R, dateRange: A, fillValue: S, measures: I, dimensions: t } = E, s = re(A[0], A[1], R);
|
|
2386
2386
|
if (s.length === 0)
|
|
2387
2387
|
return e;
|
|
2388
2388
|
const O = /* @__PURE__ */ new Map();
|
|
2389
2389
|
for (const C of e) {
|
|
2390
|
-
const
|
|
2391
|
-
O.has(
|
|
2390
|
+
const n = ae(C, t), L = ie(C[T]);
|
|
2391
|
+
O.has(n) || O.set(n, /* @__PURE__ */ new Map()), O.get(n).set(L, C);
|
|
2392
2392
|
}
|
|
2393
2393
|
O.size === 0 && t.length === 0 && O.set("__all__", /* @__PURE__ */ new Map());
|
|
2394
2394
|
const N = [];
|
|
2395
|
-
for (const [C,
|
|
2396
|
-
const L =
|
|
2395
|
+
for (const [C, n] of O) {
|
|
2396
|
+
const L = n.size > 0 ? n.values().next().value : null;
|
|
2397
2397
|
for (const i of s) {
|
|
2398
|
-
const a = i.toISOString(), l =
|
|
2398
|
+
const a = i.toISOString(), l = n.get(a);
|
|
2399
2399
|
if (l)
|
|
2400
2400
|
N.push(l);
|
|
2401
2401
|
else {
|
|
@@ -2413,7 +2413,7 @@ function De(e, E) {
|
|
|
2413
2413
|
}
|
|
2414
2414
|
return N;
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function De(e) {
|
|
2417
2417
|
if (!e)
|
|
2418
2418
|
return null;
|
|
2419
2419
|
if (Array.isArray(e)) {
|
|
@@ -2425,7 +2425,7 @@ function Pe(e) {
|
|
|
2425
2425
|
const E = new Date(e);
|
|
2426
2426
|
return isNaN(E.getTime()) ? null : [E, E];
|
|
2427
2427
|
}
|
|
2428
|
-
function
|
|
2428
|
+
function Pe(e, E, T) {
|
|
2429
2429
|
if (!E.timeDimensions || E.timeDimensions.length === 0)
|
|
2430
2430
|
return e;
|
|
2431
2431
|
const R = E.timeDimensions.filter((s) => {
|
|
@@ -2437,7 +2437,7 @@ function Me(e, E, T) {
|
|
|
2437
2437
|
const A = E.fillMissingDatesValue === void 0 ? 0 : E.fillMissingDatesValue, S = new Set(E.timeDimensions.map((s) => s.dimension)), I = (E.dimensions || []).filter((s) => !S.has(s));
|
|
2438
2438
|
let t = e;
|
|
2439
2439
|
for (const s of R) {
|
|
2440
|
-
const O =
|
|
2440
|
+
const O = De(s.dateRange);
|
|
2441
2441
|
if (!O)
|
|
2442
2442
|
continue;
|
|
2443
2443
|
const N = {
|
|
@@ -2448,7 +2448,7 @@ function Me(e, E, T) {
|
|
|
2448
2448
|
measures: T,
|
|
2449
2449
|
dimensions: I
|
|
2450
2450
|
};
|
|
2451
|
-
t =
|
|
2451
|
+
t = oe(t, N);
|
|
2452
2452
|
}
|
|
2453
2453
|
return t;
|
|
2454
2454
|
}
|
|
@@ -2456,7 +2456,7 @@ class LE {
|
|
|
2456
2456
|
constructor(E) {
|
|
2457
2457
|
if (this.dbExecutor = E, this.databaseAdapter = E.databaseAdapter, !this.databaseAdapter)
|
|
2458
2458
|
throw new Error("DatabaseExecutor must have a databaseAdapter property");
|
|
2459
|
-
this.queryBuilder = new ne(this.databaseAdapter), this.queryPlanner = new
|
|
2459
|
+
this.queryBuilder = new ne(this.databaseAdapter), this.queryPlanner = new dT();
|
|
2460
2460
|
}
|
|
2461
2461
|
queryBuilder;
|
|
2462
2462
|
queryPlanner;
|
|
@@ -2466,7 +2466,7 @@ class LE {
|
|
|
2466
2466
|
*/
|
|
2467
2467
|
async execute(E, T, R) {
|
|
2468
2468
|
try {
|
|
2469
|
-
const A =
|
|
2469
|
+
const A = wT(E, T);
|
|
2470
2470
|
if (!A.isValid)
|
|
2471
2471
|
throw new Error(`Query validation failed: ${A.errors.join(", ")}`);
|
|
2472
2472
|
const S = {
|
|
@@ -2487,9 +2487,9 @@ class LE {
|
|
|
2487
2487
|
}
|
|
2488
2488
|
}
|
|
2489
2489
|
return a;
|
|
2490
|
-
}) : [O], C = T.measures || [],
|
|
2490
|
+
}) : [O], C = T.measures || [], n = Pe(N, T, C), L = this.generateAnnotations(I, T);
|
|
2491
2491
|
return {
|
|
2492
|
-
data:
|
|
2492
|
+
data: n,
|
|
2493
2493
|
annotation: L
|
|
2494
2494
|
};
|
|
2495
2495
|
} catch (A) {
|
|
@@ -2545,10 +2545,10 @@ class LE {
|
|
|
2545
2545
|
if (Object.keys(t).length === 0)
|
|
2546
2546
|
return null;
|
|
2547
2547
|
let C = R.db.select(t).from(I.from);
|
|
2548
|
-
const
|
|
2548
|
+
const n = A ? {
|
|
2549
2549
|
...A,
|
|
2550
2550
|
preAggregationCTEs: A.preAggregationCTEs?.filter((P) => P.cube.name !== S.name)
|
|
2551
|
-
} : void 0, L = this.queryBuilder.buildWhereConditions(S, T, R,
|
|
2551
|
+
} : void 0, L = this.queryBuilder.buildWhereConditions(S, T, R, n), i = [];
|
|
2552
2552
|
if (T.timeDimensions)
|
|
2553
2553
|
for (const P of T.timeDimensions) {
|
|
2554
2554
|
const [U, M] = P.dimension.split(".");
|
|
@@ -2680,7 +2680,7 @@ class LE {
|
|
|
2680
2680
|
let Y = a.joinKeys.find((AE) => AE.targetColumn === M);
|
|
2681
2681
|
if (!Y && G?.dimensions?.[M]) {
|
|
2682
2682
|
const AE = G.dimensions[M].sql;
|
|
2683
|
-
Y = a.joinKeys.find((
|
|
2683
|
+
Y = a.joinKeys.find((xT) => xT.targetColumnObj === AE);
|
|
2684
2684
|
}
|
|
2685
2685
|
Y ? s[P] = _`${_.identifier(a.cteAlias)}.${_.identifier(M)}`.as(P) : B && G?.dimensions?.[M] && (s[P] = _`${_.identifier(a.cteAlias)}.${_.identifier(M)}`.as(P));
|
|
2686
2686
|
}
|
|
@@ -2772,7 +2772,7 @@ class LE {
|
|
|
2772
2772
|
const a = O.length === 1 ? O[0] : F(...O);
|
|
2773
2773
|
N = N.where(a);
|
|
2774
2774
|
}
|
|
2775
|
-
const
|
|
2775
|
+
const n = this.queryBuilder.buildGroupByFields(
|
|
2776
2776
|
E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
|
|
2777
2777
|
// Single cube
|
|
2778
2778
|
T,
|
|
@@ -2780,7 +2780,7 @@ class LE {
|
|
|
2780
2780
|
E
|
|
2781
2781
|
// Pass the queryPlan to handle CTE scenarios
|
|
2782
2782
|
);
|
|
2783
|
-
|
|
2783
|
+
n.length > 0 && (N = N.groupBy(...n));
|
|
2784
2784
|
const L = this.queryBuilder.buildHavingConditions(
|
|
2785
2785
|
E.joinCubes.length > 0 ? this.getCubesFromPlan(E) : E.primaryCube,
|
|
2786
2786
|
// Single cube
|
|
@@ -2883,13 +2883,13 @@ class LE {
|
|
|
2883
2883
|
};
|
|
2884
2884
|
}
|
|
2885
2885
|
}
|
|
2886
|
-
const
|
|
2886
|
+
const r = (e) => e.flatMap(Me), Me = (e) => k(ce(e)).map(Ue), Ue = (e) => e.replace(/ +/g, " ").trim(), ce = (e) => ({
|
|
2887
2887
|
type: "mandatory_block",
|
|
2888
2888
|
items: yE(e, 0)[0]
|
|
2889
2889
|
}), yE = (e, E, T) => {
|
|
2890
2890
|
const R = [];
|
|
2891
2891
|
for (; e[E]; ) {
|
|
2892
|
-
const [A, S] =
|
|
2892
|
+
const [A, S] = le(e, E);
|
|
2893
2893
|
if (R.push(A), E = S, e[E] === "|")
|
|
2894
2894
|
E++;
|
|
2895
2895
|
else if (e[E] === "}" || e[E] === "]") {
|
|
@@ -2904,44 +2904,44 @@ const n = (e) => e.flatMap(Ue), Ue = (e) => k(le(e)).map(ce), ce = (e) => e.repl
|
|
|
2904
2904
|
throw new Error(`Unexpected "${e[E]}"`);
|
|
2905
2905
|
}
|
|
2906
2906
|
return [R, E];
|
|
2907
|
-
},
|
|
2907
|
+
}, le = (e, E) => {
|
|
2908
2908
|
const T = [];
|
|
2909
2909
|
for (; ; ) {
|
|
2910
|
-
const [R, A] =
|
|
2910
|
+
const [R, A] = ue(e, E);
|
|
2911
2911
|
if (R)
|
|
2912
2912
|
T.push(R), E = A;
|
|
2913
2913
|
else
|
|
2914
2914
|
break;
|
|
2915
2915
|
}
|
|
2916
2916
|
return T.length === 1 ? [T[0], E] : [{ type: "concatenation", items: T }, E];
|
|
2917
|
-
},
|
|
2917
|
+
}, ue = (e, E) => {
|
|
2918
2918
|
if (e[E] === "{")
|
|
2919
|
-
return
|
|
2919
|
+
return Ge(e, E + 1);
|
|
2920
2920
|
if (e[E] === "[")
|
|
2921
|
-
return
|
|
2921
|
+
return He(e, E + 1);
|
|
2922
2922
|
{
|
|
2923
2923
|
let T = "";
|
|
2924
2924
|
for (; e[E] && /[A-Za-z0-9_ ]/.test(e[E]); )
|
|
2925
2925
|
T += e[E], E++;
|
|
2926
2926
|
return [T, E];
|
|
2927
2927
|
}
|
|
2928
|
-
},
|
|
2928
|
+
}, Ge = (e, E) => {
|
|
2929
2929
|
const [T, R] = yE(e, E, "}");
|
|
2930
2930
|
return [{ type: "mandatory_block", items: T }, R];
|
|
2931
|
-
},
|
|
2931
|
+
}, He = (e, E) => {
|
|
2932
2932
|
const [T, R] = yE(e, E, "]");
|
|
2933
2933
|
return [{ type: "optional_block", items: T }, R];
|
|
2934
2934
|
}, k = (e) => {
|
|
2935
2935
|
if (typeof e == "string")
|
|
2936
2936
|
return [e];
|
|
2937
2937
|
if (e.type === "concatenation")
|
|
2938
|
-
return e.items.map(k).reduce(
|
|
2938
|
+
return e.items.map(k).reduce(Be, [""]);
|
|
2939
2939
|
if (e.type === "mandatory_block")
|
|
2940
2940
|
return e.items.flatMap(k);
|
|
2941
2941
|
if (e.type === "optional_block")
|
|
2942
2942
|
return ["", ...e.items.flatMap(k)];
|
|
2943
2943
|
throw new Error(`Unknown node type: ${e}`);
|
|
2944
|
-
},
|
|
2944
|
+
}, Be = (e, E) => {
|
|
2945
2945
|
const T = [];
|
|
2946
2946
|
for (const R of e)
|
|
2947
2947
|
for (const A of E)
|
|
@@ -2952,19 +2952,19 @@ var D;
|
|
|
2952
2952
|
(function(e) {
|
|
2953
2953
|
e.QUOTED_IDENTIFIER = "QUOTED_IDENTIFIER", e.IDENTIFIER = "IDENTIFIER", e.STRING = "STRING", e.VARIABLE = "VARIABLE", e.RESERVED_DATA_TYPE = "RESERVED_DATA_TYPE", e.RESERVED_PARAMETERIZED_DATA_TYPE = "RESERVED_PARAMETERIZED_DATA_TYPE", e.RESERVED_KEYWORD = "RESERVED_KEYWORD", e.RESERVED_FUNCTION_NAME = "RESERVED_FUNCTION_NAME", e.RESERVED_KEYWORD_PHRASE = "RESERVED_KEYWORD_PHRASE", e.RESERVED_DATA_TYPE_PHRASE = "RESERVED_DATA_TYPE_PHRASE", e.RESERVED_SET_OPERATION = "RESERVED_SET_OPERATION", e.RESERVED_CLAUSE = "RESERVED_CLAUSE", e.RESERVED_SELECT = "RESERVED_SELECT", e.RESERVED_JOIN = "RESERVED_JOIN", e.ARRAY_IDENTIFIER = "ARRAY_IDENTIFIER", e.ARRAY_KEYWORD = "ARRAY_KEYWORD", e.CASE = "CASE", e.END = "END", e.WHEN = "WHEN", e.ELSE = "ELSE", e.THEN = "THEN", e.LIMIT = "LIMIT", e.BETWEEN = "BETWEEN", e.AND = "AND", e.OR = "OR", e.XOR = "XOR", e.OPERATOR = "OPERATOR", e.COMMA = "COMMA", e.ASTERISK = "ASTERISK", e.PROPERTY_ACCESS_OPERATOR = "PROPERTY_ACCESS_OPERATOR", e.OPEN_PAREN = "OPEN_PAREN", e.CLOSE_PAREN = "CLOSE_PAREN", e.LINE_COMMENT = "LINE_COMMENT", e.BLOCK_COMMENT = "BLOCK_COMMENT", e.DISABLE_COMMENT = "DISABLE_COMMENT", e.NUMBER = "NUMBER", e.NAMED_PARAMETER = "NAMED_PARAMETER", e.QUOTED_PARAMETER = "QUOTED_PARAMETER", e.NUMBERED_PARAMETER = "NUMBERED_PARAMETER", e.POSITIONAL_PARAMETER = "POSITIONAL_PARAMETER", e.CUSTOM_PARAMETER = "CUSTOM_PARAMETER", e.DELIMITER = "DELIMITER", e.EOF = "EOF";
|
|
2954
2954
|
})(D = D || (D = {}));
|
|
2955
|
-
const
|
|
2955
|
+
const pT = (e) => ({
|
|
2956
2956
|
type: D.EOF,
|
|
2957
2957
|
raw: "«EOF»",
|
|
2958
2958
|
text: "«EOF»",
|
|
2959
2959
|
start: e
|
|
2960
|
-
}), v =
|
|
2960
|
+
}), v = pT(1 / 0), w = (e) => (E) => E.type === e.type && E.text === e.text, y = {
|
|
2961
2961
|
ARRAY: w({ text: "ARRAY", type: D.RESERVED_DATA_TYPE }),
|
|
2962
2962
|
BY: w({ text: "BY", type: D.RESERVED_KEYWORD }),
|
|
2963
2963
|
SET: w({ text: "SET", type: D.RESERVED_CLAUSE }),
|
|
2964
2964
|
STRUCT: w({ text: "STRUCT", type: D.RESERVED_DATA_TYPE }),
|
|
2965
2965
|
WINDOW: w({ text: "WINDOW", type: D.RESERVED_CLAUSE }),
|
|
2966
2966
|
VALUES: w({ text: "VALUES", type: D.RESERVED_CLAUSE })
|
|
2967
|
-
},
|
|
2967
|
+
}, FT = (e) => e === D.RESERVED_DATA_TYPE || e === D.RESERVED_KEYWORD || e === D.RESERVED_FUNCTION_NAME || e === D.RESERVED_KEYWORD_PHRASE || e === D.RESERVED_DATA_TYPE_PHRASE || e === D.RESERVED_CLAUSE || e === D.RESERVED_SELECT || e === D.RESERVED_SET_OPERATION || e === D.RESERVED_JOIN || e === D.ARRAY_KEYWORD || e === D.CASE || e === D.END || e === D.WHEN || e === D.ELSE || e === D.THEN || e === D.LIMIT || e === D.BETWEEN || e === D.AND || e === D.OR || e === D.XOR, me = (e) => e === D.AND || e === D.OR || e === D.XOR, de = [
|
|
2968
2968
|
// https://cloud.google.com/bigquery/docs/reference/standard-sql/aead_encryption_functions
|
|
2969
2969
|
"KEYS.NEW_KEYSET",
|
|
2970
2970
|
"KEYS.ADD_KEY_FROM_RAW_BYTES",
|
|
@@ -3508,7 +3508,7 @@ const FT = (e) => ({
|
|
|
3508
3508
|
// pivot
|
|
3509
3509
|
"PIVOT",
|
|
3510
3510
|
"UNPIVOT"
|
|
3511
|
-
],
|
|
3511
|
+
], pe = [
|
|
3512
3512
|
// https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#reserved_keywords
|
|
3513
3513
|
"ALL",
|
|
3514
3514
|
"AND",
|
|
@@ -3616,7 +3616,7 @@ const FT = (e) => ({
|
|
|
3616
3616
|
"CASCADE",
|
|
3617
3617
|
"RESTRICT",
|
|
3618
3618
|
"DETERMINISTIC"
|
|
3619
|
-
],
|
|
3619
|
+
], Fe = [
|
|
3620
3620
|
// https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types
|
|
3621
3621
|
"ARRAY",
|
|
3622
3622
|
"BOOL",
|
|
@@ -3641,7 +3641,7 @@ const FT = (e) => ({
|
|
|
3641
3641
|
"STRUCT",
|
|
3642
3642
|
"TIME",
|
|
3643
3643
|
"TIMEZONE"
|
|
3644
|
-
],
|
|
3644
|
+
], Ye = r(["SELECT [ALL | DISTINCT] [AS STRUCT | AS VALUE]"]), he = r([
|
|
3645
3645
|
// Queries: https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax
|
|
3646
3646
|
"WITH [RECURSIVE]",
|
|
3647
3647
|
"FROM",
|
|
@@ -3670,9 +3670,9 @@ const FT = (e) => ({
|
|
|
3670
3670
|
"WITH CONNECTION",
|
|
3671
3671
|
"WITH PARTITION COLUMNS",
|
|
3672
3672
|
"REMOTE WITH CONNECTION"
|
|
3673
|
-
]),
|
|
3673
|
+
]), jE = r([
|
|
3674
3674
|
"CREATE [OR REPLACE] [TEMP|TEMPORARY|SNAPSHOT|EXTERNAL] TABLE [IF NOT EXISTS]"
|
|
3675
|
-
]),
|
|
3675
|
+
]), nE = r([
|
|
3676
3676
|
// - create:
|
|
3677
3677
|
// https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language
|
|
3678
3678
|
"CREATE [OR REPLACE] [MATERIALIZED] VIEW [IF NOT EXISTS]",
|
|
@@ -3760,15 +3760,15 @@ const FT = (e) => ({
|
|
|
3760
3760
|
"ASSERT",
|
|
3761
3761
|
// Other, https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements
|
|
3762
3762
|
"EXPORT DATA"
|
|
3763
|
-
]),
|
|
3763
|
+
]), fe = r([
|
|
3764
3764
|
"UNION {ALL | DISTINCT}",
|
|
3765
3765
|
"EXCEPT DISTINCT",
|
|
3766
3766
|
"INTERSECT DISTINCT"
|
|
3767
|
-
]),
|
|
3767
|
+
]), Ve = r([
|
|
3768
3768
|
"JOIN",
|
|
3769
3769
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
3770
3770
|
"{INNER | CROSS} JOIN"
|
|
3771
|
-
]),
|
|
3771
|
+
]), We = r([
|
|
3772
3772
|
// https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#tablesample_operator
|
|
3773
3773
|
"TABLESAMPLE SYSTEM",
|
|
3774
3774
|
// From DDL: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language
|
|
@@ -3779,18 +3779,18 @@ const FT = (e) => ({
|
|
|
3779
3779
|
"{ROWS | RANGE} BETWEEN",
|
|
3780
3780
|
// comparison operator
|
|
3781
3781
|
"IS [NOT] DISTINCT FROM"
|
|
3782
|
-
]),
|
|
3782
|
+
]), be = r([]), Xe = {
|
|
3783
3783
|
name: "bigquery",
|
|
3784
3784
|
tokenizerOptions: {
|
|
3785
|
-
reservedSelect:
|
|
3786
|
-
reservedClauses: [...
|
|
3787
|
-
reservedSetOperations:
|
|
3788
|
-
reservedJoins:
|
|
3789
|
-
reservedKeywordPhrases:
|
|
3790
|
-
reservedDataTypePhrases:
|
|
3791
|
-
reservedKeywords:
|
|
3792
|
-
reservedDataTypes:
|
|
3793
|
-
reservedFunctionNames:
|
|
3785
|
+
reservedSelect: Ye,
|
|
3786
|
+
reservedClauses: [...he, ...nE, ...jE],
|
|
3787
|
+
reservedSetOperations: fe,
|
|
3788
|
+
reservedJoins: Ve,
|
|
3789
|
+
reservedKeywordPhrases: We,
|
|
3790
|
+
reservedDataTypePhrases: be,
|
|
3791
|
+
reservedKeywords: pe,
|
|
3792
|
+
reservedDataTypes: Fe,
|
|
3793
|
+
reservedFunctionNames: de,
|
|
3794
3794
|
extraParens: ["[]"],
|
|
3795
3795
|
stringTypes: [
|
|
3796
3796
|
// The triple-quoted strings are listed first, so they get matched first.
|
|
@@ -3808,31 +3808,31 @@ const FT = (e) => ({
|
|
|
3808
3808
|
variableTypes: [{ regex: String.raw`@@\w+` }],
|
|
3809
3809
|
lineCommentTypes: ["--", "#"],
|
|
3810
3810
|
operators: ["&", "|", "^", "~", ">>", "<<", "||", "=>"],
|
|
3811
|
-
postProcess:
|
|
3811
|
+
postProcess: ye
|
|
3812
3812
|
},
|
|
3813
3813
|
formatOptions: {
|
|
3814
|
-
onelineClauses: [...
|
|
3815
|
-
tabularOnelineClauses:
|
|
3814
|
+
onelineClauses: [...jE, ...nE],
|
|
3815
|
+
tabularOnelineClauses: nE
|
|
3816
3816
|
}
|
|
3817
3817
|
};
|
|
3818
|
-
function
|
|
3819
|
-
return Ke(
|
|
3818
|
+
function ye(e) {
|
|
3819
|
+
return ge(Ke(e));
|
|
3820
3820
|
}
|
|
3821
|
-
function
|
|
3821
|
+
function ge(e) {
|
|
3822
3822
|
let E = v;
|
|
3823
3823
|
return e.map((T) => T.text === "OFFSET" && E.text === "[" ? (E = T, Object.assign(Object.assign({}, T), { type: D.RESERVED_FUNCTION_NAME })) : (E = T, T));
|
|
3824
3824
|
}
|
|
3825
|
-
function
|
|
3825
|
+
function Ke(e) {
|
|
3826
3826
|
var E;
|
|
3827
3827
|
const T = [];
|
|
3828
3828
|
for (let R = 0; R < e.length; R++) {
|
|
3829
3829
|
const A = e[R];
|
|
3830
3830
|
if ((y.ARRAY(A) || y.STRUCT(A)) && ((E = e[R + 1]) === null || E === void 0 ? void 0 : E.text) === "<") {
|
|
3831
|
-
const S =
|
|
3831
|
+
const S = $e(e, R + 1), I = e.slice(R, S + 1);
|
|
3832
3832
|
T.push({
|
|
3833
3833
|
type: D.IDENTIFIER,
|
|
3834
|
-
raw: I.map(
|
|
3835
|
-
text: I.map(
|
|
3834
|
+
raw: I.map(qE("raw")).join(""),
|
|
3835
|
+
text: I.map(qE("text")).join(""),
|
|
3836
3836
|
start: A.start
|
|
3837
3837
|
}), R = S;
|
|
3838
3838
|
} else
|
|
@@ -3840,8 +3840,8 @@ function $e(e) {
|
|
|
3840
3840
|
}
|
|
3841
3841
|
return T;
|
|
3842
3842
|
}
|
|
3843
|
-
const
|
|
3844
|
-
function
|
|
3843
|
+
const qE = (e) => (E) => E.type === D.IDENTIFIER || E.type === D.COMMA ? E[e] + " " : E[e];
|
|
3844
|
+
function $e(e, E) {
|
|
3845
3845
|
let T = 0;
|
|
3846
3846
|
for (let R = E; R < e.length; R++) {
|
|
3847
3847
|
const A = e[R];
|
|
@@ -3850,7 +3850,7 @@ function we(e, E) {
|
|
|
3850
3850
|
}
|
|
3851
3851
|
return e.length - 1;
|
|
3852
3852
|
}
|
|
3853
|
-
const
|
|
3853
|
+
const we = [
|
|
3854
3854
|
// https://www.ibm.com/docs/en/db2/11.5?topic=bif-aggregate-functions
|
|
3855
3855
|
"ARRAY_AGG",
|
|
3856
3856
|
"AVG",
|
|
@@ -4170,7 +4170,7 @@ const Je = [
|
|
|
4170
4170
|
"RATIO_TO_REPORT",
|
|
4171
4171
|
// Type casting
|
|
4172
4172
|
"CAST"
|
|
4173
|
-
],
|
|
4173
|
+
], Je = [
|
|
4174
4174
|
// https://www.ibm.com/docs/en/db2/11.5?topic=sql-reserved-schema-names-reserved-words
|
|
4175
4175
|
"ACTIVATE",
|
|
4176
4176
|
"ADD",
|
|
@@ -4571,7 +4571,7 @@ const Je = [
|
|
|
4571
4571
|
"XMLNAMESPACES",
|
|
4572
4572
|
"YEAR",
|
|
4573
4573
|
"YEARS"
|
|
4574
|
-
],
|
|
4574
|
+
], xe = [
|
|
4575
4575
|
// https://www.ibm.com/docs/en/db2-for-zos/12?topic=columns-data-types
|
|
4576
4576
|
"ARRAY",
|
|
4577
4577
|
"BIGINT",
|
|
@@ -4613,7 +4613,7 @@ const Je = [
|
|
|
4613
4613
|
"VARBINARY",
|
|
4614
4614
|
"VARCHAR",
|
|
4615
4615
|
"VARGRAPHIC"
|
|
4616
|
-
],
|
|
4616
|
+
], ve = r(["SELECT [ALL | DISTINCT]"]), Qe = r([
|
|
4617
4617
|
// queries
|
|
4618
4618
|
"WITH",
|
|
4619
4619
|
"FROM",
|
|
@@ -4642,9 +4642,9 @@ const Je = [
|
|
|
4642
4642
|
"WHEN [NOT] MATCHED [THEN]",
|
|
4643
4643
|
"UPDATE SET",
|
|
4644
4644
|
"INSERT"
|
|
4645
|
-
]),
|
|
4645
|
+
]), kE = r([
|
|
4646
4646
|
"CREATE [GLOBAL TEMPORARY | EXTERNAL] TABLE [IF NOT EXISTS]"
|
|
4647
|
-
]),
|
|
4647
|
+
]), rE = r([
|
|
4648
4648
|
// - create:
|
|
4649
4649
|
"CREATE [OR REPLACE] VIEW",
|
|
4650
4650
|
// - update:
|
|
@@ -4847,27 +4847,27 @@ const Je = [
|
|
|
4847
4847
|
"TRANSFER OWNERSHIP OF",
|
|
4848
4848
|
"WHENEVER {NOT FOUND | SQLERROR | SQLWARNING}",
|
|
4849
4849
|
"WHILE"
|
|
4850
|
-
]),
|
|
4850
|
+
]), Ze = r(["UNION [ALL]", "EXCEPT [ALL]", "INTERSECT [ALL]"]), je = r([
|
|
4851
4851
|
"JOIN",
|
|
4852
4852
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
4853
4853
|
"{INNER | CROSS} JOIN"
|
|
4854
|
-
]),
|
|
4854
|
+
]), qe = r([
|
|
4855
4855
|
"ON DELETE",
|
|
4856
4856
|
"ON UPDATE",
|
|
4857
4857
|
"SET NULL",
|
|
4858
4858
|
"{ROWS | RANGE} BETWEEN"
|
|
4859
|
-
]),
|
|
4859
|
+
]), ke = r([]), ze = {
|
|
4860
4860
|
name: "db2",
|
|
4861
4861
|
tokenizerOptions: {
|
|
4862
|
-
reservedSelect:
|
|
4863
|
-
reservedClauses: [...
|
|
4864
|
-
reservedSetOperations:
|
|
4865
|
-
reservedJoins:
|
|
4866
|
-
reservedKeywordPhrases:
|
|
4867
|
-
reservedDataTypePhrases:
|
|
4868
|
-
reservedKeywords:
|
|
4869
|
-
reservedDataTypes:
|
|
4870
|
-
reservedFunctionNames:
|
|
4862
|
+
reservedSelect: ve,
|
|
4863
|
+
reservedClauses: [...Qe, ...kE, ...rE],
|
|
4864
|
+
reservedSetOperations: Ze,
|
|
4865
|
+
reservedJoins: je,
|
|
4866
|
+
reservedKeywordPhrases: qe,
|
|
4867
|
+
reservedDataTypePhrases: ke,
|
|
4868
|
+
reservedKeywords: Je,
|
|
4869
|
+
reservedDataTypes: xe,
|
|
4870
|
+
reservedFunctionNames: we,
|
|
4871
4871
|
extraParens: ["[]"],
|
|
4872
4872
|
stringTypes: [
|
|
4873
4873
|
{ quote: "''-qq", prefixes: ["G", "N", "U&"] },
|
|
@@ -4898,10 +4898,10 @@ const Je = [
|
|
|
4898
4898
|
]
|
|
4899
4899
|
},
|
|
4900
4900
|
formatOptions: {
|
|
4901
|
-
onelineClauses: [...
|
|
4902
|
-
tabularOnelineClauses:
|
|
4901
|
+
onelineClauses: [...kE, ...rE],
|
|
4902
|
+
tabularOnelineClauses: rE
|
|
4903
4903
|
}
|
|
4904
|
-
},
|
|
4904
|
+
}, ER = [
|
|
4905
4905
|
// https://www.ibm.com/docs/en/i/7.5?topic=functions-aggregate
|
|
4906
4906
|
// TODO: 'ANY', - conflicts with test for ANY predicate in 'operators.ys'!!
|
|
4907
4907
|
"ARRAY_AGG",
|
|
@@ -5235,7 +5235,7 @@ const Je = [
|
|
|
5235
5235
|
"ROW_NUMBER",
|
|
5236
5236
|
// Type casting
|
|
5237
5237
|
"CAST"
|
|
5238
|
-
],
|
|
5238
|
+
], TR = [
|
|
5239
5239
|
// https://www.ibm.com/docs/en/i/7.5?topic=words-reserved
|
|
5240
5240
|
// TODO: This list likely contains all keywords, not only the reserved ones,
|
|
5241
5241
|
// try to filter it down to just the reserved keywords.
|
|
@@ -5731,7 +5731,7 @@ const Je = [
|
|
|
5731
5731
|
"YEARS",
|
|
5732
5732
|
"YES",
|
|
5733
5733
|
"ZONE"
|
|
5734
|
-
],
|
|
5734
|
+
], eR = [
|
|
5735
5735
|
// https://www.ibm.com/docs/en/i/7.2?topic=iaodsd-odbc-data-types-how-they-correspond-db2-i-database-types
|
|
5736
5736
|
"ARRAY",
|
|
5737
5737
|
"BIGINT",
|
|
@@ -5767,7 +5767,7 @@ const Je = [
|
|
|
5767
5767
|
"VARCHAR",
|
|
5768
5768
|
"VARGRAPHIC",
|
|
5769
5769
|
"XML"
|
|
5770
|
-
],
|
|
5770
|
+
], RR = r(["SELECT [ALL | DISTINCT]"]), AR = r([
|
|
5771
5771
|
// queries
|
|
5772
5772
|
"WITH [RECURSIVE]",
|
|
5773
5773
|
"INTO",
|
|
@@ -5797,7 +5797,7 @@ const Je = [
|
|
|
5797
5797
|
"INSERT",
|
|
5798
5798
|
// Data definition - table
|
|
5799
5799
|
"FOR SYSTEM NAME"
|
|
5800
|
-
]),
|
|
5800
|
+
]), zE = r(["CREATE [OR REPLACE] TABLE"]), _E = r([
|
|
5801
5801
|
// - create:
|
|
5802
5802
|
"CREATE [OR REPLACE] [RECURSIVE] VIEW",
|
|
5803
5803
|
// - update:
|
|
@@ -5893,28 +5893,28 @@ const Je = [
|
|
|
5893
5893
|
"TAG",
|
|
5894
5894
|
"TRANSFER OWNERSHIP OF",
|
|
5895
5895
|
"WHENEVER {NOT FOUND | SQLERROR | SQLWARNING}"
|
|
5896
|
-
]),
|
|
5896
|
+
]), SR = r(["UNION [ALL]", "EXCEPT [ALL]", "INTERSECT [ALL]"]), IR = r([
|
|
5897
5897
|
"JOIN",
|
|
5898
5898
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
5899
5899
|
"[LEFT | RIGHT] EXCEPTION JOIN",
|
|
5900
5900
|
"{INNER | CROSS} JOIN"
|
|
5901
|
-
]),
|
|
5901
|
+
]), NR = r([
|
|
5902
5902
|
"ON DELETE",
|
|
5903
5903
|
"ON UPDATE",
|
|
5904
5904
|
"SET NULL",
|
|
5905
5905
|
"{ROWS | RANGE} BETWEEN"
|
|
5906
|
-
]),
|
|
5906
|
+
]), tR = r([]), sR = {
|
|
5907
5907
|
name: "db2i",
|
|
5908
5908
|
tokenizerOptions: {
|
|
5909
|
-
reservedSelect:
|
|
5910
|
-
reservedClauses: [...
|
|
5911
|
-
reservedSetOperations:
|
|
5912
|
-
reservedJoins:
|
|
5913
|
-
reservedKeywordPhrases:
|
|
5914
|
-
reservedDataTypePhrases:
|
|
5915
|
-
reservedKeywords:
|
|
5916
|
-
reservedDataTypes:
|
|
5917
|
-
reservedFunctionNames:
|
|
5909
|
+
reservedSelect: RR,
|
|
5910
|
+
reservedClauses: [...AR, ...zE, ..._E],
|
|
5911
|
+
reservedSetOperations: SR,
|
|
5912
|
+
reservedJoins: IR,
|
|
5913
|
+
reservedKeywordPhrases: NR,
|
|
5914
|
+
reservedDataTypePhrases: tR,
|
|
5915
|
+
reservedKeywords: TR,
|
|
5916
|
+
reservedDataTypes: eR,
|
|
5917
|
+
reservedFunctionNames: ER,
|
|
5918
5918
|
nestedBlockComments: !0,
|
|
5919
5919
|
extraParens: ["[]"],
|
|
5920
5920
|
stringTypes: [
|
|
@@ -5928,10 +5928,10 @@ const Je = [
|
|
|
5928
5928
|
operators: ["**", "¬=", "¬>", "¬<", "!>", "!<", "||", "=>"]
|
|
5929
5929
|
},
|
|
5930
5930
|
formatOptions: {
|
|
5931
|
-
onelineClauses: [...
|
|
5931
|
+
onelineClauses: [...zE, ..._E],
|
|
5932
5932
|
tabularOnelineClauses: _E
|
|
5933
5933
|
}
|
|
5934
|
-
},
|
|
5934
|
+
}, CR = [
|
|
5935
5935
|
// Functions from DuckDB (excluding those that start with an underscore):
|
|
5936
5936
|
// SELECT DISTINCT upper(function_name) AS function_name
|
|
5937
5937
|
// FROM duckdb_functions()
|
|
@@ -6594,7 +6594,7 @@ const Je = [
|
|
|
6594
6594
|
// 'NULL', we really prefer treating it as keyword
|
|
6595
6595
|
"RANK",
|
|
6596
6596
|
"ROW_NUMBER"
|
|
6597
|
-
],
|
|
6597
|
+
], LR = [
|
|
6598
6598
|
// Keywords from DuckDB:
|
|
6599
6599
|
// SELECT upper(keyword_name)
|
|
6600
6600
|
// FROM duckdb_keywords()
|
|
@@ -6756,7 +6756,7 @@ const Je = [
|
|
|
6756
6756
|
"UUID",
|
|
6757
6757
|
"VARBINARY",
|
|
6758
6758
|
"VARCHAR"
|
|
6759
|
-
],
|
|
6759
|
+
], rR = r(["SELECT [ALL | DISTINCT]"]), _R = r([
|
|
6760
6760
|
// queries
|
|
6761
6761
|
"WITH [RECURSIVE]",
|
|
6762
6762
|
"FROM",
|
|
@@ -6780,9 +6780,9 @@ const Je = [
|
|
|
6780
6780
|
"SET",
|
|
6781
6781
|
// other:
|
|
6782
6782
|
"RETURNING"
|
|
6783
|
-
]),
|
|
6783
|
+
]), ET = r([
|
|
6784
6784
|
"CREATE [OR REPLACE] [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]"
|
|
6785
|
-
]), iE =
|
|
6785
|
+
]), iE = r([
|
|
6786
6786
|
// TABLE
|
|
6787
6787
|
// - update:
|
|
6788
6788
|
"UPDATE",
|
|
@@ -6860,11 +6860,11 @@ const Je = [
|
|
|
6860
6860
|
"PREPARE",
|
|
6861
6861
|
"EXECUTE",
|
|
6862
6862
|
"DEALLOCATE [PREPARE]"
|
|
6863
|
-
]),
|
|
6863
|
+
]), iR = r([
|
|
6864
6864
|
"UNION [ALL | BY NAME]",
|
|
6865
6865
|
"EXCEPT [ALL]",
|
|
6866
6866
|
"INTERSECT [ALL]"
|
|
6867
|
-
]),
|
|
6867
|
+
]), aR = r([
|
|
6868
6868
|
"JOIN",
|
|
6869
6869
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
6870
6870
|
"{INNER | CROSS} JOIN",
|
|
@@ -6873,23 +6873,23 @@ const Je = [
|
|
|
6873
6873
|
"POSITIONAL JOIN",
|
|
6874
6874
|
"ANTI JOIN",
|
|
6875
6875
|
"SEMI JOIN"
|
|
6876
|
-
]),
|
|
6876
|
+
]), oR = r([
|
|
6877
6877
|
"{ROWS | RANGE | GROUPS} BETWEEN",
|
|
6878
6878
|
"SIMILAR TO",
|
|
6879
6879
|
"IS [NOT] DISTINCT FROM"
|
|
6880
|
-
]),
|
|
6880
|
+
]), DR = r(["TIMESTAMP WITH TIME ZONE"]), PR = {
|
|
6881
6881
|
name: "duckdb",
|
|
6882
6882
|
tokenizerOptions: {
|
|
6883
|
-
reservedSelect:
|
|
6884
|
-
reservedClauses: [...
|
|
6885
|
-
reservedSetOperations:
|
|
6886
|
-
reservedJoins:
|
|
6887
|
-
reservedKeywordPhrases:
|
|
6888
|
-
reservedDataTypePhrases:
|
|
6883
|
+
reservedSelect: rR,
|
|
6884
|
+
reservedClauses: [..._R, ...ET, ...iE],
|
|
6885
|
+
reservedSetOperations: iR,
|
|
6886
|
+
reservedJoins: aR,
|
|
6887
|
+
reservedKeywordPhrases: oR,
|
|
6888
|
+
reservedDataTypePhrases: DR,
|
|
6889
6889
|
supportsXor: !0,
|
|
6890
|
-
reservedKeywords:
|
|
6890
|
+
reservedKeywords: LR,
|
|
6891
6891
|
reservedDataTypes: nR,
|
|
6892
|
-
reservedFunctionNames:
|
|
6892
|
+
reservedFunctionNames: CR,
|
|
6893
6893
|
nestedBlockComments: !0,
|
|
6894
6894
|
extraParens: ["[]", "{}"],
|
|
6895
6895
|
underscoresInNumbers: !0,
|
|
@@ -6950,10 +6950,10 @@ const Je = [
|
|
|
6950
6950
|
},
|
|
6951
6951
|
formatOptions: {
|
|
6952
6952
|
alwaysDenseOperators: ["::"],
|
|
6953
|
-
onelineClauses: [...
|
|
6953
|
+
onelineClauses: [...ET, ...iE],
|
|
6954
6954
|
tabularOnelineClauses: iE
|
|
6955
6955
|
}
|
|
6956
|
-
},
|
|
6956
|
+
}, MR = [
|
|
6957
6957
|
// https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF
|
|
6958
6958
|
// math
|
|
6959
6959
|
"ABS",
|
|
@@ -7161,7 +7161,7 @@ const Je = [
|
|
|
7161
7161
|
"CUME_DIST",
|
|
7162
7162
|
"PERCENT_RANK",
|
|
7163
7163
|
"NTILE"
|
|
7164
|
-
],
|
|
7164
|
+
], UR = [
|
|
7165
7165
|
// https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl
|
|
7166
7166
|
// Non-reserved keywords have proscribed meanings in. HiveQL, but can still be used as table or column names
|
|
7167
7167
|
"ADD",
|
|
@@ -7476,7 +7476,7 @@ const Je = [
|
|
|
7476
7476
|
"JSONFILE",
|
|
7477
7477
|
"INPUTFORMAT",
|
|
7478
7478
|
"OUTPUTFORMAT"
|
|
7479
|
-
],
|
|
7479
|
+
], cR = [
|
|
7480
7480
|
// https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types
|
|
7481
7481
|
"ARRAY",
|
|
7482
7482
|
"BIGINT",
|
|
@@ -7497,7 +7497,7 @@ const Je = [
|
|
|
7497
7497
|
"STRUCT",
|
|
7498
7498
|
"TIMESTAMP",
|
|
7499
7499
|
"VARCHAR"
|
|
7500
|
-
],
|
|
7500
|
+
], lR = r(["SELECT [ALL | DISTINCT]"]), uR = r([
|
|
7501
7501
|
// queries
|
|
7502
7502
|
"WITH",
|
|
7503
7503
|
"FROM",
|
|
@@ -7531,9 +7531,9 @@ const Je = [
|
|
|
7531
7531
|
// https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-Loadingfilesintotables
|
|
7532
7532
|
"LOAD DATA [LOCAL] INPATH",
|
|
7533
7533
|
"[OVERWRITE] INTO TABLE"
|
|
7534
|
-
]),
|
|
7534
|
+
]), TT = r([
|
|
7535
7535
|
"CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS]"
|
|
7536
|
-
]), aE =
|
|
7536
|
+
]), aE = r([
|
|
7537
7537
|
// - create:
|
|
7538
7538
|
"CREATE [MATERIALIZED] VIEW [IF NOT EXISTS]",
|
|
7539
7539
|
// - update:
|
|
@@ -7558,24 +7558,24 @@ const Je = [
|
|
|
7558
7558
|
"STORED AS",
|
|
7559
7559
|
"STORED BY",
|
|
7560
7560
|
"ROW FORMAT"
|
|
7561
|
-
]),
|
|
7561
|
+
]), GR = r(["UNION [ALL | DISTINCT]"]), HR = r([
|
|
7562
7562
|
"JOIN",
|
|
7563
7563
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
7564
7564
|
"{INNER | CROSS} JOIN",
|
|
7565
7565
|
// non-standard joins
|
|
7566
7566
|
"LEFT SEMI JOIN"
|
|
7567
|
-
]),
|
|
7567
|
+
]), BR = r(["{ROWS | RANGE} BETWEEN"]), mR = r([]), dR = {
|
|
7568
7568
|
name: "hive",
|
|
7569
7569
|
tokenizerOptions: {
|
|
7570
|
-
reservedSelect:
|
|
7571
|
-
reservedClauses: [...
|
|
7572
|
-
reservedSetOperations:
|
|
7573
|
-
reservedJoins:
|
|
7574
|
-
reservedKeywordPhrases:
|
|
7570
|
+
reservedSelect: lR,
|
|
7571
|
+
reservedClauses: [...uR, ...TT, ...aE],
|
|
7572
|
+
reservedSetOperations: GR,
|
|
7573
|
+
reservedJoins: HR,
|
|
7574
|
+
reservedKeywordPhrases: BR,
|
|
7575
7575
|
reservedDataTypePhrases: mR,
|
|
7576
|
-
reservedKeywords:
|
|
7577
|
-
reservedDataTypes:
|
|
7578
|
-
reservedFunctionNames:
|
|
7576
|
+
reservedKeywords: UR,
|
|
7577
|
+
reservedDataTypes: cR,
|
|
7578
|
+
reservedFunctionNames: MR,
|
|
7579
7579
|
extraParens: ["[]"],
|
|
7580
7580
|
stringTypes: ['""-bs', "''-bs"],
|
|
7581
7581
|
identTypes: ["``"],
|
|
@@ -7583,7 +7583,7 @@ const Je = [
|
|
|
7583
7583
|
operators: ["%", "~", "^", "|", "&", "<=>", "==", "!", "||"]
|
|
7584
7584
|
},
|
|
7585
7585
|
formatOptions: {
|
|
7586
|
-
onelineClauses: [...
|
|
7586
|
+
onelineClauses: [...TT, ...aE],
|
|
7587
7587
|
tabularOnelineClauses: aE
|
|
7588
7588
|
}
|
|
7589
7589
|
};
|
|
@@ -7596,7 +7596,7 @@ function RE(e) {
|
|
|
7596
7596
|
return y.VALUES(E) && A.text === "=" ? Object.assign(Object.assign({}, E), { type: D.RESERVED_FUNCTION_NAME }) : E;
|
|
7597
7597
|
});
|
|
7598
7598
|
}
|
|
7599
|
-
const
|
|
7599
|
+
const pR = [
|
|
7600
7600
|
// https://mariadb.com/kb/en/reserved-words/
|
|
7601
7601
|
"ACCESSIBLE",
|
|
7602
7602
|
"ADD",
|
|
@@ -7813,7 +7813,7 @@ const FR = [
|
|
|
7813
7813
|
"XOR",
|
|
7814
7814
|
"YEAR_MONTH",
|
|
7815
7815
|
"ZEROFILL"
|
|
7816
|
-
],
|
|
7816
|
+
], FR = [
|
|
7817
7817
|
// https://mariadb.com/kb/en/data-types/
|
|
7818
7818
|
"BIGINT",
|
|
7819
7819
|
"BINARY",
|
|
@@ -7864,7 +7864,7 @@ const FR = [
|
|
|
7864
7864
|
"YEAR"
|
|
7865
7865
|
// 'NUMBER', // ?? In oracle mode only
|
|
7866
7866
|
// 'SET' // handled as special-case in postProcess
|
|
7867
|
-
],
|
|
7867
|
+
], YR = [
|
|
7868
7868
|
// https://mariadb.com/kb/en/information-schema-sql_functions-table/
|
|
7869
7869
|
"ADDDATE",
|
|
7870
7870
|
"ADD_MONTHS",
|
|
@@ -8102,7 +8102,7 @@ const FR = [
|
|
|
8102
8102
|
// CASE expression shorthands
|
|
8103
8103
|
"COALESCE",
|
|
8104
8104
|
"NULLIF"
|
|
8105
|
-
],
|
|
8105
|
+
], hR = r(["SELECT [ALL | DISTINCT | DISTINCTROW]"]), fR = r([
|
|
8106
8106
|
// queries
|
|
8107
8107
|
"WITH [RECURSIVE]",
|
|
8108
8108
|
"FROM",
|
|
@@ -8124,9 +8124,9 @@ const FR = [
|
|
|
8124
8124
|
"SET",
|
|
8125
8125
|
// other
|
|
8126
8126
|
"RETURNING"
|
|
8127
|
-
]),
|
|
8127
|
+
]), eT = r([
|
|
8128
8128
|
"CREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]"
|
|
8129
|
-
]), oE =
|
|
8129
|
+
]), oE = r([
|
|
8130
8130
|
// - create:
|
|
8131
8131
|
"CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]",
|
|
8132
8132
|
// - update:
|
|
@@ -8333,12 +8333,12 @@ const FR = [
|
|
|
8333
8333
|
"XA RECOVER",
|
|
8334
8334
|
"XA ROLLBACK",
|
|
8335
8335
|
"XA START"
|
|
8336
|
-
]),
|
|
8336
|
+
]), VR = r([
|
|
8337
8337
|
"UNION [ALL | DISTINCT]",
|
|
8338
8338
|
"EXCEPT [ALL | DISTINCT]",
|
|
8339
8339
|
"INTERSECT [ALL | DISTINCT]",
|
|
8340
8340
|
"MINUS [ALL | DISTINCT]"
|
|
8341
|
-
]),
|
|
8341
|
+
]), WR = r([
|
|
8342
8342
|
"JOIN",
|
|
8343
8343
|
"{LEFT | RIGHT} [OUTER] JOIN",
|
|
8344
8344
|
"{INNER | CROSS} JOIN",
|
|
@@ -8346,24 +8346,24 @@ const FR = [
|
|
|
8346
8346
|
"NATURAL {LEFT | RIGHT} [OUTER] JOIN",
|
|
8347
8347
|
// non-standard joins
|
|
8348
8348
|
"STRAIGHT_JOIN"
|
|
8349
|
-
]),
|
|
8349
|
+
]), bR = r([
|
|
8350
8350
|
"ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]",
|
|
8351
8351
|
"CHARACTER SET",
|
|
8352
8352
|
"{ROWS | RANGE} BETWEEN",
|
|
8353
8353
|
"IDENTIFIED BY"
|
|
8354
|
-
]),
|
|
8354
|
+
]), XR = r([]), yR = {
|
|
8355
8355
|
name: "mariadb",
|
|
8356
8356
|
tokenizerOptions: {
|
|
8357
|
-
reservedSelect:
|
|
8358
|
-
reservedClauses: [...
|
|
8359
|
-
reservedSetOperations:
|
|
8360
|
-
reservedJoins:
|
|
8361
|
-
reservedKeywordPhrases:
|
|
8362
|
-
reservedDataTypePhrases:
|
|
8357
|
+
reservedSelect: hR,
|
|
8358
|
+
reservedClauses: [...fR, ...eT, ...oE],
|
|
8359
|
+
reservedSetOperations: VR,
|
|
8360
|
+
reservedJoins: WR,
|
|
8361
|
+
reservedKeywordPhrases: bR,
|
|
8362
|
+
reservedDataTypePhrases: XR,
|
|
8363
8363
|
supportsXor: !0,
|
|
8364
|
-
reservedKeywords:
|
|
8365
|
-
reservedDataTypes:
|
|
8366
|
-
reservedFunctionNames:
|
|
8364
|
+
reservedKeywords: pR,
|
|
8365
|
+
reservedDataTypes: FR,
|
|
8366
|
+
reservedFunctionNames: YR,
|
|
8367
8367
|
// TODO: support _ char set prefixes such as _utf8, _latin1, _binary, _utf8mb4, etc.
|
|
8368
8368
|
stringTypes: [
|
|
8369
8369
|
'""-qq-bs',
|
|
@@ -8399,10 +8399,10 @@ const FR = [
|
|
|
8399
8399
|
postProcess: RE
|
|
8400
8400
|
},
|
|
8401
8401
|
formatOptions: {
|
|
8402
|
-
onelineClauses: [...
|
|
8402
|
+
onelineClauses: [...eT, ...oE],
|
|
8403
8403
|
tabularOnelineClauses: oE
|
|
8404
8404
|
}
|
|
8405
|
-
},
|
|
8405
|
+
}, gR = [
|
|
8406
8406
|
// https://dev.mysql.com/doc/refman/8.0/en/keywords.html
|
|
8407
8407
|
"ACCESSIBLE",
|
|
8408
8408
|
"ADD",
|
|
@@ -8633,7 +8633,7 @@ const FR = [
|
|
|
8633
8633
|
"YEAR_MONTH",
|
|
8634
8634
|
"ZEROFILL"
|
|
8635
8635
|
// (R)
|
|
8636
|
-
],
|
|
8636
|
+
], KR = [
|
|
8637
8637
|
// https://dev.mysql.com/doc/refman/8.0/en/data-types.html
|
|
8638
8638
|
"BIGINT",
|
|
8639
8639
|
"BINARY",
|
|
@@ -8685,7 +8685,7 @@ const FR = [
|
|
|
8685
8685
|
"VARYING",
|
|
8686
8686
|
"YEAR"
|
|
8687
8687
|
// 'SET' // handled as special-case in postProcess
|
|
8688
|
-
],
|
|
8688
|
+
], $R = [
|
|
8689
8689
|
// https://dev.mysql.com/doc/refman/8.0/en/built-in-function-reference.html
|
|
8690
8690
|
"ABS",
|
|
8691
8691
|
"ACOS",
|
|
@@ -9108,7 +9108,7 @@ const FR = [
|
|
|
9108
9108
|
// 'XOR',
|
|
9109
9109
|
"YEAR",
|
|
9110
9110
|
"YEARWEEK"
|
|
9111
|
-
],
|
|
9111
|
+
], wR = r(["SELECT [ALL | DISTINCT | DISTINCTROW]"]), JR = r([
|
|
9112
9112
|
// queries
|
|
9113
9113
|
"WITH [RECURSIVE]",
|
|
9114
9114
|
"FROM",
|
|
@@ -9128,7 +9128,7 @@ const FR = [
|
|
|
9128
9128
|
"ON DUPLICATE KEY UPDATE",
|
|
9129
9129
|
// - update:
|
|
9130
9130
|
"SET"
|
|
9131
|
-
]),
|
|
9131
|
+
]), RT = r(["CREATE [TEMPORARY] TABLE [IF NOT EXISTS]"]), DE = r([
|
|
9132
9132
|
// - create:
|
|
9133
9133
|
"CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]",
|
|
9134
9134
|
// - update:
|
|
@@ -9309,7 +9309,7 @@ const FR = [
|
|
|
9309
9309
|
"REPEAT",
|
|
9310
9310
|
"RETURN",
|
|
9311
9311
|
"WHILE"
|
|
9312
|
-
]),
|
|
9312
|
+
]), xR = r(["UNION [ALL | DISTINCT]"]), vR = r([
|
|
9313
9313
|
"JOIN",
|
|
9314
9314
|
"{LEFT | RIGHT} [OUTER] JOIN",
|
|
9315
9315
|
"{INNER | CROSS} JOIN",
|
|
@@ -9317,24 +9317,24 @@ const FR = [
|
|
|
9317
9317
|
"NATURAL {LEFT | RIGHT} [OUTER] JOIN",
|
|
9318
9318
|
// non-standard joins
|
|
9319
9319
|
"STRAIGHT_JOIN"
|
|
9320
|
-
]),
|
|
9320
|
+
]), QR = r([
|
|
9321
9321
|
"ON {UPDATE | DELETE} [SET NULL]",
|
|
9322
9322
|
"CHARACTER SET",
|
|
9323
9323
|
"{ROWS | RANGE} BETWEEN",
|
|
9324
9324
|
"IDENTIFIED BY"
|
|
9325
|
-
]),
|
|
9325
|
+
]), ZR = r([]), jR = {
|
|
9326
9326
|
name: "mysql",
|
|
9327
9327
|
tokenizerOptions: {
|
|
9328
|
-
reservedSelect:
|
|
9329
|
-
reservedClauses: [...
|
|
9330
|
-
reservedSetOperations:
|
|
9331
|
-
reservedJoins:
|
|
9332
|
-
reservedKeywordPhrases:
|
|
9333
|
-
reservedDataTypePhrases:
|
|
9328
|
+
reservedSelect: wR,
|
|
9329
|
+
reservedClauses: [...JR, ...RT, ...DE],
|
|
9330
|
+
reservedSetOperations: xR,
|
|
9331
|
+
reservedJoins: vR,
|
|
9332
|
+
reservedKeywordPhrases: QR,
|
|
9333
|
+
reservedDataTypePhrases: ZR,
|
|
9334
9334
|
supportsXor: !0,
|
|
9335
|
-
reservedKeywords:
|
|
9336
|
-
reservedDataTypes:
|
|
9337
|
-
reservedFunctionNames:
|
|
9335
|
+
reservedKeywords: gR,
|
|
9336
|
+
reservedDataTypes: KR,
|
|
9337
|
+
reservedFunctionNames: $R,
|
|
9338
9338
|
// TODO: support _ char set prefixes such as _utf8, _latin1, _binary, _utf8mb4, etc.
|
|
9339
9339
|
stringTypes: [
|
|
9340
9340
|
'""-qq-bs',
|
|
@@ -9372,10 +9372,10 @@ const FR = [
|
|
|
9372
9372
|
postProcess: RE
|
|
9373
9373
|
},
|
|
9374
9374
|
formatOptions: {
|
|
9375
|
-
onelineClauses: [...
|
|
9375
|
+
onelineClauses: [...RT, ...DE],
|
|
9376
9376
|
tabularOnelineClauses: DE
|
|
9377
9377
|
}
|
|
9378
|
-
},
|
|
9378
|
+
}, qR = [
|
|
9379
9379
|
// https://docs.pingcap.com/tidb/stable/keywords
|
|
9380
9380
|
"ADD",
|
|
9381
9381
|
"ALL",
|
|
@@ -9567,7 +9567,7 @@ const FR = [
|
|
|
9567
9567
|
"YEAR_MONTH",
|
|
9568
9568
|
"ZEROFILL"
|
|
9569
9569
|
// (R)
|
|
9570
|
-
],
|
|
9570
|
+
], kR = [
|
|
9571
9571
|
// https://docs.pingcap.com/tidb/stable/data-type-overview
|
|
9572
9572
|
"BIGINT",
|
|
9573
9573
|
"BINARY",
|
|
@@ -9614,7 +9614,7 @@ const FR = [
|
|
|
9614
9614
|
"VARYING",
|
|
9615
9615
|
"YEAR"
|
|
9616
9616
|
// 'SET' // handled as special-case in postProcess
|
|
9617
|
-
],
|
|
9617
|
+
], zR = [
|
|
9618
9618
|
// https://docs.pingcap.com/tidb/stable/sql-statement-show-builtins
|
|
9619
9619
|
// https://docs.pingcap.com/tidb/stable/functions-and-operators-overview
|
|
9620
9620
|
// + MySQL aggregate functions: https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html
|
|
@@ -9940,7 +9940,7 @@ const FR = [
|
|
|
9940
9940
|
// 'XOR',
|
|
9941
9941
|
"YEAR",
|
|
9942
9942
|
"YEARWEEK"
|
|
9943
|
-
],
|
|
9943
|
+
], EA = r(["SELECT [ALL | DISTINCT | DISTINCTROW]"]), TA = r([
|
|
9944
9944
|
// queries
|
|
9945
9945
|
"WITH [RECURSIVE]",
|
|
9946
9946
|
"FROM",
|
|
@@ -9960,7 +9960,7 @@ const FR = [
|
|
|
9960
9960
|
"ON DUPLICATE KEY UPDATE",
|
|
9961
9961
|
// - update:
|
|
9962
9962
|
"SET"
|
|
9963
|
-
]),
|
|
9963
|
+
]), AT = r(["CREATE [TEMPORARY] TABLE [IF NOT EXISTS]"]), PE = r([
|
|
9964
9964
|
// https://docs.pingcap.com/tidb/stable/sql-statement-create-view
|
|
9965
9965
|
"CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]",
|
|
9966
9966
|
// https://docs.pingcap.com/tidb/stable/sql-statement-update
|
|
@@ -10075,7 +10075,7 @@ const FR = [
|
|
|
10075
10075
|
"UNLOCK TABLES",
|
|
10076
10076
|
// https://docs.pingcap.com/tidb/stable/sql-statement-use
|
|
10077
10077
|
"USE"
|
|
10078
|
-
]),
|
|
10078
|
+
]), eA = r(["UNION [ALL | DISTINCT]"]), RA = r([
|
|
10079
10079
|
"JOIN",
|
|
10080
10080
|
"{LEFT | RIGHT} [OUTER] JOIN",
|
|
10081
10081
|
"{INNER | CROSS} JOIN",
|
|
@@ -10083,24 +10083,24 @@ const FR = [
|
|
|
10083
10083
|
"NATURAL {LEFT | RIGHT} [OUTER] JOIN",
|
|
10084
10084
|
// non-standard joins
|
|
10085
10085
|
"STRAIGHT_JOIN"
|
|
10086
|
-
]),
|
|
10086
|
+
]), AA = r([
|
|
10087
10087
|
"ON {UPDATE | DELETE} [SET NULL]",
|
|
10088
10088
|
"CHARACTER SET",
|
|
10089
10089
|
"{ROWS | RANGE} BETWEEN",
|
|
10090
10090
|
"IDENTIFIED BY"
|
|
10091
|
-
]),
|
|
10091
|
+
]), SA = r([]), IA = {
|
|
10092
10092
|
name: "tidb",
|
|
10093
10093
|
tokenizerOptions: {
|
|
10094
|
-
reservedSelect:
|
|
10095
|
-
reservedClauses: [...
|
|
10096
|
-
reservedSetOperations:
|
|
10097
|
-
reservedJoins:
|
|
10098
|
-
reservedKeywordPhrases:
|
|
10099
|
-
reservedDataTypePhrases:
|
|
10094
|
+
reservedSelect: EA,
|
|
10095
|
+
reservedClauses: [...TA, ...AT, ...PE],
|
|
10096
|
+
reservedSetOperations: eA,
|
|
10097
|
+
reservedJoins: RA,
|
|
10098
|
+
reservedKeywordPhrases: AA,
|
|
10099
|
+
reservedDataTypePhrases: SA,
|
|
10100
10100
|
supportsXor: !0,
|
|
10101
|
-
reservedKeywords:
|
|
10102
|
-
reservedDataTypes:
|
|
10103
|
-
reservedFunctionNames:
|
|
10101
|
+
reservedKeywords: qR,
|
|
10102
|
+
reservedDataTypes: kR,
|
|
10103
|
+
reservedFunctionNames: zR,
|
|
10104
10104
|
// TODO: support _ char set prefixes such as _utf8, _latin1, _binary, _utf8mb4, etc.
|
|
10105
10105
|
stringTypes: [
|
|
10106
10106
|
'""-qq-bs',
|
|
@@ -10138,10 +10138,10 @@ const FR = [
|
|
|
10138
10138
|
postProcess: RE
|
|
10139
10139
|
},
|
|
10140
10140
|
formatOptions: {
|
|
10141
|
-
onelineClauses: [...
|
|
10141
|
+
onelineClauses: [...AT, ...PE],
|
|
10142
10142
|
tabularOnelineClauses: PE
|
|
10143
10143
|
}
|
|
10144
|
-
},
|
|
10144
|
+
}, OA = [
|
|
10145
10145
|
// https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/functions.html
|
|
10146
10146
|
"ABORT",
|
|
10147
10147
|
"ABS",
|
|
@@ -10371,7 +10371,7 @@ const FR = [
|
|
|
10371
10371
|
// not implemented in N1QL, but added here now for the sake of tests
|
|
10372
10372
|
// https://docs.couchbase.com/server/current/analytics/3_query.html#Vs_SQL-92
|
|
10373
10373
|
"CAST"
|
|
10374
|
-
],
|
|
10374
|
+
], NA = [
|
|
10375
10375
|
// https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/reservedwords.html
|
|
10376
10376
|
"ADVISE",
|
|
10377
10377
|
"ALL",
|
|
@@ -10577,7 +10577,7 @@ const FR = [
|
|
|
10577
10577
|
"WITHIN",
|
|
10578
10578
|
"WORK",
|
|
10579
10579
|
"XOR"
|
|
10580
|
-
],
|
|
10580
|
+
], tA = [
|
|
10581
10581
|
// N1QL does not support any way of declaring types for columns.
|
|
10582
10582
|
// It does not support the CREATE TABLE statement nor the CAST() expression.
|
|
10583
10583
|
//
|
|
@@ -10586,7 +10586,7 @@ const FR = [
|
|
|
10586
10586
|
// which it actually doesn't use.
|
|
10587
10587
|
//
|
|
10588
10588
|
// https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/datatypes.html
|
|
10589
|
-
],
|
|
10589
|
+
], sA = r(["SELECT [ALL | DISTINCT]"]), CA = r([
|
|
10590
10590
|
// queries
|
|
10591
10591
|
"WITH",
|
|
10592
10592
|
"FROM",
|
|
@@ -10613,7 +10613,7 @@ const FR = [
|
|
|
10613
10613
|
"NEST",
|
|
10614
10614
|
"UNNEST",
|
|
10615
10615
|
"RETURNING"
|
|
10616
|
-
]),
|
|
10616
|
+
]), ST = r([
|
|
10617
10617
|
// - update:
|
|
10618
10618
|
"UPDATE",
|
|
10619
10619
|
// - delete:
|
|
@@ -10653,19 +10653,19 @@ const FR = [
|
|
|
10653
10653
|
"SET CURRENT SCHEMA",
|
|
10654
10654
|
"SHOW",
|
|
10655
10655
|
"USE [PRIMARY] KEYS"
|
|
10656
|
-
]),
|
|
10656
|
+
]), LA = r(["UNION [ALL]", "EXCEPT [ALL]", "INTERSECT [ALL]"]), nA = r(["JOIN", "{LEFT | RIGHT} [OUTER] JOIN", "INNER JOIN"]), rA = r(["{ROWS | RANGE | GROUPS} BETWEEN"]), _A = r([]), iA = {
|
|
10657
10657
|
name: "n1ql",
|
|
10658
10658
|
tokenizerOptions: {
|
|
10659
|
-
reservedSelect:
|
|
10660
|
-
reservedClauses: [...
|
|
10661
|
-
reservedSetOperations:
|
|
10659
|
+
reservedSelect: sA,
|
|
10660
|
+
reservedClauses: [...CA, ...ST],
|
|
10661
|
+
reservedSetOperations: LA,
|
|
10662
10662
|
reservedJoins: nA,
|
|
10663
|
-
reservedKeywordPhrases:
|
|
10664
|
-
reservedDataTypePhrases:
|
|
10663
|
+
reservedKeywordPhrases: rA,
|
|
10664
|
+
reservedDataTypePhrases: _A,
|
|
10665
10665
|
supportsXor: !0,
|
|
10666
|
-
reservedKeywords:
|
|
10667
|
-
reservedDataTypes:
|
|
10668
|
-
reservedFunctionNames:
|
|
10666
|
+
reservedKeywords: NA,
|
|
10667
|
+
reservedDataTypes: tA,
|
|
10668
|
+
reservedFunctionNames: OA,
|
|
10669
10669
|
// NOTE: single quotes are actually not supported in N1QL,
|
|
10670
10670
|
// but we support them anyway as all other SQL dialects do,
|
|
10671
10671
|
// which simplifies writing tests that are shared between all dialects.
|
|
@@ -10677,9 +10677,9 @@ const FR = [
|
|
|
10677
10677
|
operators: ["%", "==", ":", "||"]
|
|
10678
10678
|
},
|
|
10679
10679
|
formatOptions: {
|
|
10680
|
-
onelineClauses:
|
|
10680
|
+
onelineClauses: ST
|
|
10681
10681
|
}
|
|
10682
|
-
},
|
|
10682
|
+
}, aA = [
|
|
10683
10683
|
// https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/reservewords.htm
|
|
10684
10684
|
// 'A',
|
|
10685
10685
|
"ADD",
|
|
@@ -10984,7 +10984,7 @@ const FR = [
|
|
|
10984
10984
|
"WRITE",
|
|
10985
10985
|
"YEAR",
|
|
10986
10986
|
"ZONE"
|
|
10987
|
-
],
|
|
10987
|
+
], oA = [
|
|
10988
10988
|
// https://www.ibm.com/docs/en/db2/10.5?topic=plsql-data-types
|
|
10989
10989
|
"ARRAY",
|
|
10990
10990
|
"BFILE_BASE",
|
|
@@ -11022,7 +11022,7 @@ const FR = [
|
|
|
11022
11022
|
"UROWID",
|
|
11023
11023
|
"VARCHAR",
|
|
11024
11024
|
"VARCHAR2"
|
|
11025
|
-
],
|
|
11025
|
+
], DA = [
|
|
11026
11026
|
// https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions001.htm
|
|
11027
11027
|
// numeric
|
|
11028
11028
|
"ABS",
|
|
@@ -11287,7 +11287,7 @@ const FR = [
|
|
|
11287
11287
|
"PRESENTNNV",
|
|
11288
11288
|
"PRESENTV",
|
|
11289
11289
|
"PREVIOUS"
|
|
11290
|
-
],
|
|
11290
|
+
], PA = r(["SELECT [ALL | DISTINCT | UNIQUE]"]), MA = r([
|
|
11291
11291
|
// queries
|
|
11292
11292
|
"WITH",
|
|
11293
11293
|
"FROM",
|
|
@@ -11311,9 +11311,9 @@ const FR = [
|
|
|
11311
11311
|
"UPDATE SET",
|
|
11312
11312
|
// other
|
|
11313
11313
|
"RETURNING"
|
|
11314
|
-
]),
|
|
11314
|
+
]), IT = r([
|
|
11315
11315
|
"CREATE [GLOBAL TEMPORARY | PRIVATE TEMPORARY | SHARDED | DUPLICATED | IMMUTABLE BLOCKCHAIN | BLOCKCHAIN | IMMUTABLE] TABLE"
|
|
11316
|
-
]), ME =
|
|
11316
|
+
]), ME = r([
|
|
11317
11317
|
// - create:
|
|
11318
11318
|
"CREATE [OR REPLACE] [NO FORCE | FORCE] [EDITIONING | EDITIONABLE | EDITIONABLE EDITIONING | NONEDITIONABLE] VIEW",
|
|
11319
11319
|
"CREATE MATERIALIZED VIEW",
|
|
@@ -11341,7 +11341,7 @@ const FR = [
|
|
|
11341
11341
|
"EXCEPTION",
|
|
11342
11342
|
"LOOP",
|
|
11343
11343
|
"START WITH"
|
|
11344
|
-
]),
|
|
11344
|
+
]), UA = r(["UNION [ALL]", "MINUS", "INTERSECT"]), cA = r([
|
|
11345
11345
|
"JOIN",
|
|
11346
11346
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
11347
11347
|
"{INNER | CROSS} JOIN",
|
|
@@ -11349,23 +11349,23 @@ const FR = [
|
|
|
11349
11349
|
"NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
11350
11350
|
// non-standard joins
|
|
11351
11351
|
"{CROSS | OUTER} APPLY"
|
|
11352
|
-
]),
|
|
11352
|
+
]), lA = r([
|
|
11353
11353
|
"ON {UPDATE | DELETE} [SET NULL]",
|
|
11354
11354
|
"ON COMMIT",
|
|
11355
11355
|
"{ROWS | RANGE} BETWEEN"
|
|
11356
|
-
]),
|
|
11356
|
+
]), uA = r([]), GA = {
|
|
11357
11357
|
name: "plsql",
|
|
11358
11358
|
tokenizerOptions: {
|
|
11359
|
-
reservedSelect:
|
|
11360
|
-
reservedClauses: [...
|
|
11361
|
-
reservedSetOperations:
|
|
11362
|
-
reservedJoins:
|
|
11363
|
-
reservedKeywordPhrases:
|
|
11364
|
-
reservedDataTypePhrases:
|
|
11359
|
+
reservedSelect: PA,
|
|
11360
|
+
reservedClauses: [...MA, ...IT, ...ME],
|
|
11361
|
+
reservedSetOperations: UA,
|
|
11362
|
+
reservedJoins: cA,
|
|
11363
|
+
reservedKeywordPhrases: lA,
|
|
11364
|
+
reservedDataTypePhrases: uA,
|
|
11365
11365
|
supportsXor: !0,
|
|
11366
|
-
reservedKeywords:
|
|
11367
|
-
reservedDataTypes:
|
|
11368
|
-
reservedFunctionNames:
|
|
11366
|
+
reservedKeywords: aA,
|
|
11367
|
+
reservedDataTypes: oA,
|
|
11368
|
+
reservedFunctionNames: DA,
|
|
11369
11369
|
stringTypes: [
|
|
11370
11370
|
{ quote: "''-qq", prefixes: ["N"] },
|
|
11371
11371
|
{ quote: "q''", prefixes: ["N"] }
|
|
@@ -11390,19 +11390,19 @@ const FR = [
|
|
|
11390
11390
|
"@",
|
|
11391
11391
|
"||"
|
|
11392
11392
|
],
|
|
11393
|
-
postProcess:
|
|
11393
|
+
postProcess: HA
|
|
11394
11394
|
},
|
|
11395
11395
|
formatOptions: {
|
|
11396
11396
|
alwaysDenseOperators: ["@"],
|
|
11397
|
-
onelineClauses: [...
|
|
11397
|
+
onelineClauses: [...IT, ...ME],
|
|
11398
11398
|
tabularOnelineClauses: ME
|
|
11399
11399
|
}
|
|
11400
11400
|
};
|
|
11401
|
-
function
|
|
11401
|
+
function HA(e) {
|
|
11402
11402
|
let E = v;
|
|
11403
|
-
return e.map((T) => y.SET(T) && y.BY(E) ? Object.assign(Object.assign({}, T), { type: D.RESERVED_KEYWORD }) : (
|
|
11403
|
+
return e.map((T) => y.SET(T) && y.BY(E) ? Object.assign(Object.assign({}, T), { type: D.RESERVED_KEYWORD }) : (FT(T.type) && (E = T), T));
|
|
11404
11404
|
}
|
|
11405
|
-
const
|
|
11405
|
+
const BA = [
|
|
11406
11406
|
// https://www.postgresql.org/docs/14/functions.html
|
|
11407
11407
|
//
|
|
11408
11408
|
// https://www.postgresql.org/docs/14/functions-math.html
|
|
@@ -12209,7 +12209,7 @@ const dA = [
|
|
|
12209
12209
|
"WITHOUT",
|
|
12210
12210
|
"YEAR"
|
|
12211
12211
|
// requires AS
|
|
12212
|
-
],
|
|
12212
|
+
], dA = [
|
|
12213
12213
|
// https://www.postgresql.org/docs/current/datatype.html
|
|
12214
12214
|
"ARRAY",
|
|
12215
12215
|
"BIGINT",
|
|
@@ -12243,7 +12243,7 @@ const dA = [
|
|
|
12243
12243
|
"VARCHAR",
|
|
12244
12244
|
"XML",
|
|
12245
12245
|
"ZONE"
|
|
12246
|
-
],
|
|
12246
|
+
], pA = r(["SELECT [ALL | DISTINCT]"]), FA = r([
|
|
12247
12247
|
// queries
|
|
12248
12248
|
"WITH [RECURSIVE]",
|
|
12249
12249
|
"FROM",
|
|
@@ -12266,9 +12266,9 @@ const dA = [
|
|
|
12266
12266
|
"SET",
|
|
12267
12267
|
// other
|
|
12268
12268
|
"RETURNING"
|
|
12269
|
-
]),
|
|
12269
|
+
]), OT = r([
|
|
12270
12270
|
"CREATE [GLOBAL | LOCAL] [TEMPORARY | TEMP | UNLOGGED] TABLE [IF NOT EXISTS]"
|
|
12271
|
-
]), UE =
|
|
12271
|
+
]), UE = r([
|
|
12272
12272
|
// - create
|
|
12273
12273
|
"CREATE [OR REPLACE] [TEMP | TEMPORARY] [RECURSIVE] VIEW",
|
|
12274
12274
|
"CREATE [MATERIALIZED] VIEW [IF NOT EXISTS]",
|
|
@@ -12467,17 +12467,17 @@ const dA = [
|
|
|
12467
12467
|
"START TRANSACTION",
|
|
12468
12468
|
"UNLISTEN",
|
|
12469
12469
|
"VACUUM"
|
|
12470
|
-
]),
|
|
12470
|
+
]), YA = r([
|
|
12471
12471
|
"UNION [ALL | DISTINCT]",
|
|
12472
12472
|
"EXCEPT [ALL | DISTINCT]",
|
|
12473
12473
|
"INTERSECT [ALL | DISTINCT]"
|
|
12474
|
-
]),
|
|
12474
|
+
]), hA = r([
|
|
12475
12475
|
"JOIN",
|
|
12476
12476
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
12477
12477
|
"{INNER | CROSS} JOIN",
|
|
12478
12478
|
"NATURAL [INNER] JOIN",
|
|
12479
12479
|
"NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"
|
|
12480
|
-
]),
|
|
12480
|
+
]), fA = r([
|
|
12481
12481
|
"PRIMARY KEY",
|
|
12482
12482
|
"GENERATED {ALWAYS | BY DEFAULT} AS IDENTITY",
|
|
12483
12483
|
"ON {UPDATE | DELETE} [NO ACTION | RESTRICT | CASCADE | SET NULL | SET DEFAULT]",
|
|
@@ -12488,21 +12488,21 @@ const dA = [
|
|
|
12488
12488
|
"IS [NOT] DISTINCT FROM",
|
|
12489
12489
|
"NULLS {FIRST | LAST}",
|
|
12490
12490
|
"WITH ORDINALITY"
|
|
12491
|
-
]),
|
|
12491
|
+
]), VA = r([
|
|
12492
12492
|
// https://www.postgresql.org/docs/current/datatype-datetime.html
|
|
12493
12493
|
"[TIMESTAMP | TIME] {WITH | WITHOUT} TIME ZONE"
|
|
12494
|
-
]),
|
|
12494
|
+
]), WA = {
|
|
12495
12495
|
name: "postgresql",
|
|
12496
12496
|
tokenizerOptions: {
|
|
12497
|
-
reservedSelect:
|
|
12498
|
-
reservedClauses: [...
|
|
12499
|
-
reservedSetOperations:
|
|
12500
|
-
reservedJoins:
|
|
12501
|
-
reservedKeywordPhrases:
|
|
12502
|
-
reservedDataTypePhrases:
|
|
12497
|
+
reservedSelect: pA,
|
|
12498
|
+
reservedClauses: [...FA, ...OT, ...UE],
|
|
12499
|
+
reservedSetOperations: YA,
|
|
12500
|
+
reservedJoins: hA,
|
|
12501
|
+
reservedKeywordPhrases: fA,
|
|
12502
|
+
reservedDataTypePhrases: VA,
|
|
12503
12503
|
reservedKeywords: mA,
|
|
12504
|
-
reservedDataTypes:
|
|
12505
|
-
reservedFunctionNames:
|
|
12504
|
+
reservedDataTypes: dA,
|
|
12505
|
+
reservedFunctionNames: BA,
|
|
12506
12506
|
nestedBlockComments: !0,
|
|
12507
12507
|
extraParens: ["[]"],
|
|
12508
12508
|
underscoresInNumbers: !0,
|
|
@@ -12614,10 +12614,10 @@ const dA = [
|
|
|
12614
12614
|
},
|
|
12615
12615
|
formatOptions: {
|
|
12616
12616
|
alwaysDenseOperators: ["::", ":"],
|
|
12617
|
-
onelineClauses: [...
|
|
12617
|
+
onelineClauses: [...OT, ...UE],
|
|
12618
12618
|
tabularOnelineClauses: UE
|
|
12619
12619
|
}
|
|
12620
|
-
},
|
|
12620
|
+
}, bA = [
|
|
12621
12621
|
// https://docs.aws.amazon.com/redshift/latest/dg/c_Aggregate_Functions.html
|
|
12622
12622
|
"ANY_VALUE",
|
|
12623
12623
|
"APPROXIMATE PERCENTILE_DISC",
|
|
@@ -12963,7 +12963,7 @@ const dA = [
|
|
|
12963
12963
|
"SLICE_NUM",
|
|
12964
12964
|
"USER",
|
|
12965
12965
|
"VERSION"
|
|
12966
|
-
],
|
|
12966
|
+
], XA = [
|
|
12967
12967
|
// https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html
|
|
12968
12968
|
"AES128",
|
|
12969
12969
|
"AES256",
|
|
@@ -13152,7 +13152,7 @@ const dA = [
|
|
|
13152
13152
|
* SVL: https://docs.aws.amazon.com/redshift/latest/dg/svl_views.html
|
|
13153
13153
|
* SVV: https://docs.aws.amazon.com/redshift/latest/dg/svv_views.html
|
|
13154
13154
|
*/
|
|
13155
|
-
],
|
|
13155
|
+
], yA = [
|
|
13156
13156
|
// https://docs.aws.amazon.com/redshift/latest/dg/r_Character_types.html#r_Character_types-text-and-bpchar-types
|
|
13157
13157
|
"ARRAY",
|
|
13158
13158
|
"BIGINT",
|
|
@@ -13173,7 +13173,7 @@ const dA = [
|
|
|
13173
13173
|
"TEXT",
|
|
13174
13174
|
"VARBYTE",
|
|
13175
13175
|
"VARCHAR"
|
|
13176
|
-
],
|
|
13176
|
+
], gA = r(["SELECT [ALL | DISTINCT]"]), KA = r([
|
|
13177
13177
|
// queries
|
|
13178
13178
|
"WITH [RECURSIVE]",
|
|
13179
13179
|
"FROM",
|
|
@@ -13191,9 +13191,9 @@ const dA = [
|
|
|
13191
13191
|
"VALUES",
|
|
13192
13192
|
// - update:
|
|
13193
13193
|
"SET"
|
|
13194
|
-
]),
|
|
13194
|
+
]), NT = r([
|
|
13195
13195
|
"CREATE [TEMPORARY | TEMP | LOCAL TEMPORARY | LOCAL TEMP] TABLE [IF NOT EXISTS]"
|
|
13196
|
-
]), cE =
|
|
13196
|
+
]), cE = r([
|
|
13197
13197
|
// - create:
|
|
13198
13198
|
"CREATE [OR REPLACE | MATERIALIZED] VIEW",
|
|
13199
13199
|
// - update:
|
|
@@ -13284,13 +13284,13 @@ const dA = [
|
|
|
13284
13284
|
"START TRANSACTION",
|
|
13285
13285
|
"UNLOAD",
|
|
13286
13286
|
"VACUUM"
|
|
13287
|
-
]),
|
|
13287
|
+
]), $A = r(["UNION [ALL]", "EXCEPT", "INTERSECT", "MINUS"]), wA = r([
|
|
13288
13288
|
"JOIN",
|
|
13289
13289
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
13290
13290
|
"{INNER | CROSS} JOIN",
|
|
13291
13291
|
"NATURAL [INNER] JOIN",
|
|
13292
13292
|
"NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"
|
|
13293
|
-
]),
|
|
13293
|
+
]), JA = r([
|
|
13294
13294
|
// https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-conversion.html
|
|
13295
13295
|
"NULL AS",
|
|
13296
13296
|
// https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_SCHEMA.html
|
|
@@ -13298,18 +13298,18 @@ const dA = [
|
|
|
13298
13298
|
"HIVE METASTORE",
|
|
13299
13299
|
// in window specifications
|
|
13300
13300
|
"{ROWS | RANGE} BETWEEN"
|
|
13301
|
-
]),
|
|
13301
|
+
]), xA = r([]), vA = {
|
|
13302
13302
|
name: "redshift",
|
|
13303
13303
|
tokenizerOptions: {
|
|
13304
|
-
reservedSelect:
|
|
13305
|
-
reservedClauses: [
|
|
13306
|
-
reservedSetOperations:
|
|
13307
|
-
reservedJoins:
|
|
13308
|
-
reservedKeywordPhrases:
|
|
13309
|
-
reservedDataTypePhrases:
|
|
13310
|
-
reservedKeywords:
|
|
13311
|
-
reservedDataTypes:
|
|
13312
|
-
reservedFunctionNames:
|
|
13304
|
+
reservedSelect: gA,
|
|
13305
|
+
reservedClauses: [...KA, ...NT, ...cE],
|
|
13306
|
+
reservedSetOperations: $A,
|
|
13307
|
+
reservedJoins: wA,
|
|
13308
|
+
reservedKeywordPhrases: JA,
|
|
13309
|
+
reservedDataTypePhrases: xA,
|
|
13310
|
+
reservedKeywords: XA,
|
|
13311
|
+
reservedDataTypes: yA,
|
|
13312
|
+
reservedFunctionNames: bA,
|
|
13313
13313
|
extraParens: ["[]"],
|
|
13314
13314
|
stringTypes: ["''-qq"],
|
|
13315
13315
|
identTypes: ['""-qq'],
|
|
@@ -13333,10 +13333,10 @@ const dA = [
|
|
|
13333
13333
|
},
|
|
13334
13334
|
formatOptions: {
|
|
13335
13335
|
alwaysDenseOperators: ["::"],
|
|
13336
|
-
onelineClauses: [...
|
|
13336
|
+
onelineClauses: [...NT, ...cE],
|
|
13337
13337
|
tabularOnelineClauses: cE
|
|
13338
13338
|
}
|
|
13339
|
-
},
|
|
13339
|
+
}, QA = [
|
|
13340
13340
|
// https://deepkb.com/CO_000013/en/kb/IMPORT-fbfa59f0-2bf1-31fe-bb7b-0f9efe9932c6/spark-sql-keywords
|
|
13341
13341
|
"ADD",
|
|
13342
13342
|
"AFTER",
|
|
@@ -13603,7 +13603,7 @@ const dA = [
|
|
|
13603
13603
|
"UNSIGNED",
|
|
13604
13604
|
"VARIABLES",
|
|
13605
13605
|
"YEAR_MONTH"
|
|
13606
|
-
],
|
|
13606
|
+
], ZA = [
|
|
13607
13607
|
// https://spark.apache.org/docs/latest/sql-ref-datatypes.html
|
|
13608
13608
|
"ARRAY",
|
|
13609
13609
|
"BIGINT",
|
|
@@ -13633,7 +13633,7 @@ const dA = [
|
|
|
13633
13633
|
"TINYINT",
|
|
13634
13634
|
"VARCHAR"
|
|
13635
13635
|
// No varchar type in Spark, only STRING. Added for the sake of tests
|
|
13636
|
-
],
|
|
13636
|
+
], jA = [
|
|
13637
13637
|
// http://spark.apache.org/docs/latest/sql-ref-functions.html
|
|
13638
13638
|
//
|
|
13639
13639
|
// http://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#aggregate-functions
|
|
@@ -13954,7 +13954,7 @@ const dA = [
|
|
|
13954
13954
|
// Shorthand functions to use in place of CASE expression
|
|
13955
13955
|
"COALESCE",
|
|
13956
13956
|
"NULLIF"
|
|
13957
|
-
],
|
|
13957
|
+
], qA = r(["SELECT [ALL | DISTINCT]"]), kA = r([
|
|
13958
13958
|
// queries
|
|
13959
13959
|
"WITH",
|
|
13960
13960
|
"FROM",
|
|
@@ -13979,7 +13979,7 @@ const dA = [
|
|
|
13979
13979
|
// https://spark.apache.org/docs/latest/sql-ref-syntax-dml-load.html
|
|
13980
13980
|
"LOAD DATA [LOCAL] INPATH",
|
|
13981
13981
|
"[OVERWRITE] INTO TABLE"
|
|
13982
|
-
]),
|
|
13982
|
+
]), tT = r(["CREATE [EXTERNAL] TABLE [IF NOT EXISTS]"]), lE = r([
|
|
13983
13983
|
// - create:
|
|
13984
13984
|
"CREATE [OR REPLACE] [GLOBAL TEMPORARY | TEMPORARY] VIEW [IF NOT EXISTS]",
|
|
13985
13985
|
// - drop table:
|
|
@@ -14035,11 +14035,11 @@ const dA = [
|
|
|
14035
14035
|
"SHOW TBLPROPERTIES",
|
|
14036
14036
|
"SHOW VIEWS",
|
|
14037
14037
|
"UNCACHE TABLE"
|
|
14038
|
-
]),
|
|
14038
|
+
]), zA = r([
|
|
14039
14039
|
"UNION [ALL | DISTINCT]",
|
|
14040
14040
|
"EXCEPT [ALL | DISTINCT]",
|
|
14041
14041
|
"INTERSECT [ALL | DISTINCT]"
|
|
14042
|
-
]),
|
|
14042
|
+
]), ES = r([
|
|
14043
14043
|
"JOIN",
|
|
14044
14044
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
14045
14045
|
"{INNER | CROSS} JOIN",
|
|
@@ -14048,24 +14048,24 @@ const dA = [
|
|
|
14048
14048
|
// non-standard-joins
|
|
14049
14049
|
"[LEFT] {ANTI | SEMI} JOIN",
|
|
14050
14050
|
"NATURAL [LEFT] {ANTI | SEMI} JOIN"
|
|
14051
|
-
]),
|
|
14051
|
+
]), TS = r([
|
|
14052
14052
|
"ON DELETE",
|
|
14053
14053
|
"ON UPDATE",
|
|
14054
14054
|
"CURRENT ROW",
|
|
14055
14055
|
"{ROWS | RANGE} BETWEEN"
|
|
14056
|
-
]),
|
|
14056
|
+
]), eS = r([]), RS = {
|
|
14057
14057
|
name: "spark",
|
|
14058
14058
|
tokenizerOptions: {
|
|
14059
|
-
reservedSelect:
|
|
14060
|
-
reservedClauses: [...
|
|
14061
|
-
reservedSetOperations:
|
|
14062
|
-
reservedJoins:
|
|
14063
|
-
reservedKeywordPhrases:
|
|
14064
|
-
reservedDataTypePhrases:
|
|
14059
|
+
reservedSelect: qA,
|
|
14060
|
+
reservedClauses: [...kA, ...tT, ...lE],
|
|
14061
|
+
reservedSetOperations: zA,
|
|
14062
|
+
reservedJoins: ES,
|
|
14063
|
+
reservedKeywordPhrases: TS,
|
|
14064
|
+
reservedDataTypePhrases: eS,
|
|
14065
14065
|
supportsXor: !0,
|
|
14066
|
-
reservedKeywords:
|
|
14067
|
-
reservedDataTypes:
|
|
14068
|
-
reservedFunctionNames:
|
|
14066
|
+
reservedKeywords: QA,
|
|
14067
|
+
reservedDataTypes: ZA,
|
|
14068
|
+
reservedFunctionNames: jA,
|
|
14069
14069
|
extraParens: ["[]"],
|
|
14070
14070
|
stringTypes: [
|
|
14071
14071
|
"''-bs",
|
|
@@ -14077,20 +14077,20 @@ const dA = [
|
|
|
14077
14077
|
identChars: { allowFirstCharNumber: !0 },
|
|
14078
14078
|
variableTypes: [{ quote: "{}", prefixes: ["$"], requirePrefix: !0 }],
|
|
14079
14079
|
operators: ["%", "~", "^", "|", "&", "<=>", "==", "!", "||", "->"],
|
|
14080
|
-
postProcess:
|
|
14080
|
+
postProcess: AS
|
|
14081
14081
|
},
|
|
14082
14082
|
formatOptions: {
|
|
14083
|
-
onelineClauses: [...
|
|
14083
|
+
onelineClauses: [...tT, ...lE],
|
|
14084
14084
|
tabularOnelineClauses: lE
|
|
14085
14085
|
}
|
|
14086
14086
|
};
|
|
14087
|
-
function
|
|
14087
|
+
function AS(e) {
|
|
14088
14088
|
return e.map((E, T) => {
|
|
14089
14089
|
const R = e[T - 1] || v, A = e[T + 1] || v;
|
|
14090
14090
|
return y.WINDOW(E) && A.type === D.OPEN_PAREN ? Object.assign(Object.assign({}, E), { type: D.RESERVED_FUNCTION_NAME }) : E.text === "ITEMS" && E.type === D.RESERVED_KEYWORD && !(R.text === "COLLECTION" && A.text === "TERMINATED") ? Object.assign(Object.assign({}, E), { type: D.IDENTIFIER, text: E.raw }) : E;
|
|
14091
14091
|
});
|
|
14092
14092
|
}
|
|
14093
|
-
const
|
|
14093
|
+
const SS = [
|
|
14094
14094
|
// https://www.sqlite.org/lang_corefunc.html
|
|
14095
14095
|
"ABS",
|
|
14096
14096
|
"CHANGES",
|
|
@@ -14214,7 +14214,7 @@ const IS = [
|
|
|
14214
14214
|
"JSON_TREE",
|
|
14215
14215
|
// cast
|
|
14216
14216
|
"CAST"
|
|
14217
|
-
],
|
|
14217
|
+
], IS = [
|
|
14218
14218
|
// https://www.sqlite.org/lang_keywords.html
|
|
14219
14219
|
// Note: The keywords listed on that URL are not all reserved keywords.
|
|
14220
14220
|
// We'll need to clean up this list to only include reserved keywords.
|
|
@@ -14367,7 +14367,7 @@ const IS = [
|
|
|
14367
14367
|
"WINDOW",
|
|
14368
14368
|
"WITH",
|
|
14369
14369
|
"WITHOUT"
|
|
14370
|
-
],
|
|
14370
|
+
], OS = [
|
|
14371
14371
|
// SQLite allows any word as a data type, e.g. CREATE TABLE foo (col1 madeupname(123));
|
|
14372
14372
|
// Here we just list some common ones as SQL Formatter
|
|
14373
14373
|
// is only able to detect a predefined list of data types.
|
|
@@ -14388,7 +14388,7 @@ const IS = [
|
|
|
14388
14388
|
"TEXT",
|
|
14389
14389
|
"VARCHAR",
|
|
14390
14390
|
"VARYING CHARACTER"
|
|
14391
|
-
],
|
|
14391
|
+
], NS = r(["SELECT [ALL | DISTINCT]"]), tS = r([
|
|
14392
14392
|
// queries
|
|
14393
14393
|
"WITH [RECURSIVE]",
|
|
14394
14394
|
"FROM",
|
|
@@ -14409,7 +14409,7 @@ const IS = [
|
|
|
14409
14409
|
"SET",
|
|
14410
14410
|
// other:
|
|
14411
14411
|
"RETURNING"
|
|
14412
|
-
]),
|
|
14412
|
+
]), sT = r(["CREATE [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]"]), uE = r([
|
|
14413
14413
|
// - create:
|
|
14414
14414
|
"CREATE [TEMPORARY | TEMP] VIEW [IF NOT EXISTS]",
|
|
14415
14415
|
// - update:
|
|
@@ -14428,28 +14428,28 @@ const IS = [
|
|
|
14428
14428
|
"RENAME TO",
|
|
14429
14429
|
// - set schema
|
|
14430
14430
|
"SET SCHEMA"
|
|
14431
|
-
]),
|
|
14431
|
+
]), sS = r(["UNION [ALL]", "EXCEPT", "INTERSECT"]), CS = r([
|
|
14432
14432
|
"JOIN",
|
|
14433
14433
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
14434
14434
|
"{INNER | CROSS} JOIN",
|
|
14435
14435
|
"NATURAL [INNER] JOIN",
|
|
14436
14436
|
"NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"
|
|
14437
|
-
]),
|
|
14437
|
+
]), LS = r([
|
|
14438
14438
|
"ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]",
|
|
14439
14439
|
"{ROWS | RANGE | GROUPS} BETWEEN",
|
|
14440
14440
|
"DO UPDATE"
|
|
14441
|
-
]), nS =
|
|
14441
|
+
]), nS = r([]), rS = {
|
|
14442
14442
|
name: "sqlite",
|
|
14443
14443
|
tokenizerOptions: {
|
|
14444
|
-
reservedSelect:
|
|
14445
|
-
reservedClauses: [...
|
|
14446
|
-
reservedSetOperations:
|
|
14447
|
-
reservedJoins:
|
|
14448
|
-
reservedKeywordPhrases:
|
|
14444
|
+
reservedSelect: NS,
|
|
14445
|
+
reservedClauses: [...tS, ...sT, ...uE],
|
|
14446
|
+
reservedSetOperations: sS,
|
|
14447
|
+
reservedJoins: CS,
|
|
14448
|
+
reservedKeywordPhrases: LS,
|
|
14449
14449
|
reservedDataTypePhrases: nS,
|
|
14450
|
-
reservedKeywords:
|
|
14451
|
-
reservedDataTypes:
|
|
14452
|
-
reservedFunctionNames:
|
|
14450
|
+
reservedKeywords: IS,
|
|
14451
|
+
reservedDataTypes: OS,
|
|
14452
|
+
reservedFunctionNames: SS,
|
|
14453
14453
|
stringTypes: [
|
|
14454
14454
|
"''-qq",
|
|
14455
14455
|
{ quote: "''-raw", prefixes: ["X"], requirePrefix: !0 }
|
|
@@ -14462,10 +14462,10 @@ const IS = [
|
|
|
14462
14462
|
operators: ["%", "~", "&", "|", "<<", ">>", "==", "->", "->>", "||"]
|
|
14463
14463
|
},
|
|
14464
14464
|
formatOptions: {
|
|
14465
|
-
onelineClauses: [...
|
|
14465
|
+
onelineClauses: [...sT, ...uE],
|
|
14466
14466
|
tabularOnelineClauses: uE
|
|
14467
14467
|
}
|
|
14468
|
-
},
|
|
14468
|
+
}, _S = [
|
|
14469
14469
|
// https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_6_9_set_function_specification
|
|
14470
14470
|
"GROUPING",
|
|
14471
14471
|
// https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_6_10_window_function
|
|
@@ -14562,7 +14562,7 @@ const IS = [
|
|
|
14562
14562
|
"ASIN",
|
|
14563
14563
|
"ACOS",
|
|
14564
14564
|
"ATAN"
|
|
14565
|
-
],
|
|
14565
|
+
], iS = [
|
|
14566
14566
|
// https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#reserved-word
|
|
14567
14567
|
"ALL",
|
|
14568
14568
|
"ALLOCATE",
|
|
@@ -14760,7 +14760,7 @@ const IS = [
|
|
|
14760
14760
|
"WITHIN",
|
|
14761
14761
|
"WITHOUT",
|
|
14762
14762
|
"YEAR"
|
|
14763
|
-
],
|
|
14763
|
+
], aS = [
|
|
14764
14764
|
// https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_6_1_data_type
|
|
14765
14765
|
"ARRAY",
|
|
14766
14766
|
"BIGINT",
|
|
@@ -14800,7 +14800,7 @@ const IS = [
|
|
|
14800
14800
|
"TIMESTAMP",
|
|
14801
14801
|
"VARBINARY",
|
|
14802
14802
|
"VARCHAR"
|
|
14803
|
-
],
|
|
14803
|
+
], oS = r(["SELECT [ALL | DISTINCT]"]), DS = r([
|
|
14804
14804
|
// queries
|
|
14805
14805
|
"WITH [RECURSIVE]",
|
|
14806
14806
|
"FROM",
|
|
@@ -14819,7 +14819,7 @@ const IS = [
|
|
|
14819
14819
|
"VALUES",
|
|
14820
14820
|
// - update:
|
|
14821
14821
|
"SET"
|
|
14822
|
-
]),
|
|
14822
|
+
]), CT = r(["CREATE [GLOBAL TEMPORARY | LOCAL TEMPORARY] TABLE"]), GE = r([
|
|
14823
14823
|
// - create:
|
|
14824
14824
|
"CREATE [RECURSIVE] VIEW",
|
|
14825
14825
|
// - update:
|
|
@@ -14844,31 +14844,31 @@ const IS = [
|
|
|
14844
14844
|
"TRUNCATE TABLE",
|
|
14845
14845
|
// other
|
|
14846
14846
|
"SET SCHEMA"
|
|
14847
|
-
]),
|
|
14847
|
+
]), PS = r([
|
|
14848
14848
|
"UNION [ALL | DISTINCT]",
|
|
14849
14849
|
"EXCEPT [ALL | DISTINCT]",
|
|
14850
14850
|
"INTERSECT [ALL | DISTINCT]"
|
|
14851
|
-
]),
|
|
14851
|
+
]), MS = r([
|
|
14852
14852
|
"JOIN",
|
|
14853
14853
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
14854
14854
|
"{INNER | CROSS} JOIN",
|
|
14855
14855
|
"NATURAL [INNER] JOIN",
|
|
14856
14856
|
"NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"
|
|
14857
|
-
]),
|
|
14857
|
+
]), US = r([
|
|
14858
14858
|
"ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]",
|
|
14859
14859
|
"{ROWS | RANGE} BETWEEN"
|
|
14860
|
-
]),
|
|
14860
|
+
]), cS = r([]), lS = {
|
|
14861
14861
|
name: "sql",
|
|
14862
14862
|
tokenizerOptions: {
|
|
14863
|
-
reservedSelect:
|
|
14864
|
-
reservedClauses: [...
|
|
14865
|
-
reservedSetOperations:
|
|
14866
|
-
reservedJoins:
|
|
14867
|
-
reservedKeywordPhrases:
|
|
14868
|
-
reservedDataTypePhrases:
|
|
14869
|
-
reservedKeywords:
|
|
14870
|
-
reservedDataTypes:
|
|
14871
|
-
reservedFunctionNames:
|
|
14863
|
+
reservedSelect: oS,
|
|
14864
|
+
reservedClauses: [...DS, ...CT, ...GE],
|
|
14865
|
+
reservedSetOperations: PS,
|
|
14866
|
+
reservedJoins: MS,
|
|
14867
|
+
reservedKeywordPhrases: US,
|
|
14868
|
+
reservedDataTypePhrases: cS,
|
|
14869
|
+
reservedKeywords: iS,
|
|
14870
|
+
reservedDataTypes: aS,
|
|
14871
|
+
reservedFunctionNames: _S,
|
|
14872
14872
|
stringTypes: [
|
|
14873
14873
|
{ quote: "''-qq-bs", prefixes: ["N", "U&"] },
|
|
14874
14874
|
{ quote: "''-raw", prefixes: ["X"], requirePrefix: !0 }
|
|
@@ -14878,10 +14878,10 @@ const IS = [
|
|
|
14878
14878
|
operators: ["||"]
|
|
14879
14879
|
},
|
|
14880
14880
|
formatOptions: {
|
|
14881
|
-
onelineClauses: [...
|
|
14881
|
+
onelineClauses: [...CT, ...GE],
|
|
14882
14882
|
tabularOnelineClauses: GE
|
|
14883
14883
|
}
|
|
14884
|
-
},
|
|
14884
|
+
}, uS = [
|
|
14885
14885
|
// https://github.com/trinodb/trino/tree/432d2897bdef99388c1a47188743a061c4ac1f34/docs/src/main/sphinx/functions
|
|
14886
14886
|
// rg '^\.\. function::' ./docs/src/main/sphinx/functions | cut -d' ' -f 3 | cut -d '(' -f 1 | sort | uniq
|
|
14887
14887
|
// rg '\* ' ./docs/src/main/sphinx/functions/list-by-topic.rst | grep '\* :func:' | cut -d'`' -f 2
|
|
@@ -15315,7 +15315,7 @@ const IS = [
|
|
|
15315
15315
|
"NEXT",
|
|
15316
15316
|
"PERMUTE",
|
|
15317
15317
|
"PREV"
|
|
15318
|
-
],
|
|
15318
|
+
], GS = [
|
|
15319
15319
|
// https://github.com/trinodb/trino/blob/432d2897bdef99388c1a47188743a061c4ac1f34/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4#L858-L1128
|
|
15320
15320
|
"ABSENT",
|
|
15321
15321
|
"ADD",
|
|
@@ -15552,7 +15552,7 @@ const IS = [
|
|
|
15552
15552
|
"WRAPPER",
|
|
15553
15553
|
"WRITE",
|
|
15554
15554
|
"ZONE"
|
|
15555
|
-
],
|
|
15555
|
+
], HS = [
|
|
15556
15556
|
// https://github.com/trinodb/trino/blob/432d2897bdef99388c1a47188743a061c4ac1f34/core/trino-main/src/main/java/io/trino/metadata/TypeRegistry.java#L131-L168
|
|
15557
15557
|
// or https://trino.io/docs/current/language/types.html
|
|
15558
15558
|
"BIGINT",
|
|
@@ -15591,7 +15591,7 @@ const IS = [
|
|
|
15591
15591
|
"CODEPOINTS",
|
|
15592
15592
|
"FUNCTION",
|
|
15593
15593
|
"JSONPATH"
|
|
15594
|
-
],
|
|
15594
|
+
], BS = r(["SELECT [ALL | DISTINCT]"]), mS = r([
|
|
15595
15595
|
// queries
|
|
15596
15596
|
"WITH [RECURSIVE]",
|
|
15597
15597
|
"FROM",
|
|
@@ -15619,7 +15619,7 @@ const IS = [
|
|
|
15619
15619
|
"PATTERN",
|
|
15620
15620
|
"SUBSET",
|
|
15621
15621
|
"DEFINE"
|
|
15622
|
-
]),
|
|
15622
|
+
]), LT = r(["CREATE TABLE [IF NOT EXISTS]"]), HE = r([
|
|
15623
15623
|
// - create:
|
|
15624
15624
|
"CREATE [OR REPLACE] [MATERIALIZED] VIEW",
|
|
15625
15625
|
// - update:
|
|
@@ -15677,32 +15677,32 @@ const IS = [
|
|
|
15677
15677
|
"SHOW ROLE GRANTS",
|
|
15678
15678
|
"SHOW FUNCTIONS",
|
|
15679
15679
|
"SHOW SESSION"
|
|
15680
|
-
]),
|
|
15680
|
+
]), dS = r([
|
|
15681
15681
|
"UNION [ALL | DISTINCT]",
|
|
15682
15682
|
"EXCEPT [ALL | DISTINCT]",
|
|
15683
15683
|
"INTERSECT [ALL | DISTINCT]"
|
|
15684
|
-
]),
|
|
15684
|
+
]), pS = r([
|
|
15685
15685
|
"JOIN",
|
|
15686
15686
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
15687
15687
|
"{INNER | CROSS} JOIN",
|
|
15688
15688
|
"NATURAL [INNER] JOIN",
|
|
15689
15689
|
"NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"
|
|
15690
|
-
]),
|
|
15690
|
+
]), FS = r([
|
|
15691
15691
|
"{ROWS | RANGE | GROUPS} BETWEEN",
|
|
15692
15692
|
// comparison operator
|
|
15693
15693
|
"IS [NOT] DISTINCT FROM"
|
|
15694
|
-
]),
|
|
15694
|
+
]), YS = r([]), hS = {
|
|
15695
15695
|
name: "trino",
|
|
15696
15696
|
tokenizerOptions: {
|
|
15697
|
-
reservedSelect:
|
|
15698
|
-
reservedClauses: [...mS, ...
|
|
15699
|
-
reservedSetOperations:
|
|
15700
|
-
reservedJoins:
|
|
15701
|
-
reservedKeywordPhrases:
|
|
15702
|
-
reservedDataTypePhrases:
|
|
15703
|
-
reservedKeywords:
|
|
15704
|
-
reservedDataTypes:
|
|
15705
|
-
reservedFunctionNames:
|
|
15697
|
+
reservedSelect: BS,
|
|
15698
|
+
reservedClauses: [...mS, ...LT, ...HE],
|
|
15699
|
+
reservedSetOperations: dS,
|
|
15700
|
+
reservedJoins: pS,
|
|
15701
|
+
reservedKeywordPhrases: FS,
|
|
15702
|
+
reservedDataTypePhrases: YS,
|
|
15703
|
+
reservedKeywords: GS,
|
|
15704
|
+
reservedDataTypes: HS,
|
|
15705
|
+
reservedFunctionNames: uS,
|
|
15706
15706
|
// Trino also supports {- ... -} parenthesis.
|
|
15707
15707
|
// The formatting of these currently works out as a result of { and -
|
|
15708
15708
|
// not getting a space added in-between.
|
|
@@ -15731,10 +15731,10 @@ const IS = [
|
|
|
15731
15731
|
]
|
|
15732
15732
|
},
|
|
15733
15733
|
formatOptions: {
|
|
15734
|
-
onelineClauses: [...
|
|
15734
|
+
onelineClauses: [...LT, ...HE],
|
|
15735
15735
|
tabularOnelineClauses: HE
|
|
15736
15736
|
}
|
|
15737
|
-
},
|
|
15737
|
+
}, fS = [
|
|
15738
15738
|
// https://docs.microsoft.com/en-us/sql/t-sql/functions/functions?view=sql-server-ver15
|
|
15739
15739
|
// aggregate
|
|
15740
15740
|
"APPROX_COUNT_DISTINCT",
|
|
@@ -16039,7 +16039,7 @@ const IS = [
|
|
|
16039
16039
|
// Shorthand functions to use in place of CASE expression
|
|
16040
16040
|
"COALESCE",
|
|
16041
16041
|
"NULLIF"
|
|
16042
|
-
],
|
|
16042
|
+
], VS = [
|
|
16043
16043
|
// https://docs.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql?view=sql-server-ver15
|
|
16044
16044
|
// standard
|
|
16045
16045
|
"ADD",
|
|
@@ -16220,7 +16220,7 @@ const IS = [
|
|
|
16220
16220
|
"WRITETEXT",
|
|
16221
16221
|
// https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql?view=sql-server-ver16#action
|
|
16222
16222
|
"$ACTION"
|
|
16223
|
-
],
|
|
16223
|
+
], WS = [
|
|
16224
16224
|
// https://learn.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql?view=sql-server-ver15
|
|
16225
16225
|
"BINARY",
|
|
16226
16226
|
"BIT",
|
|
@@ -16247,7 +16247,7 @@ const IS = [
|
|
|
16247
16247
|
"TIMESTAMP",
|
|
16248
16248
|
"VARBINARY",
|
|
16249
16249
|
"VARCHAR"
|
|
16250
|
-
],
|
|
16250
|
+
], bS = r(["SELECT [ALL | DISTINCT]"]), XS = r([
|
|
16251
16251
|
// queries
|
|
16252
16252
|
"WITH",
|
|
16253
16253
|
"INTO",
|
|
@@ -16272,7 +16272,7 @@ const IS = [
|
|
|
16272
16272
|
"MERGE [INTO]",
|
|
16273
16273
|
"WHEN [NOT] MATCHED [BY TARGET | BY SOURCE] [THEN]",
|
|
16274
16274
|
"UPDATE SET"
|
|
16275
|
-
]), nT =
|
|
16275
|
+
]), nT = r(["CREATE TABLE"]), BE = r([
|
|
16276
16276
|
// - create:
|
|
16277
16277
|
"CREATE [OR ALTER] [MATERIALIZED] VIEW",
|
|
16278
16278
|
// - update:
|
|
@@ -16452,27 +16452,27 @@ const IS = [
|
|
|
16452
16452
|
"XACT_ABORT",
|
|
16453
16453
|
"XML INDEX",
|
|
16454
16454
|
"XML SCHEMA COLLECTION"
|
|
16455
|
-
]),
|
|
16455
|
+
]), yS = r(["UNION [ALL]", "EXCEPT", "INTERSECT"]), gS = r([
|
|
16456
16456
|
"JOIN",
|
|
16457
16457
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
16458
16458
|
"{INNER | CROSS} JOIN",
|
|
16459
16459
|
// non-standard joins
|
|
16460
16460
|
"{CROSS | OUTER} APPLY"
|
|
16461
|
-
]),
|
|
16461
|
+
]), KS = r([
|
|
16462
16462
|
"ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]",
|
|
16463
16463
|
"{ROWS | RANGE} BETWEEN"
|
|
16464
|
-
]),
|
|
16464
|
+
]), $S = r([]), wS = {
|
|
16465
16465
|
name: "transactsql",
|
|
16466
16466
|
tokenizerOptions: {
|
|
16467
|
-
reservedSelect:
|
|
16468
|
-
reservedClauses: [...
|
|
16469
|
-
reservedSetOperations:
|
|
16470
|
-
reservedJoins:
|
|
16471
|
-
reservedKeywordPhrases:
|
|
16472
|
-
reservedDataTypePhrases:
|
|
16473
|
-
reservedKeywords:
|
|
16474
|
-
reservedDataTypes:
|
|
16475
|
-
reservedFunctionNames:
|
|
16467
|
+
reservedSelect: bS,
|
|
16468
|
+
reservedClauses: [...XS, ...nT, ...BE],
|
|
16469
|
+
reservedSetOperations: yS,
|
|
16470
|
+
reservedJoins: gS,
|
|
16471
|
+
reservedKeywordPhrases: KS,
|
|
16472
|
+
reservedDataTypePhrases: $S,
|
|
16473
|
+
reservedKeywords: VS,
|
|
16474
|
+
reservedDataTypes: WS,
|
|
16475
|
+
reservedFunctionNames: fS,
|
|
16476
16476
|
nestedBlockComments: !0,
|
|
16477
16477
|
stringTypes: [{ quote: "''-qq", prefixes: ["N"] }, "{}"],
|
|
16478
16478
|
identTypes: ['""-qq', "[]"],
|
|
@@ -16505,7 +16505,7 @@ const IS = [
|
|
|
16505
16505
|
onelineClauses: [...nT, ...BE],
|
|
16506
16506
|
tabularOnelineClauses: BE
|
|
16507
16507
|
}
|
|
16508
|
-
},
|
|
16508
|
+
}, JS = [
|
|
16509
16509
|
// List of all keywords taken from:
|
|
16510
16510
|
// https://docs.singlestore.com/managed-service/en/reference/sql-reference/restricted-keywords/list-of-restricted-keywords.html
|
|
16511
16511
|
// Then filtered down to reserved keywords by running
|
|
@@ -16718,7 +16718,7 @@ const IS = [
|
|
|
16718
16718
|
"XOR",
|
|
16719
16719
|
"YEAR_MONTH",
|
|
16720
16720
|
"ZEROFILL"
|
|
16721
|
-
],
|
|
16721
|
+
], xS = [
|
|
16722
16722
|
// https://docs.singlestore.com/cloud/reference/sql-reference/data-types/
|
|
16723
16723
|
"BIGINT",
|
|
16724
16724
|
"BINARY",
|
|
@@ -16767,7 +16767,7 @@ const IS = [
|
|
|
16767
16767
|
"VARCHAR",
|
|
16768
16768
|
"VARCHARACTER",
|
|
16769
16769
|
"YEAR"
|
|
16770
|
-
],
|
|
16770
|
+
], vS = [
|
|
16771
16771
|
// https://docs.singlestore.com/managed-service/en/reference/sql-reference/vector-functions/vector-functions.html
|
|
16772
16772
|
// https://docs.singlestore.com/managed-service/en/reference/sql-reference/window-functions/window-functions.html
|
|
16773
16773
|
// https://docs.singlestore.com/managed-service/en/reference/sql-reference/string-functions/string-functions.html
|
|
@@ -17047,7 +17047,7 @@ const IS = [
|
|
|
17047
17047
|
"WEEKDAY",
|
|
17048
17048
|
"WEEKOFYEAR",
|
|
17049
17049
|
"YEAR"
|
|
17050
|
-
],
|
|
17050
|
+
], QS = r(["SELECT [ALL | DISTINCT | DISTINCTROW]"]), ZS = r([
|
|
17051
17051
|
// queries
|
|
17052
17052
|
"WITH",
|
|
17053
17053
|
"FROM",
|
|
@@ -17069,9 +17069,9 @@ const IS = [
|
|
|
17069
17069
|
// Data definition
|
|
17070
17070
|
"CREATE [OR REPLACE] [TEMPORARY] PROCEDURE [IF NOT EXISTS]",
|
|
17071
17071
|
"CREATE [OR REPLACE] [EXTERNAL] FUNCTION"
|
|
17072
|
-
]),
|
|
17072
|
+
]), rT = r([
|
|
17073
17073
|
"CREATE [ROWSTORE] [REFERENCE | TEMPORARY | GLOBAL TEMPORARY] TABLE [IF NOT EXISTS]"
|
|
17074
|
-
]),
|
|
17074
|
+
]), mE = r([
|
|
17075
17075
|
// - create:
|
|
17076
17076
|
"CREATE VIEW",
|
|
17077
17077
|
// - update:
|
|
@@ -17248,36 +17248,36 @@ const IS = [
|
|
|
17248
17248
|
"REPEAT",
|
|
17249
17249
|
"RETURN",
|
|
17250
17250
|
"WHILE"
|
|
17251
|
-
]),
|
|
17251
|
+
]), jS = r([
|
|
17252
17252
|
"UNION [ALL | DISTINCT]",
|
|
17253
17253
|
"EXCEPT",
|
|
17254
17254
|
"INTERSECT",
|
|
17255
17255
|
"MINUS"
|
|
17256
|
-
]),
|
|
17256
|
+
]), qS = r([
|
|
17257
17257
|
"JOIN",
|
|
17258
17258
|
"{LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
17259
17259
|
"{INNER | CROSS} JOIN",
|
|
17260
17260
|
"NATURAL {LEFT | RIGHT} [OUTER] JOIN",
|
|
17261
17261
|
// non-standard joins
|
|
17262
17262
|
"STRAIGHT_JOIN"
|
|
17263
|
-
]),
|
|
17263
|
+
]), kS = r([
|
|
17264
17264
|
"ON DELETE",
|
|
17265
17265
|
"ON UPDATE",
|
|
17266
17266
|
"CHARACTER SET",
|
|
17267
17267
|
"{ROWS | RANGE} BETWEEN",
|
|
17268
17268
|
"IDENTIFIED BY"
|
|
17269
|
-
]),
|
|
17269
|
+
]), zS = r([]), EI = {
|
|
17270
17270
|
name: "singlestoredb",
|
|
17271
17271
|
tokenizerOptions: {
|
|
17272
|
-
reservedSelect:
|
|
17273
|
-
reservedClauses: [...
|
|
17274
|
-
reservedSetOperations:
|
|
17275
|
-
reservedJoins:
|
|
17276
|
-
reservedKeywordPhrases:
|
|
17277
|
-
reservedDataTypePhrases:
|
|
17278
|
-
reservedKeywords:
|
|
17279
|
-
reservedDataTypes:
|
|
17280
|
-
reservedFunctionNames:
|
|
17272
|
+
reservedSelect: QS,
|
|
17273
|
+
reservedClauses: [...ZS, ...rT, ...mE],
|
|
17274
|
+
reservedSetOperations: jS,
|
|
17275
|
+
reservedJoins: qS,
|
|
17276
|
+
reservedKeywordPhrases: kS,
|
|
17277
|
+
reservedDataTypePhrases: zS,
|
|
17278
|
+
reservedKeywords: JS,
|
|
17279
|
+
reservedDataTypes: xS,
|
|
17280
|
+
reservedFunctionNames: vS,
|
|
17281
17281
|
// TODO: support _binary"some string" prefix
|
|
17282
17282
|
stringTypes: [
|
|
17283
17283
|
'""-qq-bs',
|
|
@@ -17314,10 +17314,10 @@ const IS = [
|
|
|
17314
17314
|
},
|
|
17315
17315
|
formatOptions: {
|
|
17316
17316
|
alwaysDenseOperators: ["::", "::$", "::%"],
|
|
17317
|
-
onelineClauses: [...
|
|
17318
|
-
tabularOnelineClauses:
|
|
17317
|
+
onelineClauses: [...rT, ...mE],
|
|
17318
|
+
tabularOnelineClauses: mE
|
|
17319
17319
|
}
|
|
17320
|
-
},
|
|
17320
|
+
}, TI = [
|
|
17321
17321
|
// https://docs.snowflake.com/en/sql-reference-functions.html
|
|
17322
17322
|
//
|
|
17323
17323
|
// https://docs.snowflake.com/en/sql-reference/functions-all.html
|
|
@@ -17925,7 +17925,7 @@ const IS = [
|
|
|
17925
17925
|
"QUARTER",
|
|
17926
17926
|
"ZEROIFNULL",
|
|
17927
17927
|
"ZIPF"
|
|
17928
|
-
],
|
|
17928
|
+
], eI = [
|
|
17929
17929
|
// https://docs.snowflake.com/en/sql-reference/reserved-keywords.html
|
|
17930
17930
|
//
|
|
17931
17931
|
// run in console on this page: $x('//tbody/tr/*[1]/p/text()').map(x => x.nodeValue)
|
|
@@ -18022,7 +18022,7 @@ const IS = [
|
|
|
18022
18022
|
"WITH",
|
|
18023
18023
|
// These are definitely keywords, but haven't found a definite list in the docs
|
|
18024
18024
|
"COMMENT"
|
|
18025
|
-
],
|
|
18025
|
+
], RI = [
|
|
18026
18026
|
"NUMBER",
|
|
18027
18027
|
"DECIMAL",
|
|
18028
18028
|
"NUMERIC",
|
|
@@ -18059,7 +18059,7 @@ const IS = [
|
|
|
18059
18059
|
"ARRAY",
|
|
18060
18060
|
"GEOGRAPHY",
|
|
18061
18061
|
"GEOMETRY"
|
|
18062
|
-
],
|
|
18062
|
+
], AI = r(["SELECT [ALL | DISTINCT]"]), SI = r([
|
|
18063
18063
|
// queries
|
|
18064
18064
|
"WITH [RECURSIVE]",
|
|
18065
18065
|
"FROM",
|
|
@@ -18087,10 +18087,10 @@ const IS = [
|
|
|
18087
18087
|
"WHEN MATCHED [AND]",
|
|
18088
18088
|
"THEN {UPDATE SET | DELETE}",
|
|
18089
18089
|
"WHEN NOT MATCHED THEN INSERT"
|
|
18090
|
-
]),
|
|
18090
|
+
]), _T = r([
|
|
18091
18091
|
"CREATE [OR REPLACE] [VOLATILE] TABLE [IF NOT EXISTS]",
|
|
18092
18092
|
"CREATE [OR REPLACE] [LOCAL | GLOBAL] {TEMP|TEMPORARY} TABLE [IF NOT EXISTS]"
|
|
18093
|
-
]),
|
|
18093
|
+
]), dE = r([
|
|
18094
18094
|
// - create:
|
|
18095
18095
|
"CREATE [OR REPLACE] [SECURE] [RECURSIVE] VIEW [IF NOT EXISTS]",
|
|
18096
18096
|
// - update:
|
|
@@ -18331,25 +18331,25 @@ const IS = [
|
|
|
18331
18331
|
"USE SCHEMA",
|
|
18332
18332
|
"USE SECONDARY ROLES",
|
|
18333
18333
|
"USE WAREHOUSE"
|
|
18334
|
-
]),
|
|
18334
|
+
]), II = r(["UNION [ALL]", "MINUS", "EXCEPT", "INTERSECT"]), OI = r([
|
|
18335
18335
|
"[INNER] JOIN",
|
|
18336
18336
|
"[NATURAL] {LEFT | RIGHT | FULL} [OUTER] JOIN",
|
|
18337
18337
|
"{CROSS | NATURAL} JOIN"
|
|
18338
|
-
]),
|
|
18338
|
+
]), NI = r([
|
|
18339
18339
|
"{ROWS | RANGE} BETWEEN",
|
|
18340
18340
|
"ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]"
|
|
18341
|
-
]),
|
|
18341
|
+
]), tI = r([]), sI = {
|
|
18342
18342
|
name: "snowflake",
|
|
18343
18343
|
tokenizerOptions: {
|
|
18344
|
-
reservedSelect:
|
|
18345
|
-
reservedClauses: [...
|
|
18346
|
-
reservedSetOperations:
|
|
18347
|
-
reservedJoins:
|
|
18348
|
-
reservedKeywordPhrases:
|
|
18349
|
-
reservedDataTypePhrases:
|
|
18350
|
-
reservedKeywords:
|
|
18351
|
-
reservedDataTypes:
|
|
18352
|
-
reservedFunctionNames:
|
|
18344
|
+
reservedSelect: AI,
|
|
18345
|
+
reservedClauses: [...SI, ..._T, ...dE],
|
|
18346
|
+
reservedSetOperations: II,
|
|
18347
|
+
reservedJoins: OI,
|
|
18348
|
+
reservedKeywordPhrases: NI,
|
|
18349
|
+
reservedDataTypePhrases: tI,
|
|
18350
|
+
reservedKeywords: eI,
|
|
18351
|
+
reservedDataTypes: RI,
|
|
18352
|
+
reservedFunctionNames: TI,
|
|
18353
18353
|
stringTypes: ["$$", "''-qq-bs"],
|
|
18354
18354
|
identTypes: ['""-qq'],
|
|
18355
18355
|
variableTypes: [
|
|
@@ -18379,46 +18379,46 @@ const IS = [
|
|
|
18379
18379
|
},
|
|
18380
18380
|
formatOptions: {
|
|
18381
18381
|
alwaysDenseOperators: ["::"],
|
|
18382
|
-
onelineClauses: [...
|
|
18383
|
-
tabularOnelineClauses:
|
|
18382
|
+
onelineClauses: [..._T, ...dE],
|
|
18383
|
+
tabularOnelineClauses: dE
|
|
18384
18384
|
}
|
|
18385
|
-
},
|
|
18385
|
+
}, CI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
18386
18386
|
__proto__: null,
|
|
18387
|
-
bigquery:
|
|
18388
|
-
db2:
|
|
18389
|
-
db2i:
|
|
18390
|
-
duckdb:
|
|
18391
|
-
hive:
|
|
18392
|
-
mariadb:
|
|
18393
|
-
mysql:
|
|
18394
|
-
n1ql:
|
|
18395
|
-
plsql:
|
|
18396
|
-
postgresql:
|
|
18397
|
-
redshift:
|
|
18398
|
-
singlestoredb:
|
|
18399
|
-
snowflake:
|
|
18400
|
-
spark:
|
|
18401
|
-
sql:
|
|
18402
|
-
sqlite:
|
|
18403
|
-
tidb:
|
|
18404
|
-
transactsql:
|
|
18405
|
-
trino:
|
|
18406
|
-
}, Symbol.toStringTag, { value: "Module" })), Z = (e) => e[e.length - 1],
|
|
18387
|
+
bigquery: Xe,
|
|
18388
|
+
db2: ze,
|
|
18389
|
+
db2i: sR,
|
|
18390
|
+
duckdb: PR,
|
|
18391
|
+
hive: dR,
|
|
18392
|
+
mariadb: yR,
|
|
18393
|
+
mysql: jR,
|
|
18394
|
+
n1ql: iA,
|
|
18395
|
+
plsql: GA,
|
|
18396
|
+
postgresql: WA,
|
|
18397
|
+
redshift: vA,
|
|
18398
|
+
singlestoredb: EI,
|
|
18399
|
+
snowflake: sI,
|
|
18400
|
+
spark: RS,
|
|
18401
|
+
sql: lS,
|
|
18402
|
+
sqlite: rS,
|
|
18403
|
+
tidb: IA,
|
|
18404
|
+
transactsql: wS,
|
|
18405
|
+
trino: hS
|
|
18406
|
+
}, Symbol.toStringTag, { value: "Module" })), Z = (e) => e[e.length - 1], YT = (e) => e.sort((E, T) => T.length - E.length || E.localeCompare(T)), z = (e) => e.replace(/\s+/gu, " "), pE = (e) => /\n/.test(e), h = (e) => e.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"), iT = /\s+/uy, g = (e) => new RegExp(`(?:${e})`, "uy"), LI = (e) => e.split("").map((E) => / /gu.test(E) ? "\\s+" : `[${E.toUpperCase()}${E.toLowerCase()}]`).join(""), nI = (e) => e + "(?:-" + e + ")*", rI = ({ prefixes: e, requirePrefix: E }) => `(?:${e.map(LI).join("|")}${E ? "" : "|"})`, _I = (e) => new RegExp(`(?:${e.map(h).join("|")}).*?(?=\r
|
|
18407
18407
|
|\r|
|
|
18408
|
-
|$)`, "uy"),
|
|
18408
|
+
|$)`, "uy"), aT = (e, E = []) => {
|
|
18409
18409
|
const T = e === "open" ? 0 : 1, R = ["()", ...E].map((A) => A[T]);
|
|
18410
18410
|
return g(R.map(h).join("|"));
|
|
18411
|
-
},
|
|
18411
|
+
}, oT = (e) => g(`${YT(e).map(h).join("|")}`), iI = ({ rest: e, dashes: E }) => e || E ? `(?![${e || ""}${E ? "-" : ""}])` : "", V = (e, E = {}) => {
|
|
18412
18412
|
if (e.length === 0)
|
|
18413
18413
|
return /^\b$/u;
|
|
18414
|
-
const T =
|
|
18414
|
+
const T = iI(E), R = YT(e).map(h).join("|").replace(/ /gu, "\\s+");
|
|
18415
18415
|
return new RegExp(`(?:${R})${T}\\b`, "iuy");
|
|
18416
18416
|
}, FE = (e, E) => {
|
|
18417
18417
|
if (!e.length)
|
|
18418
18418
|
return;
|
|
18419
18419
|
const T = e.map(h).join("|");
|
|
18420
18420
|
return g(`(?:${T})(?:${E})`);
|
|
18421
|
-
},
|
|
18421
|
+
}, aI = () => {
|
|
18422
18422
|
const e = {
|
|
18423
18423
|
"<": ">",
|
|
18424
18424
|
"[": "]",
|
|
@@ -18426,7 +18426,7 @@ const IS = [
|
|
|
18426
18426
|
"{": "}"
|
|
18427
18427
|
}, E = "{left}(?:(?!{right}').)*?{right}", T = Object.entries(e).map(([I, t]) => E.replace(/{left}/g, h(I)).replace(/{right}/g, h(t))), R = h(Object.keys(e).join(""));
|
|
18428
18428
|
return `[Qq]'(?:${String.raw`(?<tag>[^\s${R}])(?:(?!\k<tag>').)*?\k<tag>`}|${T.join("|")})'`;
|
|
18429
|
-
},
|
|
18429
|
+
}, DT = {
|
|
18430
18430
|
// - backtick quoted (using `` to escape)
|
|
18431
18431
|
"``": "(?:`[^`]*`)+",
|
|
18432
18432
|
// - Transact-SQL square bracket quoted (using ]] to escape)
|
|
@@ -18450,16 +18450,16 @@ const IS = [
|
|
|
18450
18450
|
// Hive and Spark variables: ${name}
|
|
18451
18451
|
"{}": String.raw`(?:\{[^\}]*\})`,
|
|
18452
18452
|
// Oracle q'' strings: q'<text>' q'|text|' ...
|
|
18453
|
-
"q''":
|
|
18454
|
-
},
|
|
18453
|
+
"q''": aI()
|
|
18454
|
+
}, hT = (e) => typeof e == "string" ? DT[e] : "regex" in e ? e.regex : rI(e) + DT[e.quote], oI = (e) => g(e.map((E) => "regex" in E ? E.regex : hT(E)).join("|")), fT = (e) => e.map(hT).join("|"), PT = (e) => g(fT(e)), DI = (e = {}) => g(VT(e)), VT = ({ first: e, rest: E, dashes: T, allowFirstCharNumber: R } = {}) => {
|
|
18455
18455
|
const A = "\\p{Alphabetic}\\p{Mark}_", S = "\\p{Decimal_Number}", I = h(e ?? ""), t = h(E ?? ""), s = R ? `[${A}${S}${I}][${A}${S}${t}]*` : `[${A}${I}][${A}${S}${t}]*`;
|
|
18456
18456
|
return T ? nI(s) : s;
|
|
18457
18457
|
};
|
|
18458
|
-
function
|
|
18458
|
+
function WT(e, E) {
|
|
18459
18459
|
const T = e.slice(0, E).split(/\n/);
|
|
18460
18460
|
return { line: T.length, col: T[T.length - 1].length + 1 };
|
|
18461
18461
|
}
|
|
18462
|
-
class
|
|
18462
|
+
class PI {
|
|
18463
18463
|
constructor(E, T) {
|
|
18464
18464
|
this.rules = E, this.dialectName = T, this.input = "", this.index = 0;
|
|
18465
18465
|
}
|
|
@@ -18485,7 +18485,7 @@ class MI {
|
|
|
18485
18485
|
return T;
|
|
18486
18486
|
}
|
|
18487
18487
|
createParseError() {
|
|
18488
|
-
const E = this.input.slice(this.index, this.index + 10), { line: T, col: R } =
|
|
18488
|
+
const E = this.input.slice(this.index, this.index + 10), { line: T, col: R } = WT(this.input, this.index);
|
|
18489
18489
|
return new Error(`Parse error: Unexpected "${E}" at line ${T} column ${R}.
|
|
18490
18490
|
${this.dialectInfo()}`);
|
|
18491
18491
|
}
|
|
@@ -18494,8 +18494,8 @@ ${this.dialectInfo()}`);
|
|
|
18494
18494
|
If possible, please select a more specific dialect (like sqlite, postgresql, etc).` : `SQL dialect used: "${this.dialectName}".`;
|
|
18495
18495
|
}
|
|
18496
18496
|
getWhitespace() {
|
|
18497
|
-
|
|
18498
|
-
const E =
|
|
18497
|
+
iT.lastIndex = this.index;
|
|
18498
|
+
const E = iT.exec(this.input);
|
|
18499
18499
|
if (E)
|
|
18500
18500
|
return this.index += E[0].length, E[0];
|
|
18501
18501
|
}
|
|
@@ -18521,23 +18521,23 @@ If possible, please select a more specific dialect (like sqlite, postgresql, etc
|
|
|
18521
18521
|
}
|
|
18522
18522
|
}
|
|
18523
18523
|
}
|
|
18524
|
-
const
|
|
18525
|
-
class
|
|
18524
|
+
const MT = /\/\*/uy, MI = /[\s\S]/uy, UI = /\*\//uy;
|
|
18525
|
+
class cI {
|
|
18526
18526
|
constructor() {
|
|
18527
18527
|
this.lastIndex = 0;
|
|
18528
18528
|
}
|
|
18529
18529
|
exec(E) {
|
|
18530
18530
|
let T = "", R, A = 0;
|
|
18531
|
-
if (R = this.matchSection(
|
|
18531
|
+
if (R = this.matchSection(MT, E))
|
|
18532
18532
|
T += R, A++;
|
|
18533
18533
|
else
|
|
18534
18534
|
return null;
|
|
18535
18535
|
for (; A > 0; )
|
|
18536
|
-
if (R = this.matchSection(
|
|
18536
|
+
if (R = this.matchSection(MT, E))
|
|
18537
18537
|
T += R, A++;
|
|
18538
|
-
else if (R = this.matchSection(cI, E))
|
|
18539
|
-
T += R, A--;
|
|
18540
18538
|
else if (R = this.matchSection(UI, E))
|
|
18539
|
+
T += R, A--;
|
|
18540
|
+
else if (R = this.matchSection(MI, E))
|
|
18541
18541
|
T += R;
|
|
18542
18542
|
else
|
|
18543
18543
|
return null;
|
|
@@ -18549,7 +18549,7 @@ class lI {
|
|
|
18549
18549
|
return R && (this.lastIndex += R[0].length), R ? R[0] : null;
|
|
18550
18550
|
}
|
|
18551
18551
|
}
|
|
18552
|
-
class
|
|
18552
|
+
class lI {
|
|
18553
18553
|
constructor(E, T) {
|
|
18554
18554
|
this.cfg = E, this.dialectName = T, this.rulesBeforeParams = this.buildRulesBeforeParams(E), this.rulesAfterParams = this.buildRulesAfterParams(E);
|
|
18555
18555
|
}
|
|
@@ -18558,7 +18558,7 @@ class uI {
|
|
|
18558
18558
|
...this.rulesBeforeParams,
|
|
18559
18559
|
...this.buildParamRules(this.cfg, T),
|
|
18560
18560
|
...this.rulesAfterParams
|
|
18561
|
-
], A = new
|
|
18561
|
+
], A = new PI(R, this.dialectName).tokenize(E);
|
|
18562
18562
|
return this.cfg.postProcess ? this.cfg.postProcess(A) : A;
|
|
18563
18563
|
}
|
|
18564
18564
|
// These rules can be cached as they only depend on
|
|
@@ -18572,15 +18572,15 @@ class uI {
|
|
|
18572
18572
|
},
|
|
18573
18573
|
{
|
|
18574
18574
|
type: D.BLOCK_COMMENT,
|
|
18575
|
-
regex: E.nestedBlockComments ? new
|
|
18575
|
+
regex: E.nestedBlockComments ? new cI() : /(\/\*[^]*?\*\/)/uy
|
|
18576
18576
|
},
|
|
18577
18577
|
{
|
|
18578
18578
|
type: D.LINE_COMMENT,
|
|
18579
|
-
regex:
|
|
18579
|
+
regex: _I((T = E.lineCommentTypes) !== null && T !== void 0 ? T : ["--"])
|
|
18580
18580
|
},
|
|
18581
18581
|
{
|
|
18582
18582
|
type: D.QUOTED_IDENTIFIER,
|
|
18583
|
-
regex:
|
|
18583
|
+
regex: PT(E.identTypes)
|
|
18584
18584
|
},
|
|
18585
18585
|
{
|
|
18586
18586
|
type: D.NUMBER,
|
|
@@ -18591,82 +18591,82 @@ class uI {
|
|
|
18591
18591
|
{
|
|
18592
18592
|
type: D.RESERVED_KEYWORD_PHRASE,
|
|
18593
18593
|
regex: V((R = E.reservedKeywordPhrases) !== null && R !== void 0 ? R : [], E.identChars),
|
|
18594
|
-
text:
|
|
18594
|
+
text: m
|
|
18595
18595
|
},
|
|
18596
18596
|
{
|
|
18597
18597
|
type: D.RESERVED_DATA_TYPE_PHRASE,
|
|
18598
18598
|
regex: V((A = E.reservedDataTypePhrases) !== null && A !== void 0 ? A : [], E.identChars),
|
|
18599
|
-
text:
|
|
18599
|
+
text: m
|
|
18600
18600
|
},
|
|
18601
18601
|
{
|
|
18602
18602
|
type: D.CASE,
|
|
18603
18603
|
regex: /CASE\b/iuy,
|
|
18604
|
-
text:
|
|
18604
|
+
text: m
|
|
18605
18605
|
},
|
|
18606
18606
|
{
|
|
18607
18607
|
type: D.END,
|
|
18608
18608
|
regex: /END\b/iuy,
|
|
18609
|
-
text:
|
|
18609
|
+
text: m
|
|
18610
18610
|
},
|
|
18611
18611
|
{
|
|
18612
18612
|
type: D.BETWEEN,
|
|
18613
18613
|
regex: /BETWEEN\b/iuy,
|
|
18614
|
-
text:
|
|
18614
|
+
text: m
|
|
18615
18615
|
},
|
|
18616
18616
|
{
|
|
18617
18617
|
type: D.LIMIT,
|
|
18618
18618
|
regex: E.reservedClauses.includes("LIMIT") ? /LIMIT\b/iuy : void 0,
|
|
18619
|
-
text:
|
|
18619
|
+
text: m
|
|
18620
18620
|
},
|
|
18621
18621
|
{
|
|
18622
18622
|
type: D.RESERVED_CLAUSE,
|
|
18623
18623
|
regex: V(E.reservedClauses, E.identChars),
|
|
18624
|
-
text:
|
|
18624
|
+
text: m
|
|
18625
18625
|
},
|
|
18626
18626
|
{
|
|
18627
18627
|
type: D.RESERVED_SELECT,
|
|
18628
18628
|
regex: V(E.reservedSelect, E.identChars),
|
|
18629
|
-
text:
|
|
18629
|
+
text: m
|
|
18630
18630
|
},
|
|
18631
18631
|
{
|
|
18632
18632
|
type: D.RESERVED_SET_OPERATION,
|
|
18633
18633
|
regex: V(E.reservedSetOperations, E.identChars),
|
|
18634
|
-
text:
|
|
18634
|
+
text: m
|
|
18635
18635
|
},
|
|
18636
18636
|
{
|
|
18637
18637
|
type: D.WHEN,
|
|
18638
18638
|
regex: /WHEN\b/iuy,
|
|
18639
|
-
text:
|
|
18639
|
+
text: m
|
|
18640
18640
|
},
|
|
18641
18641
|
{
|
|
18642
18642
|
type: D.ELSE,
|
|
18643
18643
|
regex: /ELSE\b/iuy,
|
|
18644
|
-
text:
|
|
18644
|
+
text: m
|
|
18645
18645
|
},
|
|
18646
18646
|
{
|
|
18647
18647
|
type: D.THEN,
|
|
18648
18648
|
regex: /THEN\b/iuy,
|
|
18649
|
-
text:
|
|
18649
|
+
text: m
|
|
18650
18650
|
},
|
|
18651
18651
|
{
|
|
18652
18652
|
type: D.RESERVED_JOIN,
|
|
18653
18653
|
regex: V(E.reservedJoins, E.identChars),
|
|
18654
|
-
text:
|
|
18654
|
+
text: m
|
|
18655
18655
|
},
|
|
18656
18656
|
{
|
|
18657
18657
|
type: D.AND,
|
|
18658
18658
|
regex: /AND\b/iuy,
|
|
18659
|
-
text:
|
|
18659
|
+
text: m
|
|
18660
18660
|
},
|
|
18661
18661
|
{
|
|
18662
18662
|
type: D.OR,
|
|
18663
18663
|
regex: /OR\b/iuy,
|
|
18664
|
-
text:
|
|
18664
|
+
text: m
|
|
18665
18665
|
},
|
|
18666
18666
|
{
|
|
18667
18667
|
type: D.XOR,
|
|
18668
18668
|
regex: E.supportsXor ? /XOR\b/iuy : void 0,
|
|
18669
|
-
text:
|
|
18669
|
+
text: m
|
|
18670
18670
|
},
|
|
18671
18671
|
...E.operatorKeyword ? [
|
|
18672
18672
|
{
|
|
@@ -18677,17 +18677,17 @@ class uI {
|
|
|
18677
18677
|
{
|
|
18678
18678
|
type: D.RESERVED_FUNCTION_NAME,
|
|
18679
18679
|
regex: V(E.reservedFunctionNames, E.identChars),
|
|
18680
|
-
text:
|
|
18680
|
+
text: m
|
|
18681
18681
|
},
|
|
18682
18682
|
{
|
|
18683
18683
|
type: D.RESERVED_DATA_TYPE,
|
|
18684
18684
|
regex: V(E.reservedDataTypes, E.identChars),
|
|
18685
|
-
text:
|
|
18685
|
+
text: m
|
|
18686
18686
|
},
|
|
18687
18687
|
{
|
|
18688
18688
|
type: D.RESERVED_KEYWORD,
|
|
18689
18689
|
regex: V(E.reservedKeywords, E.identChars),
|
|
18690
|
-
text:
|
|
18690
|
+
text: m
|
|
18691
18691
|
}
|
|
18692
18692
|
]);
|
|
18693
18693
|
}
|
|
@@ -18698,26 +18698,26 @@ class uI {
|
|
|
18698
18698
|
return this.validRules([
|
|
18699
18699
|
{
|
|
18700
18700
|
type: D.VARIABLE,
|
|
18701
|
-
regex: E.variableTypes ?
|
|
18701
|
+
regex: E.variableTypes ? oI(E.variableTypes) : void 0
|
|
18702
18702
|
},
|
|
18703
|
-
{ type: D.STRING, regex:
|
|
18703
|
+
{ type: D.STRING, regex: PT(E.stringTypes) },
|
|
18704
18704
|
{
|
|
18705
18705
|
type: D.IDENTIFIER,
|
|
18706
|
-
regex:
|
|
18706
|
+
regex: DI(E.identChars)
|
|
18707
18707
|
},
|
|
18708
18708
|
{ type: D.DELIMITER, regex: /[;]/uy },
|
|
18709
18709
|
{ type: D.COMMA, regex: /[,]/y },
|
|
18710
18710
|
{
|
|
18711
18711
|
type: D.OPEN_PAREN,
|
|
18712
|
-
regex:
|
|
18712
|
+
regex: aT("open", E.extraParens)
|
|
18713
18713
|
},
|
|
18714
18714
|
{
|
|
18715
18715
|
type: D.CLOSE_PAREN,
|
|
18716
|
-
regex:
|
|
18716
|
+
regex: aT("close", E.extraParens)
|
|
18717
18717
|
},
|
|
18718
18718
|
{
|
|
18719
18719
|
type: D.OPERATOR,
|
|
18720
|
-
regex:
|
|
18720
|
+
regex: oT([
|
|
18721
18721
|
// standard operators
|
|
18722
18722
|
"+",
|
|
18723
18723
|
"-",
|
|
@@ -18735,7 +18735,7 @@ class uI {
|
|
|
18735
18735
|
{ type: D.ASTERISK, regex: /[*]/uy },
|
|
18736
18736
|
{
|
|
18737
18737
|
type: D.PROPERTY_ACCESS_OPERATOR,
|
|
18738
|
-
regex:
|
|
18738
|
+
regex: oT([".", ...(R = E.propertyAccessOperators) !== null && R !== void 0 ? R : []])
|
|
18739
18739
|
}
|
|
18740
18740
|
]);
|
|
18741
18741
|
}
|
|
@@ -18753,12 +18753,12 @@ class uI {
|
|
|
18753
18753
|
return this.validRules([
|
|
18754
18754
|
{
|
|
18755
18755
|
type: D.NAMED_PARAMETER,
|
|
18756
|
-
regex: FE(s.named,
|
|
18756
|
+
regex: FE(s.named, VT(E.paramChars || E.identChars)),
|
|
18757
18757
|
key: (O) => O.slice(1)
|
|
18758
18758
|
},
|
|
18759
18759
|
{
|
|
18760
18760
|
type: D.QUOTED_PARAMETER,
|
|
18761
|
-
regex: FE(s.quoted,
|
|
18761
|
+
regex: FE(s.quoted, fT(E.identTypes)),
|
|
18762
18762
|
key: (O) => (({ tokenKey: N, quoteChar: C }) => N.replace(new RegExp(h("\\" + C), "gu"), C))({
|
|
18763
18763
|
tokenKey: O.slice(2, -1),
|
|
18764
18764
|
quoteChar: O.slice(-1)
|
|
@@ -18788,13 +18788,13 @@ class uI {
|
|
|
18788
18788
|
return E.filter((T) => !!T.regex);
|
|
18789
18789
|
}
|
|
18790
18790
|
}
|
|
18791
|
-
const
|
|
18792
|
-
let E =
|
|
18793
|
-
return E || (E =
|
|
18794
|
-
},
|
|
18795
|
-
tokenizer: new
|
|
18796
|
-
formatOptions:
|
|
18797
|
-
}),
|
|
18791
|
+
const m = (e) => z(e.toUpperCase()), UT = /* @__PURE__ */ new Map(), uI = (e) => {
|
|
18792
|
+
let E = UT.get(e);
|
|
18793
|
+
return E || (E = GI(e), UT.set(e, E)), E;
|
|
18794
|
+
}, GI = (e) => ({
|
|
18795
|
+
tokenizer: new lI(e.tokenizerOptions, e.name),
|
|
18796
|
+
formatOptions: HI(e.formatOptions)
|
|
18797
|
+
}), HI = (e) => {
|
|
18798
18798
|
var E;
|
|
18799
18799
|
return {
|
|
18800
18800
|
alwaysDenseOperators: e.alwaysDenseOperators || [],
|
|
@@ -18802,7 +18802,7 @@ const d = (e) => z(e.toUpperCase()), cT = /* @__PURE__ */ new Map(), GI = (e) =>
|
|
|
18802
18802
|
tabularOnelineClauses: Object.fromEntries(((E = e.tabularOnelineClauses) !== null && E !== void 0 ? E : e.onelineClauses).map((T) => [T, !0]))
|
|
18803
18803
|
};
|
|
18804
18804
|
};
|
|
18805
|
-
function
|
|
18805
|
+
function BI(e) {
|
|
18806
18806
|
return e.indentStyle === "tabularLeft" || e.indentStyle === "tabularRight" ? " ".repeat(10) : e.useTabs ? " " : " ".repeat(e.tabWidth);
|
|
18807
18807
|
}
|
|
18808
18808
|
function J(e) {
|
|
@@ -18831,15 +18831,15 @@ class mI {
|
|
|
18831
18831
|
this.index = E;
|
|
18832
18832
|
}
|
|
18833
18833
|
}
|
|
18834
|
-
function
|
|
18834
|
+
function dI(e) {
|
|
18835
18835
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
18836
18836
|
}
|
|
18837
|
-
var EE = { exports: {} },
|
|
18838
|
-
function
|
|
18839
|
-
return
|
|
18837
|
+
var EE = { exports: {} }, pI = EE.exports, cT;
|
|
18838
|
+
function FI() {
|
|
18839
|
+
return cT || (cT = 1, (function(e) {
|
|
18840
18840
|
(function(E, T) {
|
|
18841
18841
|
e.exports ? e.exports = T() : E.nearley = T();
|
|
18842
|
-
})(
|
|
18842
|
+
})(pI, function() {
|
|
18843
18843
|
function E(O, N, C) {
|
|
18844
18844
|
return this.id = ++E.highestId, this.name = O, this.symbols = N, this.postprocess = C, this;
|
|
18845
18845
|
}
|
|
@@ -18847,8 +18847,8 @@ function YI() {
|
|
|
18847
18847
|
var N = typeof O > "u" ? this.symbols.map(s).join(" ") : this.symbols.slice(0, O).map(s).join(" ") + " ● " + this.symbols.slice(O).map(s).join(" ");
|
|
18848
18848
|
return this.name + " → " + N;
|
|
18849
18849
|
};
|
|
18850
|
-
function T(O, N, C,
|
|
18851
|
-
this.rule = O, this.dot = N, this.reference = C, this.data = [], this.wantedBy =
|
|
18850
|
+
function T(O, N, C, n) {
|
|
18851
|
+
this.rule = O, this.dot = N, this.reference = C, this.data = [], this.wantedBy = n, this.isComplete = this.dot === O.symbols.length;
|
|
18852
18852
|
}
|
|
18853
18853
|
T.prototype.toString = function() {
|
|
18854
18854
|
return "{" + this.rule.toString(this.dot) + "}, from: " + (this.reference || 0);
|
|
@@ -18868,7 +18868,7 @@ function YI() {
|
|
|
18868
18868
|
this.grammar = O, this.index = N, this.states = [], this.wants = {}, this.scannable = [], this.completed = {};
|
|
18869
18869
|
}
|
|
18870
18870
|
R.prototype.process = function(O) {
|
|
18871
|
-
for (var N = this.states, C = this.wants,
|
|
18871
|
+
for (var N = this.states, C = this.wants, n = this.completed, L = 0; L < N.length; L++) {
|
|
18872
18872
|
var i = N[L];
|
|
18873
18873
|
if (i.isComplete) {
|
|
18874
18874
|
if (i.finish(), i.data !== I.fail) {
|
|
@@ -18888,8 +18888,8 @@ function YI() {
|
|
|
18888
18888
|
continue;
|
|
18889
18889
|
}
|
|
18890
18890
|
if (C[U]) {
|
|
18891
|
-
if (C[U].push(i),
|
|
18892
|
-
for (var M =
|
|
18891
|
+
if (C[U].push(i), n.hasOwnProperty(U))
|
|
18892
|
+
for (var M = n[U], l = 0; l < M.length; l++) {
|
|
18893
18893
|
var G = M[l];
|
|
18894
18894
|
this.complete(i, G);
|
|
18895
18895
|
}
|
|
@@ -18899,7 +18899,7 @@ function YI() {
|
|
|
18899
18899
|
}
|
|
18900
18900
|
}, R.prototype.predict = function(O) {
|
|
18901
18901
|
for (var N = this.grammar.byName[O] || [], C = 0; C < N.length; C++) {
|
|
18902
|
-
var
|
|
18902
|
+
var n = N[C], L = this.wants[O], i = new T(n, 0, this.index, L);
|
|
18903
18903
|
this.states.push(i);
|
|
18904
18904
|
}
|
|
18905
18905
|
}, R.prototype.complete = function(O, N) {
|
|
@@ -18909,16 +18909,16 @@ function YI() {
|
|
|
18909
18909
|
function A(O, N) {
|
|
18910
18910
|
this.rules = O, this.start = N || this.rules[0].name;
|
|
18911
18911
|
var C = this.byName = {};
|
|
18912
|
-
this.rules.forEach(function(
|
|
18913
|
-
C.hasOwnProperty(
|
|
18912
|
+
this.rules.forEach(function(n) {
|
|
18913
|
+
C.hasOwnProperty(n.name) || (C[n.name] = []), C[n.name].push(n);
|
|
18914
18914
|
});
|
|
18915
18915
|
}
|
|
18916
|
-
A.fromCompiled = function(
|
|
18917
|
-
var C =
|
|
18918
|
-
|
|
18919
|
-
var
|
|
18916
|
+
A.fromCompiled = function(n, N) {
|
|
18917
|
+
var C = n.Lexer;
|
|
18918
|
+
n.ParserStart && (N = n.ParserStart, n = n.ParserRules);
|
|
18919
|
+
var n = n.map(function(i) {
|
|
18920
18920
|
return new E(i.name, i.symbols, i.postprocess);
|
|
18921
|
-
}), L = new A(
|
|
18921
|
+
}), L = new A(n, N);
|
|
18922
18922
|
return L.lexer = C, L;
|
|
18923
18923
|
};
|
|
18924
18924
|
function S() {
|
|
@@ -18940,7 +18940,7 @@ function YI() {
|
|
|
18940
18940
|
}, S.prototype.formatError = function(O, N) {
|
|
18941
18941
|
var C = this.buffer;
|
|
18942
18942
|
if (typeof C == "string") {
|
|
18943
|
-
var
|
|
18943
|
+
var n = C.split(`
|
|
18944
18944
|
`).slice(
|
|
18945
18945
|
Math.max(0, this.line - 5),
|
|
18946
18946
|
this.line
|
|
@@ -18950,8 +18950,8 @@ function YI() {
|
|
|
18950
18950
|
var i = this.index - this.lastLineBreak, a = String(this.line).length;
|
|
18951
18951
|
return N += " at line " + this.line + " col " + i + `:
|
|
18952
18952
|
|
|
18953
|
-
`, N +=
|
|
18954
|
-
return l(this.line -
|
|
18953
|
+
`, N += n.map(function(P, U) {
|
|
18954
|
+
return l(this.line - n.length + U + 1, a) + " " + P;
|
|
18955
18955
|
}, this).join(`
|
|
18956
18956
|
`), N += `
|
|
18957
18957
|
` + l("", a + i) + `^
|
|
@@ -18965,18 +18965,18 @@ function YI() {
|
|
|
18965
18965
|
};
|
|
18966
18966
|
function I(O, N, C) {
|
|
18967
18967
|
if (O instanceof A)
|
|
18968
|
-
var
|
|
18968
|
+
var n = O, C = N;
|
|
18969
18969
|
else
|
|
18970
|
-
var
|
|
18971
|
-
this.grammar =
|
|
18970
|
+
var n = A.fromCompiled(O, N);
|
|
18971
|
+
this.grammar = n, this.options = {
|
|
18972
18972
|
keepHistory: !1,
|
|
18973
|
-
lexer:
|
|
18973
|
+
lexer: n.lexer || new S()
|
|
18974
18974
|
};
|
|
18975
18975
|
for (var L in C || {})
|
|
18976
18976
|
this.options[L] = C[L];
|
|
18977
18977
|
this.lexer = this.options.lexer, this.lexerState = void 0;
|
|
18978
|
-
var i = new R(
|
|
18979
|
-
this.table = [i], i.wants[
|
|
18978
|
+
var i = new R(n, 0);
|
|
18979
|
+
this.table = [i], i.wants[n.start] = [], i.predict(n.start), i.process(), this.current = 0;
|
|
18980
18980
|
}
|
|
18981
18981
|
I.fail = {}, I.prototype.feed = function(O) {
|
|
18982
18982
|
var N = this.lexer;
|
|
@@ -18988,8 +18988,8 @@ function YI() {
|
|
|
18988
18988
|
} catch (Y) {
|
|
18989
18989
|
var a = new R(this.grammar, this.current + 1);
|
|
18990
18990
|
this.table.push(a);
|
|
18991
|
-
var
|
|
18992
|
-
throw
|
|
18991
|
+
var n = new Error(this.reportLexerError(Y));
|
|
18992
|
+
throw n.offset = this.current, n.token = Y.token, n;
|
|
18993
18993
|
}
|
|
18994
18994
|
var L = this.table[this.current];
|
|
18995
18995
|
this.options.keepHistory || delete this.table[this.current - 1];
|
|
@@ -19003,22 +19003,22 @@ function YI() {
|
|
|
19003
19003
|
}
|
|
19004
19004
|
}
|
|
19005
19005
|
if (a.process(), a.states.length === 0) {
|
|
19006
|
-
var
|
|
19007
|
-
throw
|
|
19006
|
+
var n = new Error(this.reportError(C));
|
|
19007
|
+
throw n.offset = this.current, n.token = C, n;
|
|
19008
19008
|
}
|
|
19009
19009
|
this.options.keepHistory && (L.lexerState = N.save()), this.current++;
|
|
19010
19010
|
}
|
|
19011
19011
|
return L && (this.lexerState = N.save()), this.results = this.finish(), this;
|
|
19012
19012
|
}, I.prototype.reportLexerError = function(O) {
|
|
19013
|
-
var N, C,
|
|
19014
|
-
return
|
|
19013
|
+
var N, C, n = O.token;
|
|
19014
|
+
return n ? (N = "input " + JSON.stringify(n.text[0]) + " (lexer error)", C = this.lexer.formatError(n, "Syntax error")) : (N = "input (lexer error)", C = O.message), this.reportErrorCommon(C, N);
|
|
19015
19015
|
}, I.prototype.reportError = function(O) {
|
|
19016
19016
|
var N = (O.type ? O.type + " token: " : "") + JSON.stringify(O.value !== void 0 ? O.value : O), C = this.lexer.formatError(O, "Syntax error");
|
|
19017
19017
|
return this.reportErrorCommon(C, N);
|
|
19018
19018
|
}, I.prototype.reportErrorCommon = function(O, N) {
|
|
19019
19019
|
var C = [];
|
|
19020
19020
|
C.push(O);
|
|
19021
|
-
var
|
|
19021
|
+
var n = this.table.length - 2, L = this.table[n], i = L.states.filter(function(l) {
|
|
19022
19022
|
var P = l.rule.symbols[l.dot];
|
|
19023
19023
|
return P && typeof P != "string";
|
|
19024
19024
|
});
|
|
@@ -19039,9 +19039,9 @@ function YI() {
|
|
|
19039
19039
|
return C.push(""), C.join(`
|
|
19040
19040
|
`);
|
|
19041
19041
|
}, I.prototype.displayStateStack = function(O, N) {
|
|
19042
|
-
for (var C,
|
|
19042
|
+
for (var C, n = 0, L = 0; L < O.length; L++) {
|
|
19043
19043
|
var i = O[L], a = i.rule.toString(i.dot);
|
|
19044
|
-
a === C ?
|
|
19044
|
+
a === C ? n++ : (n > 0 && N.push(" ^ " + n + " more lines identical to this"), n = 0, N.push(" " + a)), C = a;
|
|
19045
19045
|
}
|
|
19046
19046
|
}, I.prototype.getSymbolDisplay = function(O) {
|
|
19047
19047
|
return t(O);
|
|
@@ -19050,7 +19050,7 @@ function YI() {
|
|
|
19050
19050
|
return null;
|
|
19051
19051
|
if (O.wantedBy.length === 0)
|
|
19052
19052
|
return [O];
|
|
19053
|
-
var C = O.wantedBy[0],
|
|
19053
|
+
var C = O.wantedBy[0], n = [O].concat(N), L = this.buildFirstStateStack(C, n);
|
|
19054
19054
|
return L === null ? null : [O].concat(L);
|
|
19055
19055
|
}, I.prototype.save = function() {
|
|
19056
19056
|
var O = this.table[this.current];
|
|
@@ -19064,10 +19064,10 @@ function YI() {
|
|
|
19064
19064
|
this.restore(this.table[O]);
|
|
19065
19065
|
}, I.prototype.finish = function() {
|
|
19066
19066
|
var O = [], N = this.grammar.start, C = this.table[this.table.length - 1];
|
|
19067
|
-
return C.states.forEach(function(
|
|
19068
|
-
|
|
19069
|
-
}), O.map(function(
|
|
19070
|
-
return
|
|
19067
|
+
return C.states.forEach(function(n) {
|
|
19068
|
+
n.rule.name === N && n.dot === n.rule.symbols.length && n.reference === 0 && n.data !== I.fail && O.push(n);
|
|
19069
|
+
}), O.map(function(n) {
|
|
19070
|
+
return n.data;
|
|
19071
19071
|
});
|
|
19072
19072
|
};
|
|
19073
19073
|
function t(O) {
|
|
@@ -19110,14 +19110,14 @@ function YI() {
|
|
|
19110
19110
|
});
|
|
19111
19111
|
})(EE)), EE.exports;
|
|
19112
19112
|
}
|
|
19113
|
-
var
|
|
19114
|
-
const
|
|
19115
|
-
function
|
|
19116
|
-
return e.map(WI).map(bI).map(XI).map(yI)
|
|
19113
|
+
var YI = FI();
|
|
19114
|
+
const hI = /* @__PURE__ */ dI(YI);
|
|
19115
|
+
function fI(e) {
|
|
19116
|
+
return e.map(VI).map(WI).map(bI).map(XI).map(yI);
|
|
19117
19117
|
}
|
|
19118
|
-
const
|
|
19119
|
-
if (
|
|
19120
|
-
const R =
|
|
19118
|
+
const VI = (e, E, T) => {
|
|
19119
|
+
if (FT(e.type)) {
|
|
19120
|
+
const R = gI(T, E);
|
|
19121
19121
|
if (R && R.type === D.PROPERTY_ACCESS_OPERATOR)
|
|
19122
19122
|
return Object.assign(Object.assign({}, e), { type: D.IDENTIFIER, text: e.raw });
|
|
19123
19123
|
const A = Q(T, E);
|
|
@@ -19125,41 +19125,41 @@ const WI = (e, E, T) => {
|
|
|
19125
19125
|
return Object.assign(Object.assign({}, e), { type: D.IDENTIFIER, text: e.raw });
|
|
19126
19126
|
}
|
|
19127
19127
|
return e;
|
|
19128
|
-
},
|
|
19128
|
+
}, WI = (e, E, T) => {
|
|
19129
19129
|
if (e.type === D.RESERVED_FUNCTION_NAME) {
|
|
19130
19130
|
const R = Q(T, E);
|
|
19131
|
-
if (!R || !
|
|
19131
|
+
if (!R || !bT(R))
|
|
19132
19132
|
return Object.assign(Object.assign({}, e), { type: D.IDENTIFIER, text: e.raw });
|
|
19133
19133
|
}
|
|
19134
19134
|
return e;
|
|
19135
|
-
},
|
|
19135
|
+
}, bI = (e, E, T) => {
|
|
19136
19136
|
if (e.type === D.RESERVED_DATA_TYPE) {
|
|
19137
19137
|
const R = Q(T, E);
|
|
19138
|
-
if (R &&
|
|
19138
|
+
if (R && bT(R))
|
|
19139
19139
|
return Object.assign(Object.assign({}, e), { type: D.RESERVED_PARAMETERIZED_DATA_TYPE });
|
|
19140
19140
|
}
|
|
19141
19141
|
return e;
|
|
19142
|
-
},
|
|
19142
|
+
}, XI = (e, E, T) => {
|
|
19143
19143
|
if (e.type === D.IDENTIFIER) {
|
|
19144
19144
|
const R = Q(T, E);
|
|
19145
|
-
if (R &&
|
|
19145
|
+
if (R && XT(R))
|
|
19146
19146
|
return Object.assign(Object.assign({}, e), { type: D.ARRAY_IDENTIFIER });
|
|
19147
19147
|
}
|
|
19148
19148
|
return e;
|
|
19149
|
-
},
|
|
19149
|
+
}, yI = (e, E, T) => {
|
|
19150
19150
|
if (e.type === D.RESERVED_DATA_TYPE) {
|
|
19151
19151
|
const R = Q(T, E);
|
|
19152
|
-
if (R &&
|
|
19152
|
+
if (R && XT(R))
|
|
19153
19153
|
return Object.assign(Object.assign({}, e), { type: D.ARRAY_KEYWORD });
|
|
19154
19154
|
}
|
|
19155
19155
|
return e;
|
|
19156
|
-
},
|
|
19156
|
+
}, gI = (e, E) => Q(e, E, -1), Q = (e, E, T = 1) => {
|
|
19157
19157
|
let R = 1;
|
|
19158
|
-
for (; e[E + R * T] &&
|
|
19158
|
+
for (; e[E + R * T] && KI(e[E + R * T]); )
|
|
19159
19159
|
R++;
|
|
19160
19160
|
return e[E + R * T];
|
|
19161
|
-
},
|
|
19162
|
-
class
|
|
19161
|
+
}, bT = (e) => e.type === D.OPEN_PAREN && e.text === "(", XT = (e) => e.type === D.OPEN_PAREN && e.text === "[", KI = (e) => e.type === D.BLOCK_COMMENT || e.type === D.LINE_COMMENT;
|
|
19162
|
+
class yT {
|
|
19163
19163
|
constructor(E) {
|
|
19164
19164
|
this.tokenize = E, this.index = 0, this.tokens = [], this.input = "";
|
|
19165
19165
|
}
|
|
@@ -19172,7 +19172,7 @@ class gT {
|
|
|
19172
19172
|
save() {
|
|
19173
19173
|
}
|
|
19174
19174
|
formatError(E) {
|
|
19175
|
-
const { line: T, col: R } =
|
|
19175
|
+
const { line: T, col: R } = WT(this.input, E.start);
|
|
19176
19176
|
return `Parse error at token: ${E.text} at line ${T} column ${R}`;
|
|
19177
19177
|
}
|
|
19178
19178
|
has(E) {
|
|
@@ -19186,16 +19186,16 @@ var c;
|
|
|
19186
19186
|
function YE(e) {
|
|
19187
19187
|
return e[0];
|
|
19188
19188
|
}
|
|
19189
|
-
const u = new
|
|
19189
|
+
const u = new yT((e) => []), W = ([[e]]) => e, d = (e) => ({
|
|
19190
19190
|
type: c.keyword,
|
|
19191
19191
|
tokenType: e.type,
|
|
19192
19192
|
text: e.text,
|
|
19193
19193
|
raw: e.raw
|
|
19194
|
-
}),
|
|
19194
|
+
}), lT = (e) => ({
|
|
19195
19195
|
type: c.data_type,
|
|
19196
19196
|
text: e.text,
|
|
19197
19197
|
raw: e.raw
|
|
19198
|
-
}), p = (e, { leading: E, trailing: T }) => (E?.length && (e = Object.assign(Object.assign({}, e), { leadingComments: E })), T?.length && (e = Object.assign(Object.assign({}, e), { trailingComments: T })), e),
|
|
19198
|
+
}), p = (e, { leading: E, trailing: T }) => (E?.length && (e = Object.assign(Object.assign({}, e), { leadingComments: E })), T?.length && (e = Object.assign(Object.assign({}, e), { trailingComments: T })), e), $I = (e, { leading: E, trailing: T }) => {
|
|
19199
19199
|
if (E?.length) {
|
|
19200
19200
|
const [R, ...A] = e;
|
|
19201
19201
|
e = [p(R, { leading: E }), ...A];
|
|
@@ -19205,7 +19205,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19205
19205
|
e = [...R, p(A, { trailing: T })];
|
|
19206
19206
|
}
|
|
19207
19207
|
return e;
|
|
19208
|
-
},
|
|
19208
|
+
}, wI = {
|
|
19209
19209
|
Lexer: u,
|
|
19210
19210
|
ParserRules: [
|
|
19211
19211
|
{ name: "main$ebnf$1", symbols: [] },
|
|
@@ -19256,14 +19256,14 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19256
19256
|
const [A, S] = R;
|
|
19257
19257
|
return {
|
|
19258
19258
|
type: c.limit_clause,
|
|
19259
|
-
limitKw: p(
|
|
19259
|
+
limitKw: p(d(e), { trailing: E }),
|
|
19260
19260
|
offset: T,
|
|
19261
19261
|
count: S
|
|
19262
19262
|
};
|
|
19263
19263
|
} else
|
|
19264
19264
|
return {
|
|
19265
19265
|
type: c.limit_clause,
|
|
19266
|
-
limitKw: p(
|
|
19266
|
+
limitKw: p(d(e), { trailing: E }),
|
|
19267
19267
|
count: T
|
|
19268
19268
|
};
|
|
19269
19269
|
}
|
|
@@ -19279,7 +19279,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19279
19279
|
symbols: [u.has("RESERVED_SELECT") ? { type: "RESERVED_SELECT" } : RESERVED_SELECT, "select_clause$subexpression$1"],
|
|
19280
19280
|
postprocess: ([e, [E, T]]) => ({
|
|
19281
19281
|
type: c.clause,
|
|
19282
|
-
nameKw:
|
|
19282
|
+
nameKw: d(e),
|
|
19283
19283
|
children: [E, ...T]
|
|
19284
19284
|
})
|
|
19285
19285
|
},
|
|
@@ -19288,7 +19288,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19288
19288
|
symbols: [u.has("RESERVED_SELECT") ? { type: "RESERVED_SELECT" } : RESERVED_SELECT],
|
|
19289
19289
|
postprocess: ([e]) => ({
|
|
19290
19290
|
type: c.clause,
|
|
19291
|
-
nameKw:
|
|
19291
|
+
nameKw: d(e),
|
|
19292
19292
|
children: []
|
|
19293
19293
|
})
|
|
19294
19294
|
},
|
|
@@ -19304,7 +19304,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19304
19304
|
symbols: [u.has("RESERVED_CLAUSE") ? { type: "RESERVED_CLAUSE" } : RESERVED_CLAUSE, "other_clause$ebnf$1"],
|
|
19305
19305
|
postprocess: ([e, E]) => ({
|
|
19306
19306
|
type: c.clause,
|
|
19307
|
-
nameKw:
|
|
19307
|
+
nameKw: d(e),
|
|
19308
19308
|
children: E
|
|
19309
19309
|
})
|
|
19310
19310
|
},
|
|
@@ -19315,7 +19315,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19315
19315
|
symbols: [u.has("RESERVED_SET_OPERATION") ? { type: "RESERVED_SET_OPERATION" } : RESERVED_SET_OPERATION, "set_operation$ebnf$1"],
|
|
19316
19316
|
postprocess: ([e, E]) => ({
|
|
19317
19317
|
type: c.set_operation,
|
|
19318
|
-
nameKw:
|
|
19318
|
+
nameKw: d(e),
|
|
19319
19319
|
children: E
|
|
19320
19320
|
})
|
|
19321
19321
|
},
|
|
@@ -19397,7 +19397,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19397
19397
|
symbols: [u.has("ARRAY_KEYWORD") ? { type: "ARRAY_KEYWORD" } : ARRAY_KEYWORD, "_", "square_brackets"],
|
|
19398
19398
|
postprocess: ([e, E, T]) => ({
|
|
19399
19399
|
type: c.array_subscript,
|
|
19400
|
-
array: p(
|
|
19400
|
+
array: p(d(e), { trailing: E }),
|
|
19401
19401
|
parenthesis: T
|
|
19402
19402
|
})
|
|
19403
19403
|
},
|
|
@@ -19406,7 +19406,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19406
19406
|
symbols: [u.has("RESERVED_FUNCTION_NAME") ? { type: "RESERVED_FUNCTION_NAME" } : RESERVED_FUNCTION_NAME, "_", "parenthesis"],
|
|
19407
19407
|
postprocess: ([e, E, T]) => ({
|
|
19408
19408
|
type: c.function_call,
|
|
19409
|
-
nameKw: p(
|
|
19409
|
+
nameKw: p(d(e), { trailing: E }),
|
|
19410
19410
|
parenthesis: T
|
|
19411
19411
|
})
|
|
19412
19412
|
},
|
|
@@ -19469,9 +19469,9 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19469
19469
|
symbols: [u.has("BETWEEN") ? { type: "BETWEEN" } : BETWEEN, "_", "andless_expression_chain", "_", u.has("AND") ? { type: "AND" } : AND, "_", "andless_expression"],
|
|
19470
19470
|
postprocess: ([e, E, T, R, A, S, I]) => ({
|
|
19471
19471
|
type: c.between_predicate,
|
|
19472
|
-
betweenKw:
|
|
19473
|
-
expr1:
|
|
19474
|
-
andKw:
|
|
19472
|
+
betweenKw: d(e),
|
|
19473
|
+
expr1: $I(T, { leading: E, trailing: R }),
|
|
19474
|
+
andKw: d(A),
|
|
19475
19475
|
expr2: [p(I, { leading: S })]
|
|
19476
19476
|
})
|
|
19477
19477
|
},
|
|
@@ -19484,8 +19484,8 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19484
19484
|
symbols: [u.has("CASE") ? { type: "CASE" } : CASE, "_", "case_expression$ebnf$1", "case_expression$ebnf$2", u.has("END") ? { type: "END" } : END],
|
|
19485
19485
|
postprocess: ([e, E, T, R, A]) => ({
|
|
19486
19486
|
type: c.case_expression,
|
|
19487
|
-
caseKw: p(
|
|
19488
|
-
endKw:
|
|
19487
|
+
caseKw: p(d(e), { trailing: E }),
|
|
19488
|
+
endKw: d(A),
|
|
19489
19489
|
expr: T || [],
|
|
19490
19490
|
clauses: R
|
|
19491
19491
|
})
|
|
@@ -19495,8 +19495,8 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19495
19495
|
symbols: [u.has("WHEN") ? { type: "WHEN" } : WHEN, "_", "expression_chain_", u.has("THEN") ? { type: "THEN" } : THEN, "_", "expression_chain_"],
|
|
19496
19496
|
postprocess: ([e, E, T, R, A, S]) => ({
|
|
19497
19497
|
type: c.case_when,
|
|
19498
|
-
whenKw: p(
|
|
19499
|
-
thenKw: p(
|
|
19498
|
+
whenKw: p(d(e), { trailing: E }),
|
|
19499
|
+
thenKw: p(d(R), { trailing: A }),
|
|
19500
19500
|
condition: T,
|
|
19501
19501
|
result: S
|
|
19502
19502
|
})
|
|
@@ -19506,7 +19506,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19506
19506
|
symbols: [u.has("ELSE") ? { type: "ELSE" } : ELSE, "_", "expression_chain_"],
|
|
19507
19507
|
postprocess: ([e, E, T]) => ({
|
|
19508
19508
|
type: c.case_else,
|
|
19509
|
-
elseKw: p(
|
|
19509
|
+
elseKw: p(d(e), { trailing: E }),
|
|
19510
19510
|
result: T
|
|
19511
19511
|
})
|
|
19512
19512
|
},
|
|
@@ -19535,21 +19535,21 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19535
19535
|
{
|
|
19536
19536
|
name: "keyword",
|
|
19537
19537
|
symbols: ["keyword$subexpression$1"],
|
|
19538
|
-
postprocess: ([[e]]) =>
|
|
19538
|
+
postprocess: ([[e]]) => d(e)
|
|
19539
19539
|
},
|
|
19540
19540
|
{ name: "data_type$subexpression$1", symbols: [u.has("RESERVED_DATA_TYPE") ? { type: "RESERVED_DATA_TYPE" } : RESERVED_DATA_TYPE] },
|
|
19541
19541
|
{ name: "data_type$subexpression$1", symbols: [u.has("RESERVED_DATA_TYPE_PHRASE") ? { type: "RESERVED_DATA_TYPE_PHRASE" } : RESERVED_DATA_TYPE_PHRASE] },
|
|
19542
19542
|
{
|
|
19543
19543
|
name: "data_type",
|
|
19544
19544
|
symbols: ["data_type$subexpression$1"],
|
|
19545
|
-
postprocess: ([[e]]) =>
|
|
19545
|
+
postprocess: ([[e]]) => lT(e)
|
|
19546
19546
|
},
|
|
19547
19547
|
{
|
|
19548
19548
|
name: "data_type",
|
|
19549
19549
|
symbols: [u.has("RESERVED_PARAMETERIZED_DATA_TYPE") ? { type: "RESERVED_PARAMETERIZED_DATA_TYPE" } : RESERVED_PARAMETERIZED_DATA_TYPE, "_", "parenthesis"],
|
|
19550
19550
|
postprocess: ([e, E, T]) => ({
|
|
19551
19551
|
type: c.parameterized_data_type,
|
|
19552
|
-
dataType: p(
|
|
19552
|
+
dataType: p(lT(e), { trailing: E }),
|
|
19553
19553
|
parenthesis: T
|
|
19554
19554
|
})
|
|
19555
19555
|
},
|
|
@@ -19559,7 +19559,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19559
19559
|
{
|
|
19560
19560
|
name: "logic_operator",
|
|
19561
19561
|
symbols: ["logic_operator$subexpression$1"],
|
|
19562
|
-
postprocess: ([[e]]) =>
|
|
19562
|
+
postprocess: ([[e]]) => d(e)
|
|
19563
19563
|
},
|
|
19564
19564
|
{ name: "other_keyword$subexpression$1", symbols: [u.has("WHEN") ? { type: "WHEN" } : WHEN] },
|
|
19565
19565
|
{ name: "other_keyword$subexpression$1", symbols: [u.has("THEN") ? { type: "THEN" } : THEN] },
|
|
@@ -19568,7 +19568,7 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19568
19568
|
{
|
|
19569
19569
|
name: "other_keyword",
|
|
19570
19570
|
symbols: ["other_keyword$subexpression$1"],
|
|
19571
|
-
postprocess: ([[e]]) =>
|
|
19571
|
+
postprocess: ([[e]]) => d(e)
|
|
19572
19572
|
},
|
|
19573
19573
|
{ name: "_$ebnf$1", symbols: [] },
|
|
19574
19574
|
{ name: "_$ebnf$1", symbols: ["_$ebnf$1", "comment"], postprocess: (e) => e[0].concat([e[1]]) },
|
|
@@ -19602,13 +19602,13 @@ const u = new gT((e) => []), W = ([[e]]) => e, m = (e) => ({
|
|
|
19602
19602
|
}
|
|
19603
19603
|
],
|
|
19604
19604
|
ParserStart: "main"
|
|
19605
|
-
}, { Parser:
|
|
19606
|
-
function
|
|
19605
|
+
}, { Parser: JI, Grammar: xI } = hI;
|
|
19606
|
+
function vI(e) {
|
|
19607
19607
|
let E = {};
|
|
19608
|
-
const T = new
|
|
19609
|
-
...
|
|
19610
|
-
|
|
19611
|
-
]), R = new xI
|
|
19608
|
+
const T = new yT((A) => [
|
|
19609
|
+
...fI(e.tokenize(A, E)),
|
|
19610
|
+
pT(A.length)
|
|
19611
|
+
]), R = new JI(xI.fromCompiled(wI), { lexer: T });
|
|
19612
19612
|
return {
|
|
19613
19613
|
parse: (A, S) => {
|
|
19614
19614
|
E = S;
|
|
@@ -19624,7 +19624,7 @@ var o;
|
|
|
19624
19624
|
(function(e) {
|
|
19625
19625
|
e[e.SPACE = 0] = "SPACE", e[e.NO_SPACE = 1] = "NO_SPACE", e[e.NO_NEWLINE = 2] = "NO_NEWLINE", e[e.NEWLINE = 3] = "NEWLINE", e[e.MANDATORY_NEWLINE = 4] = "MANDATORY_NEWLINE", e[e.INDENT = 5] = "INDENT", e[e.SINGLE_INDENT = 6] = "SINGLE_INDENT";
|
|
19626
19626
|
})(o = o || (o = {}));
|
|
19627
|
-
class
|
|
19627
|
+
class gT {
|
|
19628
19628
|
constructor(E) {
|
|
19629
19629
|
this.indentation = E, this.items = [];
|
|
19630
19630
|
}
|
|
@@ -19660,11 +19660,11 @@ class KT {
|
|
|
19660
19660
|
}
|
|
19661
19661
|
}
|
|
19662
19662
|
trimHorizontalWhitespace() {
|
|
19663
|
-
for (;
|
|
19663
|
+
for (; QI(Z(this.items)); )
|
|
19664
19664
|
this.items.pop();
|
|
19665
19665
|
}
|
|
19666
19666
|
trimWhitespace() {
|
|
19667
|
-
for (;
|
|
19667
|
+
for (; ZI(Z(this.items)); )
|
|
19668
19668
|
this.items.pop();
|
|
19669
19669
|
}
|
|
19670
19670
|
addNewline(E) {
|
|
@@ -19711,18 +19711,18 @@ class KT {
|
|
|
19711
19711
|
}
|
|
19712
19712
|
}
|
|
19713
19713
|
}
|
|
19714
|
-
const
|
|
19715
|
-
function
|
|
19714
|
+
const QI = (e) => e === o.SPACE || e === o.SINGLE_INDENT, ZI = (e) => e === o.SPACE || e === o.SINGLE_INDENT || e === o.NEWLINE;
|
|
19715
|
+
function uT(e, E) {
|
|
19716
19716
|
if (E === "standard")
|
|
19717
19717
|
return e;
|
|
19718
19718
|
let T = [];
|
|
19719
19719
|
return e.length >= 10 && e.includes(" ") && ([e, ...T] = e.split(" ")), E === "tabularLeft" ? e = e.padEnd(9, " ") : e = e.padStart(9, " "), e + ["", ...T].join(" ");
|
|
19720
19720
|
}
|
|
19721
|
-
function
|
|
19721
|
+
function GT(e) {
|
|
19722
19722
|
return me(e) || e === D.RESERVED_CLAUSE || e === D.RESERVED_SELECT || e === D.RESERVED_SET_OPERATION || e === D.RESERVED_JOIN || e === D.LIMIT;
|
|
19723
19723
|
}
|
|
19724
|
-
const hE = "top-level",
|
|
19725
|
-
class
|
|
19724
|
+
const hE = "top-level", jI = "block-level";
|
|
19725
|
+
class KT {
|
|
19726
19726
|
/**
|
|
19727
19727
|
* @param {string} indent A string to indent with
|
|
19728
19728
|
*/
|
|
@@ -19751,7 +19751,7 @@ class $T {
|
|
|
19751
19751
|
* Increases indentation by one block-level indent.
|
|
19752
19752
|
*/
|
|
19753
19753
|
increaseBlockLevel() {
|
|
19754
|
-
this.indentTypes.push(
|
|
19754
|
+
this.indentTypes.push(jI);
|
|
19755
19755
|
}
|
|
19756
19756
|
/**
|
|
19757
19757
|
* Decreases indentation by one top-level indent.
|
|
@@ -19770,9 +19770,9 @@ class $T {
|
|
|
19770
19770
|
;
|
|
19771
19771
|
}
|
|
19772
19772
|
}
|
|
19773
|
-
class
|
|
19773
|
+
class qI extends gT {
|
|
19774
19774
|
constructor(E) {
|
|
19775
|
-
super(new
|
|
19775
|
+
super(new KT("")), this.expressionWidth = E, this.length = 0, this.trailingSpace = !1;
|
|
19776
19776
|
}
|
|
19777
19777
|
add(...E) {
|
|
19778
19778
|
if (E.forEach((T) => this.addToLength(T)), this.length > this.expressionWidth)
|
|
@@ -20014,7 +20014,7 @@ class eE {
|
|
|
20014
20014
|
cfg: this.cfg,
|
|
20015
20015
|
dialectCfg: this.dialectCfg,
|
|
20016
20016
|
params: this.params,
|
|
20017
|
-
layout: new
|
|
20017
|
+
layout: new qI(this.cfg.expressionWidth),
|
|
20018
20018
|
inline: !0
|
|
20019
20019
|
}).format(E);
|
|
20020
20020
|
} catch (R) {
|
|
@@ -20050,7 +20050,7 @@ class eE {
|
|
|
20050
20050
|
this.layout.add(this.showDataType(E), o.SPACE);
|
|
20051
20051
|
}
|
|
20052
20052
|
showKw(E) {
|
|
20053
|
-
return
|
|
20053
|
+
return GT(E.tokenType) ? uT(this.showNonTabularKw(E), this.cfg.indentStyle) : this.showNonTabularKw(E);
|
|
20054
20054
|
}
|
|
20055
20055
|
// Like showKw(), but skips tabular formatting
|
|
20056
20056
|
showNonTabularKw(E) {
|
|
@@ -20064,7 +20064,7 @@ class eE {
|
|
|
20064
20064
|
}
|
|
20065
20065
|
}
|
|
20066
20066
|
showFunctionKw(E) {
|
|
20067
|
-
return
|
|
20067
|
+
return GT(E.tokenType) ? uT(this.showNonTabularFunctionKw(E), this.cfg.indentStyle) : this.showNonTabularFunctionKw(E);
|
|
20068
20068
|
}
|
|
20069
20069
|
// Like showFunctionKw(), but skips tabular formatting
|
|
20070
20070
|
showNonTabularFunctionKw(E) {
|
|
@@ -20100,7 +20100,7 @@ class eE {
|
|
|
20100
20100
|
}
|
|
20101
20101
|
}
|
|
20102
20102
|
}
|
|
20103
|
-
class
|
|
20103
|
+
class kI {
|
|
20104
20104
|
constructor(E, T) {
|
|
20105
20105
|
this.dialect = E, this.cfg = T, this.params = new mI(this.cfg.params);
|
|
20106
20106
|
}
|
|
@@ -20114,7 +20114,7 @@ class zI {
|
|
|
20114
20114
|
return this.formatAst(T).trimEnd();
|
|
20115
20115
|
}
|
|
20116
20116
|
parse(E) {
|
|
20117
|
-
return
|
|
20117
|
+
return vI(this.dialect.tokenizer).parse(E, this.cfg.paramTypes || {});
|
|
20118
20118
|
}
|
|
20119
20119
|
formatAst(E) {
|
|
20120
20120
|
return E.map((T) => this.formatStatement(T)).join(`
|
|
@@ -20125,14 +20125,14 @@ class zI {
|
|
|
20125
20125
|
cfg: this.cfg,
|
|
20126
20126
|
dialectCfg: this.dialect.formatOptions,
|
|
20127
20127
|
params: this.params,
|
|
20128
|
-
layout: new
|
|
20128
|
+
layout: new gT(new KT(BI(this.cfg)))
|
|
20129
20129
|
}).format(E.children);
|
|
20130
20130
|
return E.hasSemicolon && (this.cfg.newlineBeforeSemicolon ? T.add(o.NEWLINE, ";") : T.add(o.NO_NEWLINE, ";")), T.toString();
|
|
20131
20131
|
}
|
|
20132
20132
|
}
|
|
20133
20133
|
class TE extends Error {
|
|
20134
20134
|
}
|
|
20135
|
-
function
|
|
20135
|
+
function zI(e) {
|
|
20136
20136
|
const E = [
|
|
20137
20137
|
"multilineLists",
|
|
20138
20138
|
"newlineBeforeOpenParen",
|
|
@@ -20146,17 +20146,17 @@ function EO(e) {
|
|
|
20146
20146
|
throw new TE(`${T} config is no more supported.`);
|
|
20147
20147
|
if (e.expressionWidth <= 0)
|
|
20148
20148
|
throw new TE(`expressionWidth config must be positive number. Received ${e.expressionWidth} instead.`);
|
|
20149
|
-
if (e.params && !
|
|
20149
|
+
if (e.params && !EO(e.params) && console.warn('WARNING: All "params" option values should be strings.'), e.paramTypes && !TO(e.paramTypes))
|
|
20150
20150
|
throw new TE("Empty regex given in custom paramTypes. That would result in matching infinite amount of parameters.");
|
|
20151
20151
|
return e;
|
|
20152
20152
|
}
|
|
20153
|
-
function
|
|
20153
|
+
function EO(e) {
|
|
20154
20154
|
return (e instanceof Array ? e : Object.values(e)).every((T) => typeof T == "string");
|
|
20155
20155
|
}
|
|
20156
|
-
function
|
|
20156
|
+
function TO(e) {
|
|
20157
20157
|
return e.custom && Array.isArray(e.custom) ? e.custom.every((E) => E.regex !== "") : !0;
|
|
20158
20158
|
}
|
|
20159
|
-
var
|
|
20159
|
+
var eO = function(e, E) {
|
|
20160
20160
|
var T = {};
|
|
20161
20161
|
for (var R in e) Object.prototype.hasOwnProperty.call(e, R) && E.indexOf(R) < 0 && (T[R] = e[R]);
|
|
20162
20162
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -20164,7 +20164,7 @@ var RO = function(e, E) {
|
|
|
20164
20164
|
E.indexOf(R[A]) < 0 && Object.prototype.propertyIsEnumerable.call(e, R[A]) && (T[R[A]] = e[R[A]]);
|
|
20165
20165
|
return T;
|
|
20166
20166
|
};
|
|
20167
|
-
const
|
|
20167
|
+
const $T = {
|
|
20168
20168
|
bigquery: "bigquery",
|
|
20169
20169
|
db2: "db2",
|
|
20170
20170
|
db2i: "db2i",
|
|
@@ -20185,7 +20185,7 @@ const wT = {
|
|
|
20185
20185
|
tsql: "transactsql",
|
|
20186
20186
|
singlestoredb: "singlestoredb",
|
|
20187
20187
|
snowflake: "snowflake"
|
|
20188
|
-
},
|
|
20188
|
+
}, RO = Object.keys($T), AO = {
|
|
20189
20189
|
tabWidth: 2,
|
|
20190
20190
|
useTabs: !1,
|
|
20191
20191
|
keywordCase: "preserve",
|
|
@@ -20198,21 +20198,21 @@ const wT = {
|
|
|
20198
20198
|
linesBetweenQueries: 1,
|
|
20199
20199
|
denseOperators: !1,
|
|
20200
20200
|
newlineBeforeSemicolon: !1
|
|
20201
|
-
},
|
|
20202
|
-
if (typeof E.language == "string" && !
|
|
20201
|
+
}, SO = (e, E = {}) => {
|
|
20202
|
+
if (typeof E.language == "string" && !RO.includes(E.language))
|
|
20203
20203
|
throw new TE(`Unsupported SQL dialect: ${E.language}`);
|
|
20204
|
-
const T =
|
|
20205
|
-
return
|
|
20206
|
-
},
|
|
20207
|
-
var { dialect: T } = E, R =
|
|
20204
|
+
const T = $T[E.language || "sql"];
|
|
20205
|
+
return IO(e, Object.assign(Object.assign({}, E), { dialect: CI[T] }));
|
|
20206
|
+
}, IO = (e, E) => {
|
|
20207
|
+
var { dialect: T } = E, R = eO(E, ["dialect"]);
|
|
20208
20208
|
if (typeof e != "string")
|
|
20209
20209
|
throw new Error("Invalid query argument. Expected string, instead got " + typeof e);
|
|
20210
|
-
const A =
|
|
20211
|
-
return new
|
|
20210
|
+
const A = zI(Object.assign(Object.assign({}, AO), R));
|
|
20211
|
+
return new kI(uI(T), A).format(e);
|
|
20212
20212
|
};
|
|
20213
|
-
function
|
|
20213
|
+
function HT(e, E) {
|
|
20214
20214
|
try {
|
|
20215
|
-
return
|
|
20215
|
+
return SO(e, {
|
|
20216
20216
|
language: {
|
|
20217
20217
|
postgres: "postgresql",
|
|
20218
20218
|
mysql: "mysql",
|
|
@@ -20228,7 +20228,7 @@ function BT(e, E) {
|
|
|
20228
20228
|
return console.warn("SQL formatting failed:", T), e;
|
|
20229
20229
|
}
|
|
20230
20230
|
}
|
|
20231
|
-
class
|
|
20231
|
+
class OO {
|
|
20232
20232
|
cubes = /* @__PURE__ */ new Map();
|
|
20233
20233
|
dbExecutor;
|
|
20234
20234
|
metadataCache;
|
|
@@ -20236,7 +20236,7 @@ class gE {
|
|
|
20236
20236
|
METADATA_CACHE_TTL = 300 * 1e3;
|
|
20237
20237
|
// 5 minutes in milliseconds
|
|
20238
20238
|
constructor(E) {
|
|
20239
|
-
E?.databaseExecutor ? this.dbExecutor = E.databaseExecutor : E?.drizzle && (this.dbExecutor =
|
|
20239
|
+
E?.databaseExecutor ? this.dbExecutor = E.databaseExecutor : E?.drizzle && (this.dbExecutor = QE(
|
|
20240
20240
|
E.drizzle,
|
|
20241
20241
|
E.schema,
|
|
20242
20242
|
E.engineType
|
|
@@ -20258,7 +20258,7 @@ class gE {
|
|
|
20258
20258
|
* Set Drizzle instance and schema directly
|
|
20259
20259
|
*/
|
|
20260
20260
|
setDrizzle(E, T, R) {
|
|
20261
|
-
this.dbExecutor =
|
|
20261
|
+
this.dbExecutor = QE(E, T, R);
|
|
20262
20262
|
}
|
|
20263
20263
|
/**
|
|
20264
20264
|
* Check if database executor is configured
|
|
@@ -20287,7 +20287,7 @@ class gE {
|
|
|
20287
20287
|
);
|
|
20288
20288
|
continue;
|
|
20289
20289
|
}
|
|
20290
|
-
const S =
|
|
20290
|
+
const S = Le(A.calculatedSql);
|
|
20291
20291
|
if (!S.isValid) {
|
|
20292
20292
|
T.push(
|
|
20293
20293
|
`Invalid calculatedSql syntax in '${E.name}.${R}': ${S.errors.join(", ")}`
|
|
@@ -20452,7 +20452,7 @@ ${T.join(`
|
|
|
20452
20452
|
throw new Error("Database executor not configured");
|
|
20453
20453
|
const I = await new LE(this.dbExecutor).generateSQL(A, T, R), t = this.dbExecutor.getEngineType();
|
|
20454
20454
|
return {
|
|
20455
|
-
sql:
|
|
20455
|
+
sql: HT(I.sql, t),
|
|
20456
20456
|
params: I.params
|
|
20457
20457
|
};
|
|
20458
20458
|
}
|
|
@@ -20464,7 +20464,7 @@ ${T.join(`
|
|
|
20464
20464
|
throw new Error("Database executor not configured");
|
|
20465
20465
|
const A = await new LE(this.dbExecutor).generateMultiCubeSQL(this.cubes, E, T), S = this.dbExecutor.getEngineType();
|
|
20466
20466
|
return {
|
|
20467
|
-
sql:
|
|
20467
|
+
sql: HT(A.sql, S),
|
|
20468
20468
|
params: A.params
|
|
20469
20469
|
};
|
|
20470
20470
|
}
|
|
@@ -20505,7 +20505,7 @@ ${T.join(`
|
|
|
20505
20505
|
* Ensures all referenced cubes and fields exist
|
|
20506
20506
|
*/
|
|
20507
20507
|
validateQuery(E) {
|
|
20508
|
-
return
|
|
20508
|
+
return wT(this.cubes, E);
|
|
20509
20509
|
}
|
|
20510
20510
|
/**
|
|
20511
20511
|
* Analyze query planning decisions for debugging and transparency
|
|
@@ -20515,7 +20515,7 @@ ${T.join(`
|
|
|
20515
20515
|
analyzeQuery(E, T) {
|
|
20516
20516
|
if (!this.dbExecutor)
|
|
20517
20517
|
throw new Error("Database executor not configured");
|
|
20518
|
-
const R = new
|
|
20518
|
+
const R = new dT(), A = {
|
|
20519
20519
|
db: this.dbExecutor.db,
|
|
20520
20520
|
schema: this.dbExecutor.schema,
|
|
20521
20521
|
securityContext: T
|
|
@@ -20523,7 +20523,7 @@ ${T.join(`
|
|
|
20523
20523
|
return R.analyzeQueryPlan(this.cubes, E, A);
|
|
20524
20524
|
}
|
|
20525
20525
|
}
|
|
20526
|
-
function
|
|
20526
|
+
function wT(e, E) {
|
|
20527
20527
|
const T = [], R = /* @__PURE__ */ new Set();
|
|
20528
20528
|
if (E.measures)
|
|
20529
20529
|
for (const A of E.measures) {
|
|
@@ -20572,17 +20572,17 @@ function JT(e, E) {
|
|
|
20572
20572
|
}
|
|
20573
20573
|
if (E.filters)
|
|
20574
20574
|
for (const A of E.filters)
|
|
20575
|
-
|
|
20575
|
+
JT(A, e, T, R);
|
|
20576
20576
|
return R.size === 0 && T.push("Query must reference at least one cube through measures, dimensions, or filters"), {
|
|
20577
20577
|
isValid: T.length === 0,
|
|
20578
20578
|
errors: T
|
|
20579
20579
|
};
|
|
20580
20580
|
}
|
|
20581
|
-
function
|
|
20581
|
+
function JT(e, E, T, R) {
|
|
20582
20582
|
if ("and" in e || "or" in e) {
|
|
20583
20583
|
const t = e.and || e.or || [];
|
|
20584
20584
|
for (const s of t)
|
|
20585
|
-
|
|
20585
|
+
JT(s, E, T, R);
|
|
20586
20586
|
return;
|
|
20587
20587
|
}
|
|
20588
20588
|
if (!("member" in e)) {
|
|
@@ -20602,143 +20602,29 @@ function xT(e, E, T, R) {
|
|
|
20602
20602
|
}
|
|
20603
20603
|
!I.dimensions[S] && !I.measures[S] && T.push(`Filter field '${S}' not found on cube '${A}' (must be a dimension or measure)`);
|
|
20604
20604
|
}
|
|
20605
|
-
function
|
|
20606
|
-
return new
|
|
20607
|
-
}
|
|
20608
|
-
const NO = new gE(), rO = NO;
|
|
20609
|
-
function nO(e) {
|
|
20610
|
-
return new gE({
|
|
20605
|
+
function CO(e) {
|
|
20606
|
+
return new OO({
|
|
20611
20607
|
drizzle: e.drizzle,
|
|
20612
20608
|
schema: e.schema
|
|
20613
20609
|
});
|
|
20614
20610
|
}
|
|
20615
|
-
const _O = {
|
|
20616
|
-
/**
|
|
20617
|
-
* Create a simple query builder
|
|
20618
|
-
*/
|
|
20619
|
-
query: () => {
|
|
20620
|
-
const e = (E, T = [], R = [], A = [], S, I) => ({
|
|
20621
|
-
measures: E,
|
|
20622
|
-
dimensions: T,
|
|
20623
|
-
filters: R,
|
|
20624
|
-
timeDimensions: A,
|
|
20625
|
-
limit: S,
|
|
20626
|
-
order: I
|
|
20627
|
-
});
|
|
20628
|
-
return {
|
|
20629
|
-
measures: (E) => ({
|
|
20630
|
-
dimensions: (T = []) => ({
|
|
20631
|
-
filters: (R = []) => ({
|
|
20632
|
-
timeDimensions: (A = []) => ({
|
|
20633
|
-
limit: (S) => ({
|
|
20634
|
-
order: (I) => e(E, T, R, A, S, I)
|
|
20635
|
-
}),
|
|
20636
|
-
order: (S) => e(E, T, R, A, void 0, S)
|
|
20637
|
-
}),
|
|
20638
|
-
limit: (A) => ({
|
|
20639
|
-
order: (S) => e(E, T, R, [], A, S)
|
|
20640
|
-
}),
|
|
20641
|
-
order: (A) => e(E, T, R, [], void 0, A)
|
|
20642
|
-
}),
|
|
20643
|
-
timeDimensions: (R = []) => ({
|
|
20644
|
-
filters: (A = []) => ({
|
|
20645
|
-
limit: (S) => ({
|
|
20646
|
-
order: (I) => e(E, T, A, R, S, I)
|
|
20647
|
-
}),
|
|
20648
|
-
order: (S) => e(E, T, A, R, void 0, S)
|
|
20649
|
-
}),
|
|
20650
|
-
limit: (A) => ({
|
|
20651
|
-
order: (S) => e(E, T, [], R, A, S)
|
|
20652
|
-
}),
|
|
20653
|
-
order: (A) => e(E, T, [], R, void 0, A)
|
|
20654
|
-
}),
|
|
20655
|
-
limit: (R) => ({
|
|
20656
|
-
order: (A) => e(E, T, [], [], R, A)
|
|
20657
|
-
}),
|
|
20658
|
-
order: (R) => e(E, T, [], [], void 0, R)
|
|
20659
|
-
}),
|
|
20660
|
-
filters: (T = []) => ({
|
|
20661
|
-
dimensions: (R = []) => ({
|
|
20662
|
-
timeDimensions: (A = []) => ({
|
|
20663
|
-
limit: (S) => ({
|
|
20664
|
-
order: (I) => e(E, R, T, A, S, I)
|
|
20665
|
-
}),
|
|
20666
|
-
order: (S) => e(E, R, T, A, void 0, S)
|
|
20667
|
-
}),
|
|
20668
|
-
limit: (A) => ({
|
|
20669
|
-
order: (S) => e(E, R, T, [], A, S)
|
|
20670
|
-
}),
|
|
20671
|
-
order: (A) => e(E, R, T, [], void 0, A)
|
|
20672
|
-
}),
|
|
20673
|
-
timeDimensions: (R = []) => ({
|
|
20674
|
-
dimensions: (A = []) => ({
|
|
20675
|
-
limit: (S) => ({
|
|
20676
|
-
order: (I) => e(E, A, T, R, S, I)
|
|
20677
|
-
}),
|
|
20678
|
-
order: (S) => e(E, A, T, R, void 0, S)
|
|
20679
|
-
}),
|
|
20680
|
-
limit: (A) => ({
|
|
20681
|
-
order: (S) => e(E, [], T, R, A, S)
|
|
20682
|
-
}),
|
|
20683
|
-
order: (A) => e(E, [], T, R, void 0, A)
|
|
20684
|
-
}),
|
|
20685
|
-
limit: (R) => ({
|
|
20686
|
-
order: (A) => e(E, [], T, [], R, A)
|
|
20687
|
-
}),
|
|
20688
|
-
order: (R) => e(E, [], T, [], void 0, R)
|
|
20689
|
-
})
|
|
20690
|
-
})
|
|
20691
|
-
};
|
|
20692
|
-
},
|
|
20693
|
-
/**
|
|
20694
|
-
* Create filters
|
|
20695
|
-
*/
|
|
20696
|
-
filters: {
|
|
20697
|
-
equals: (e, E) => ({ member: e, operator: "equals", values: [E] }),
|
|
20698
|
-
notEquals: (e, E) => ({ member: e, operator: "notEquals", values: [E] }),
|
|
20699
|
-
contains: (e, E) => ({ member: e, operator: "contains", values: [E] }),
|
|
20700
|
-
greaterThan: (e, E) => ({ member: e, operator: "gt", values: [E] }),
|
|
20701
|
-
lessThan: (e, E) => ({ member: e, operator: "lt", values: [E] }),
|
|
20702
|
-
inDateRange: (e, E, T) => ({
|
|
20703
|
-
member: e,
|
|
20704
|
-
operator: "inDateRange",
|
|
20705
|
-
values: [E, T]
|
|
20706
|
-
}),
|
|
20707
|
-
set: (e) => ({ member: e, operator: "set", values: [] }),
|
|
20708
|
-
notSet: (e) => ({ member: e, operator: "notSet", values: [] })
|
|
20709
|
-
},
|
|
20710
|
-
/**
|
|
20711
|
-
* Create time dimensions
|
|
20712
|
-
*/
|
|
20713
|
-
timeDimensions: {
|
|
20714
|
-
create: (e, E, T) => ({
|
|
20715
|
-
dimension: e,
|
|
20716
|
-
granularity: E,
|
|
20717
|
-
dateRange: T
|
|
20718
|
-
})
|
|
20719
|
-
}
|
|
20720
|
-
};
|
|
20721
20611
|
export {
|
|
20722
20612
|
bE as BaseDatabaseExecutor,
|
|
20723
20613
|
mT as MySQLExecutor,
|
|
20724
|
-
|
|
20614
|
+
Ae as PostgresExecutor,
|
|
20725
20615
|
ne as QueryBuilder,
|
|
20726
20616
|
LE as QueryExecutor,
|
|
20727
|
-
|
|
20728
|
-
|
|
20729
|
-
|
|
20730
|
-
|
|
20731
|
-
|
|
20732
|
-
|
|
20733
|
-
|
|
20734
|
-
|
|
20735
|
-
vE as
|
|
20736
|
-
|
|
20737
|
-
LO as createSemanticLayer,
|
|
20738
|
-
rO as defaultSemanticLayer,
|
|
20739
|
-
CO as defineCube,
|
|
20617
|
+
dT as QueryPlanner,
|
|
20618
|
+
Ie as SQLiteExecutor,
|
|
20619
|
+
OO as SemanticLayerCompiler,
|
|
20620
|
+
QE as createDatabaseExecutor,
|
|
20621
|
+
CO as createDrizzleSemanticLayer,
|
|
20622
|
+
tO as createMultiCubeContext,
|
|
20623
|
+
Se as createMySQLExecutor,
|
|
20624
|
+
xE as createPostgresExecutor,
|
|
20625
|
+
vE as createSQLiteExecutor,
|
|
20626
|
+
sO as defineCube,
|
|
20740
20627
|
fE as getJoinType,
|
|
20741
20628
|
sE as resolveCubeReference,
|
|
20742
|
-
b as resolveSqlExpression
|
|
20743
|
-
NO as semanticLayer
|
|
20629
|
+
b as resolveSqlExpression
|
|
20744
20630
|
};
|