@rex0220/kintone-sql-tools 2.1.1 → 2.1.2

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
@@ -1033,14 +1033,20 @@ var Parser = class {
1033
1033
  }
1034
1034
  const aggFunc = this.tryAggregateFunc();
1035
1035
  if (aggFunc !== null) {
1036
- const aggCol = this.parseAggregateColumn(aggFunc);
1036
+ const ref = this.parseAggregateRef(aggFunc);
1037
1037
  if (this.isArithOp(this.peek().kind)) {
1038
- const left = { type: "AGG_REF", func: aggCol.func, distinct: aggCol.distinct, arg: aggCol.arg };
1039
- const expr = this.continueAggArith(left);
1040
- const alias2 = this.consume("AS" /* AS */) ? this.parseAliasName() : null;
1041
- return { type: "ARITH_AGG_COL", expr, alias: alias2 };
1038
+ const expr = this.continueAggArith(ref);
1039
+ const alias3 = this.consume("AS" /* AS */) ? this.parseAliasName() : null;
1040
+ return { type: "ARITH_AGG_COL", expr, alias: alias3 };
1042
1041
  }
1043
- return aggCol;
1042
+ const alias2 = this.consume("AS" /* AS */) ? this.parseAliasName() : null;
1043
+ return {
1044
+ type: "AGGREGATE",
1045
+ func: ref.func,
1046
+ distinct: ref.distinct,
1047
+ arg: ref.arg,
1048
+ alias: alias2
1049
+ };
1044
1050
  }
1045
1051
  if (this.peek().kind === "(" /* LPAREN */ && this.peekAt(1).kind === "SELECT" /* SELECT */) {
1046
1052
  this.advance();
@@ -1124,8 +1130,7 @@ var Parser = class {
1124
1130
  }
1125
1131
  const aggFunc = this.tryAggregateFunc();
1126
1132
  if (aggFunc !== null) {
1127
- const aggCol = this.parseAggregateColumn(aggFunc);
1128
- return { type: "AGG_REF", func: aggCol.func, distinct: aggCol.distinct, arg: aggCol.arg };
1133
+ return this.parseAggregateRef(aggFunc);
1129
1134
  }
1130
1135
  throw new ParseError("\u96C6\u8A08\u7B97\u8853\u5F0F\u306B\u306F\u96C6\u8A08\u95A2\u6570\u307E\u305F\u306F\u6570\u5024\u304C\u5FC5\u8981\u3067\u3059", this.peek());
1131
1136
  }
@@ -1416,7 +1421,8 @@ var Parser = class {
1416
1421
  const kind = this.peek().kind;
1417
1422
  return map[kind] ?? null;
1418
1423
  }
