@rex0220/kintone-sql-tools 1.11.0 → 1.12.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-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
- const hasAggregate = stmt.columns.some(
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);
@@ -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
- const hasAggregate = stmt.columns.some(
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);
@@ -39270,7 +39275,7 @@ Options:
39270
39275
  -h, --help Show help
39271
39276
  `);
39272
39277
  }
39273
- var SERVER_VERSION = true ? "1.11.0" : "0.0.0-dev";
39278
+ var SERVER_VERSION = true ? "1.12.0" : "0.0.0-dev";
39274
39279
  function createServer(args) {
39275
39280
  const server = new McpServer({
39276
39281
  name: "ksql-mcp",
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rex0220/kintone-sql-tools",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "kintone SQL plugin, CLI, and MCP tools (ksql)",
5
5
  "publishConfig": {
6
6
  "access": "public"