@querypanel/node-sdk 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -382,10 +382,15 @@ var ClickHouseAdapter = class {
|
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
384
|
const allowedSet = new Set(this.allowedTables);
|
|
385
|
-
const tablePattern =
|
|
385
|
+
const tablePattern = /\b(FROM|JOIN)\s+(?:FINAL\s+)?(?:(?:[a-zA-Z_][a-zA-Z0-9_]*)\.)?(["'`]?[a-zA-Z_][a-zA-Z0-9_]*["'`]?)/gi;
|
|
386
386
|
const matches = sql.matchAll(tablePattern);
|
|
387
387
|
for (const match of matches) {
|
|
388
|
-
const
|
|
388
|
+
const clause = match[1]?.toUpperCase();
|
|
389
|
+
const matchIndex = match.index ?? -1;
|
|
390
|
+
if (clause === "JOIN" && matchIndex >= 0 && isArrayJoinClause(sql, matchIndex)) {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
const table = match[2]?.replace(/["'`]/g, "");
|
|
389
394
|
if (table) {
|
|
390
395
|
if (!allowedSet.has(table)) {
|
|
391
396
|
throw new Error(
|
|
@@ -453,6 +458,11 @@ function normalizeTableFilter2(tables) {
|
|
|
453
458
|
}
|
|
454
459
|
return normalized;
|
|
455
460
|
}
|
|
461
|
+
function isArrayJoinClause(sql, joinIndex) {
|
|
462
|
+
const beforeJoin = sql.slice(0, joinIndex);
|
|
463
|
+
const previousToken = beforeJoin.trim().split(/\s+/).pop()?.toUpperCase();
|
|
464
|
+
return previousToken === "ARRAY";
|
|
465
|
+
}
|
|
456
466
|
function transformColumnRow(row) {
|
|
457
467
|
const unwrappedType = unwrapTypeModifiers(row.type);
|
|
458
468
|
const column = {
|