1419
- parseAggregateColumn(func) {
1424
+ /** 集計関数参照を読む。SELECT 列の alias は呼び出し側で式全体の後に処理する。 */
1425
+ parseAggregateRef(func) {
1420
1426
  this.advance();
1421
1427
  this.expect("(" /* LPAREN */);
1422
1428
  const distinct = this.consume("DISTINCT" /* DISTINCT */);
@@ -1427,8 +1433,7 @@ var Parser = class {
1427
1433
  arg = this.parseArithAddSub();
1428
1434
  }
1429
1435
  this.expect(")" /* RPAREN */);
1430
- const alias = this.consume("AS" /* AS */) ? this.parseAliasName() : null;
1431
- return { type: "AGGREGATE", func, distinct, arg, alias };
1436
+ return { type: "AGG_REF", func, distinct, arg };
1432
1437
  }
1433
1438
  // ----------------------------------------------------------
1434
1439
  // FROM / JOIN
@@ -31946,14 +31946,20 @@ var Parser = class {
31946
31946
  }
31947
31947
  const aggFunc = this.tryAggregateFunc();
31948
31948
  if (aggFunc !== null) {
31949
- const aggCol = this.parseAggregateColumn(aggFunc);
31949
+ const ref = this.parseAggregateRef(aggFunc);
31950
31950
  if (this.isArithOp(this.peek().kind)) {
31951
- const left = { type: "AGG_REF", func: aggCol.func, distinct: aggCol.distinct, arg: aggCol.arg };
31952
- const expr = this.continueAggArith(left);
31953
- const alias2 = this.consume("AS" /* AS */) ? this.parseAliasName() : null;
31954
- return { type: "ARITH_AGG_COL", expr, alias: alias2 };
31951
+ const expr = this.continueAggArith(ref);
31952
+ const alias3 = this.consume("AS" /* AS */) ? this.parseAliasName() : null;
31953
+ return { type: "ARITH_AGG_COL", expr, alias: alias3 };
31955
31954
  }
31956
- return aggCol;
31955
+ const alias2 = this.consume("AS" /* AS */) ? this.parseAliasName() : null;
31956
+ return {
31957
+ type: "AGGREGATE",
31958
+ func: ref.func,
31959
+ distinct: ref.distinct,
31960
+ arg: ref.arg,
31961
+ alias: alias2
31962
+ };
31957
31963
  }
31958
31964
  if (this.peek().kind === "(" /* LPAREN */ && this.peekAt(1).kind === "SELECT" /* SELECT */) {
31959
31965
  this.advance();
@@ -32037,8 +32043,7 @@ var Parser = class {
32037
32043
  }
32038
32044
  const aggFunc = this.tryAggregateFunc();
32039
32045
  if (aggFunc !== null) {
32040
- const aggCol = this.parseAggregateColumn(aggFunc);
32041
- return { type: "AGG_REF", func: aggCol.func, distinct: aggCol.distinct, arg: aggCol.arg };
32046
+ return this.parseAggregateRef(aggFunc);
32042
32047
  }
32043
32048
  throw new ParseError("\u96C6\u8A08\u7B97\u8853\u5F0F\u306B\u306F\u96C6\u8A08\u95A2\u6570\u307E\u305F\u306F\u6570\u5024\u304C\u5FC5\u8981\u3067\u3059", this.peek());
32044
32049
  }
@@ -32329,7 +32334,8 @@ var Parser = class {
32329
32334
  const kind = this.peek().kind;
32330
32335
  return map2[kind] ?? null;
32331
32336
  }
32332
- parseAggregateColumn(func) {
32337
+ /** 集計関数参照を読む。SELECT 列の alias は呼び出し側で式全体の後に処理する。 */
32338
+ parseAggregateRef(func) {
32333
32339
  this.advance();
32334
32340
  this.expect("(" /* LPAREN */);
32335
32341
  const distinct = this.consume("DISTINCT" /* DISTINCT */);
@@ -32340,8 +32346,7 @@ var Parser = class {
32340
32346
  arg = this.parseArithAddSub();
32341
32347
  }
32342
32348
  this.expect(")" /* RPAREN */);
32343
- const alias = this.consume("AS" /* AS */) ? this.parseAliasName() : null;
32344
- return { type: "AGGREGATE", func, distinct, arg, alias };
32349
+ return { type: "AGG_REF", func, distinct, arg };
32345
32350
  }
32346
32351
  // ----------------------------------------------------------
32347
32352
  // FROM / JOIN
@@ -39977,7 +39982,7 @@ Options:
39977
39982
  -h, --help Show help
39978
39983
  `);
39979
39984
  }
39980
- var SERVER_VERSION = true ? "2.1.1" : "0.0.0-dev";
39985
+ var SERVER_VERSION = true ? "2.1.2" : "0.0.0-dev";
39981
39986
  function createServer(args) {
39982
39987
  const server = new McpServer({
39983
39988
  name: "ksql-mcp",
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rex0220/kintone-sql-tools",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "kintone SQL plugin, CLI, and MCP tools (ksql)",
5
5
  "publishConfig": {
6
6
  "access": "public"