@rex0220/kintone-sql-tools 1.11.0 → 1.12.1
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-cli/ksql.js +10 -5
- package/dist-mcp/ksql-mcp.js +11 -6
- package/dist-mcpb/ksql-mcp.mcpb +0 -0
- package/package.json +1 -1
package/dist-cli/ksql.js
CHANGED
|
@@ -4007,6 +4007,11 @@ function applyFilter(rows, where) {
|
|
|
4007
4007
|
if (where === null) return rows;
|
|
4008
4008
|
return rows.filter((row) => evalWhere(where, row));
|
|
4009
4009
|
}
|
|
4010
|
+
function hasAggregateColumns(columns) {
|
|
4011
|
+
return columns.some(
|
|
4012
|
+
(c) => c.type === "AGGREGATE" || c.type === "ARITH_AGG_COL" || c.type === "STRFUNC_COL" && hasAggregateInStringFuncExpr2(c.expr)
|
|
4013
|
+
);
|
|
4014
|
+
}
|
|
4010
4015
|
function applyGroupBy(rows, groupByKeys, columns) {
|
|
4011
4016
|
const groups = /* @__PURE__ */ new Map();
|
|
4012
4017
|
for (const row of rows) {
|
|
@@ -4015,6 +4020,9 @@ function applyGroupBy(rows, groupByKeys, columns) {
|
|
|
4015
4020
|
if (bucket) bucket.push(row);
|
|
4016
4021
|
else groups.set(key, [row]);
|
|
4017
4022
|
}
|
|
4023
|
+
if (groups.size === 0 && groupByKeys.length === 0 && hasAggregateColumns(columns)) {
|
|
4024
|
+
groups.set("", []);
|
|
4025
|
+
}
|
|
4018
4026
|
const result = [];
|
|
4019
4027
|
for (const groupRows of groups.values()) {
|
|
4020
4028
|
const outRow = { ...groupRows[0] };
|
|
@@ -4430,10 +4438,7 @@ function runFullScan(input) {
|
|
|
4430
4438
|
rows = applyJoin(rows, rightRows, join2);
|
|
4431
4439
|
}
|
|
4432
4440
|
rows = applyFilter(rows, stmt.where);
|
|
4433
|
-
|
|
4434
|
-
(c) => c.type === "AGGREGATE" || c.type === "ARITH_AGG_COL" || c.type === "STRFUNC_COL" && hasAggregateInStringFuncExpr2(c.expr)
|
|
4435
|
-
);
|
|
4436
|
-
if (stmt.groupBy.length > 0 || hasAggregate) {
|
|
4441
|
+
if (stmt.groupBy.length > 0 || hasAggregateColumns(stmt.columns)) {
|
|
4437
4442
|
rows = applyGroupBy(rows, stmt.groupBy, stmt.columns);
|
|
4438
4443
|
}
|
|
4439
4444
|
rows = applyHaving(rows, stmt.having);
|
|
@@ -6903,7 +6908,7 @@ function normalizeAppKey(v) {
|
|
|
6903
6908
|
}
|
|
6904
6909
|
function extractAppIds(sql) {
|
|
6905
6910
|
const out = /* @__PURE__ */ new Set();
|
|
6906
|
-
for (const
|
|
6911
|
+
for (const t of collectAppProfileTokens(sql)) out.add(t.appId);
|
|
6907
6912
|
return [...out];
|
|
6908
6913
|
}
|
|
6909
6914
|
function isSqlIdentContinue(ch) {
|
package/dist-mcp/ksql-mcp.js
CHANGED
|
@@ -34909,6 +34909,11 @@ function applyFilter(rows, where) {
|
|
|
34909
34909
|
if (where === null) return rows;
|
|
34910
34910
|
return rows.filter((row) => evalWhere(where, row));
|
|
34911
34911
|
}
|
|
34912
|
+
function hasAggregateColumns(columns) {
|
|
34913
|
+
return columns.some(
|
|
34914
|
+
(c) => c.type === "AGGREGATE" || c.type === "ARITH_AGG_COL" || c.type === "STRFUNC_COL" && hasAggregateInStringFuncExpr2(c.expr)
|
|
34915
|
+
);
|
|
34916
|
+
}
|
|
34912
34917
|
function applyGroupBy(rows, groupByKeys, columns) {
|
|
34913
34918
|
const groups = /* @__PURE__ */ new Map();
|
|
34914
34919
|
for (const row of rows) {
|
|
@@ -34917,6 +34922,9 @@ function applyGroupBy(rows, groupByKeys, columns) {
|
|
|
34917
34922
|
if (bucket) bucket.push(row);
|
|
34918
34923
|
else groups.set(key, [row]);
|
|
34919
34924
|
}
|
|
34925
|
+
if (groups.size === 0 && groupByKeys.length === 0 && hasAggregateColumns(columns)) {
|
|
34926
|
+
groups.set("", []);
|
|
34927
|
+
}
|
|
34920
34928
|
const result = [];
|
|
34921
34929
|
for (const groupRows of groups.values()) {
|
|
34922
34930
|
const outRow = { ...groupRows[0] };
|
|
@@ -35332,10 +35340,7 @@ function runFullScan(input) {
|
|
|
35332
35340
|
rows = applyJoin(rows, rightRows, join);
|
|
35333
35341
|
}
|
|
35334
35342
|
rows = applyFilter(rows, stmt.where);
|
|
35335
|
-
|
|
35336
|
-
(c) => c.type === "AGGREGATE" || c.type === "ARITH_AGG_COL" || c.type === "STRFUNC_COL" && hasAggregateInStringFuncExpr2(c.expr)
|
|
35337
|
-
);
|
|
35338
|
-
if (stmt.groupBy.length > 0 || hasAggregate) {
|
|
35343
|
+
if (stmt.groupBy.length > 0 || hasAggregateColumns(stmt.columns)) {
|
|
35339
35344
|
rows = applyGroupBy(rows, stmt.groupBy, stmt.columns);
|
|
35340
35345
|
}
|
|
35341
35346
|
rows = applyHaving(rows, stmt.having);
|
|
@@ -37685,7 +37690,7 @@ function normalizeAppKey(v) {
|
|
|
37685
37690
|
}
|
|
37686
37691
|
function extractAppIds(sql) {
|
|
37687
37692
|
const out = /* @__PURE__ */ new Set();
|
|
37688
|
-
for (const
|
|
37693
|
+
for (const t of collectAppProfileTokens(sql)) out.add(t.appId);
|
|
37689
37694
|
return [...out];
|
|
37690
37695
|
}
|
|
37691
37696
|
function isSqlIdentContinue(ch) {
|
|
@@ -39270,7 +39275,7 @@ Options:
|
|
|
39270
39275
|
-h, --help Show help
|
|
39271
39276
|
`);
|
|
39272
39277
|
}
|
|
39273
|
-
var SERVER_VERSION = true ? "1.
|
|
39278
|
+
var SERVER_VERSION = true ? "1.12.1" : "0.0.0-dev";
|
|
39274
39279
|
function createServer(args) {
|
|
39275
39280
|
const server = new McpServer({
|
|
39276
39281
|
name: "ksql-mcp",
|
package/dist-mcpb/ksql-mcp.mcpb
CHANGED
|
Binary file
|