@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.js CHANGED
@@ -338,10 +338,15 @@ var ClickHouseAdapter = class {
338
338
  return;
339
339
  }
340
340
  const allowedSet = new Set(this.allowedTables);
341
- const tablePattern = /(?:FROM|JOIN)\s+(?:FINAL\s+)?(?:(?:[a-zA-Z_][a-zA-Z0-9_]*)\.)?(["'`]?[a-zA-Z_][a-zA-Z0-9_]*["'`]?)/gi;
341
+ const tablePattern = /\b(FROM|JOIN)\s+(?:FINAL\s+)?(?:(?:[a-zA-Z_][a-zA-Z0-9_]*)\.)?(["'`]?[a-zA-Z_][a-zA-Z0-9_]*["'`]?)/gi;
342
342
  const matches = sql.matchAll(tablePattern);
343
343
  for (const match of matches) {
344
- const table = match[1]?.replace(/["'`]/g, "");
344
+ const clause = match[1]?.toUpperCase();
345
+ const matchIndex = match.index ?? -1;
346
+ if (clause === "JOIN" && matchIndex >= 0 && isArrayJoinClause(sql, matchIndex)) {
347
+ continue;
348
+ }
349
+ const table = match[2]?.replace(/["'`]/g, "");
345
350
  if (table) {
346
351
  if (!allowedSet.has(table)) {
347
352
  throw new Error(
@@ -409,6 +414,11 @@ function normalizeTableFilter2(tables) {
409
414
  }
410
415
  return normalized;
411
416
  }
417
+ function isArrayJoinClause(sql, joinIndex) {
418
+ const beforeJoin = sql.slice(0, joinIndex);
419
+ const previousToken = beforeJoin.trim().split(/\s+/).pop()?.toUpperCase();
420
+ return previousToken === "ARRAY";
421
+ }
412
422
  function transformColumnRow(row) {
413
423
  const unwrappedType = unwrapTypeModifiers(row.type);
414
424
  const column = {