@rex0220/kintone-sql-tools 3.42.0 → 3.43.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 +104 -23
- package/dist-engine/index.cjs +10 -10
- package/dist-engine/index.mjs +10 -10
- package/dist-engine/ksql-engine.umd.js +10 -10
- package/dist-engine/meta/bundle-baseline.json +10 -10
- package/dist-engine/meta/cjs.json +25 -7
- package/dist-engine/meta/esm.json +25 -7
- package/dist-engine/meta/umd.json +25 -7
- package/dist-mcp/ksql-mcp.js +108 -24
- package/dist-mcpb/ksql-mcp.mcpb +0 -0
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-08-
|
|
2
|
+
"generatedAt": "2026-08-04T03:29:40.409Z",
|
|
3
3
|
"baseline": "B66 Phase1 initial measured values; no arbitrary size ceiling",
|
|
4
4
|
"bundles": {
|
|
5
5
|
"index.cjs": {
|
|
6
|
-
"inputCount":
|
|
7
|
-
"minifiedBytes":
|
|
8
|
-
"gzipBytes":
|
|
6
|
+
"inputCount": 103,
|
|
7
|
+
"minifiedBytes": 558174,
|
|
8
|
+
"gzipBytes": 153028,
|
|
9
9
|
"forbidden": {
|
|
10
10
|
"mcp-instructions": [],
|
|
11
11
|
"src-mcp": [],
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"index.mjs": {
|
|
26
|
-
"inputCount":
|
|
27
|
-
"minifiedBytes":
|
|
28
|
-
"gzipBytes":
|
|
26
|
+
"inputCount": 103,
|
|
27
|
+
"minifiedBytes": 557629,
|
|
28
|
+
"gzipBytes": 152729,
|
|
29
29
|
"forbidden": {
|
|
30
30
|
"mcp-instructions": [],
|
|
31
31
|
"src-mcp": [],
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"ksql-engine.umd.js": {
|
|
46
|
-
"inputCount":
|
|
47
|
-
"minifiedBytes":
|
|
48
|
-
"gzipBytes":
|
|
46
|
+
"inputCount": 105,
|
|
47
|
+
"minifiedBytes": 558653,
|
|
48
|
+
"gzipBytes": 153102,
|
|
49
49
|
"forbidden": {
|
|
50
50
|
"mcp-instructions": [],
|
|
51
51
|
"src-mcp": [],
|
|
@@ -232,8 +232,13 @@
|
|
|
232
232
|
"imports": [],
|
|
233
233
|
"format": "esm"
|
|
234
234
|
},
|
|
235
|
+
"src/core/functionArity.ts": {
|
|
236
|
+
"bytes": 1916,
|
|
237
|
+
"imports": [],
|
|
238
|
+
"format": "esm"
|
|
239
|
+
},
|
|
235
240
|
"src/core/statementValidation.ts": {
|
|
236
|
-
"bytes":
|
|
241
|
+
"bytes": 1070,
|
|
237
242
|
"imports": [
|
|
238
243
|
{
|
|
239
244
|
"path": "src/core/klikeValidation.ts",
|
|
@@ -244,6 +249,11 @@
|
|
|
244
249
|
"path": "src/core/primaryOrganizationDmlValidation.ts",
|
|
245
250
|
"kind": "import-statement",
|
|
246
251
|
"original": "./primaryOrganizationDmlValidation"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"path": "src/core/functionArity.ts",
|
|
255
|
+
"kind": "import-statement",
|
|
256
|
+
"original": "./functionArity"
|
|
247
257
|
}
|
|
248
258
|
],
|
|
249
259
|
"format": "esm"
|
|
@@ -322,7 +332,7 @@
|
|
|
322
332
|
"format": "esm"
|
|
323
333
|
},
|
|
324
334
|
"src/parser/parser.ts": {
|
|
325
|
-
"bytes":
|
|
335
|
+
"bytes": 172277,
|
|
326
336
|
"imports": [
|
|
327
337
|
{
|
|
328
338
|
"path": "src/lexer/tokens.ts",
|
|
@@ -379,7 +389,7 @@
|
|
|
379
389
|
"format": "esm"
|
|
380
390
|
},
|
|
381
391
|
"src/engine/evalFunc.ts": {
|
|
382
|
-
"bytes":
|
|
392
|
+
"bytes": 28292,
|
|
383
393
|
"imports": [
|
|
384
394
|
{
|
|
385
395
|
"path": "src/types/ast.ts",
|
|
@@ -391,6 +401,11 @@
|
|
|
391
401
|
"kind": "import-statement",
|
|
392
402
|
"original": "../core/scalarCompare"
|
|
393
403
|
},
|
|
404
|
+
{
|
|
405
|
+
"path": "src/core/functionArity.ts",
|
|
406
|
+
"kind": "import-statement",
|
|
407
|
+
"original": "../core/functionArity"
|
|
408
|
+
},
|
|
394
409
|
{
|
|
395
410
|
"path": "src/engine/evalWhere.ts",
|
|
396
411
|
"kind": "import-statement",
|
|
@@ -1960,8 +1975,11 @@
|
|
|
1960
1975
|
"src/core/primaryOrganizationDmlValidation.ts": {
|
|
1961
1976
|
"bytesInOutput": 768
|
|
1962
1977
|
},
|
|
1978
|
+
"src/core/functionArity.ts": {
|
|
1979
|
+
"bytesInOutput": 1035
|
|
1980
|
+
},
|
|
1963
1981
|
"src/core/statementValidation.ts": {
|
|
1964
|
-
"bytesInOutput":
|
|
1982
|
+
"bytesInOutput": 233
|
|
1965
1983
|
},
|
|
1966
1984
|
"src/engine/groupingRowMeta.ts": {
|
|
1967
1985
|
"bytesInOutput": 559
|
|
@@ -1979,7 +1997,7 @@
|
|
|
1979
1997
|
"bytesInOutput": 5893
|
|
1980
1998
|
},
|
|
1981
1999
|
"src/parser/parser.ts": {
|
|
1982
|
-
"bytesInOutput":
|
|
2000
|
+
"bytesInOutput": 95677
|
|
1983
2001
|
},
|
|
1984
2002
|
"src/core/fieldSemantics.ts": {
|
|
1985
2003
|
"bytesInOutput": 1368
|
|
@@ -1988,7 +2006,7 @@
|
|
|
1988
2006
|
"bytesInOutput": 2804
|
|
1989
2007
|
},
|
|
1990
2008
|
"src/engine/evalFunc.ts": {
|
|
1991
|
-
"bytesInOutput":
|
|
2009
|
+
"bytesInOutput": 10962
|
|
1992
2010
|
},
|
|
1993
2011
|
"src/engine/evalWhere.ts": {
|
|
1994
2012
|
"bytesInOutput": 5788
|
|
@@ -2210,7 +2228,7 @@
|
|
|
2210
2228
|
"bytesInOutput": 1271
|
|
2211
2229
|
}
|
|
2212
2230
|
},
|
|
2213
|
-
"bytes":
|
|
2231
|
+
"bytes": 558174
|
|
2214
2232
|
}
|
|
2215
2233
|
}
|
|
2216
2234
|
}
|
|
@@ -232,8 +232,13 @@
|
|
|
232
232
|
"imports": [],
|
|
233
233
|
"format": "esm"
|
|
234
234
|
},
|
|
235
|
+
"src/core/functionArity.ts": {
|
|
236
|
+
"bytes": 1916,
|
|
237
|
+
"imports": [],
|
|
238
|
+
"format": "esm"
|
|
239
|
+
},
|
|
235
240
|
"src/core/statementValidation.ts": {
|
|
236
|
-
"bytes":
|
|
241
|
+
"bytes": 1070,
|
|
237
242
|
"imports": [
|
|
238
243
|
{
|
|
239
244
|
"path": "src/core/klikeValidation.ts",
|
|
@@ -244,6 +249,11 @@
|
|
|
244
249
|
"path": "src/core/primaryOrganizationDmlValidation.ts",
|
|
245
250
|
"kind": "import-statement",
|
|
246
251
|
"original": "./primaryOrganizationDmlValidation"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"path": "src/core/functionArity.ts",
|
|
255
|
+
"kind": "import-statement",
|
|
256
|
+
"original": "./functionArity"
|
|
247
257
|
}
|
|
248
258
|
],
|
|
249
259
|
"format": "esm"
|
|
@@ -322,7 +332,7 @@
|
|
|
322
332
|
"format": "esm"
|
|
323
333
|
},
|
|
324
334
|
"src/parser/parser.ts": {
|
|
325
|
-
"bytes":
|
|
335
|
+
"bytes": 172277,
|
|
326
336
|
"imports": [
|
|
327
337
|
{
|
|
328
338
|
"path": "src/lexer/tokens.ts",
|
|
@@ -379,7 +389,7 @@
|
|
|
379
389
|
"format": "esm"
|
|
380
390
|
},
|
|
381
391
|
"src/engine/evalFunc.ts": {
|
|
382
|
-
"bytes":
|
|
392
|
+
"bytes": 28292,
|
|
383
393
|
"imports": [
|
|
384
394
|
{
|
|
385
395
|
"path": "src/types/ast.ts",
|
|
@@ -391,6 +401,11 @@
|
|
|
391
401
|
"kind": "import-statement",
|
|
392
402
|
"original": "../core/scalarCompare"
|
|
393
403
|
},
|
|
404
|
+
{
|
|
405
|
+
"path": "src/core/functionArity.ts",
|
|
406
|
+
"kind": "import-statement",
|
|
407
|
+
"original": "../core/functionArity"
|
|
408
|
+
},
|
|
394
409
|
{
|
|
395
410
|
"path": "src/engine/evalWhere.ts",
|
|
396
411
|
"kind": "import-statement",
|
|
@@ -1964,8 +1979,11 @@
|
|
|
1964
1979
|
"src/core/primaryOrganizationDmlValidation.ts": {
|
|
1965
1980
|
"bytesInOutput": 768
|
|
1966
1981
|
},
|
|
1982
|
+
"src/core/functionArity.ts": {
|
|
1983
|
+
"bytesInOutput": 1035
|
|
1984
|
+
},
|
|
1967
1985
|
"src/core/statementValidation.ts": {
|
|
1968
|
-
"bytesInOutput":
|
|
1986
|
+
"bytesInOutput": 233
|
|
1969
1987
|
},
|
|
1970
1988
|
"src/engine/groupingRowMeta.ts": {
|
|
1971
1989
|
"bytesInOutput": 559
|
|
@@ -1983,7 +2001,7 @@
|
|
|
1983
2001
|
"bytesInOutput": 5893
|
|
1984
2002
|
},
|
|
1985
2003
|
"src/parser/parser.ts": {
|
|
1986
|
-
"bytesInOutput":
|
|
2004
|
+
"bytesInOutput": 95677
|
|
1987
2005
|
},
|
|
1988
2006
|
"src/core/fieldSemantics.ts": {
|
|
1989
2007
|
"bytesInOutput": 1368
|
|
@@ -1992,7 +2010,7 @@
|
|
|
1992
2010
|
"bytesInOutput": 2804
|
|
1993
2011
|
},
|
|
1994
2012
|
"src/engine/evalFunc.ts": {
|
|
1995
|
-
"bytesInOutput":
|
|
2013
|
+
"bytesInOutput": 10962
|
|
1996
2014
|
},
|
|
1997
2015
|
"src/engine/evalWhere.ts": {
|
|
1998
2016
|
"bytesInOutput": 5788
|
|
@@ -2217,7 +2235,7 @@
|
|
|
2217
2235
|
"bytesInOutput": 16
|
|
2218
2236
|
}
|
|
2219
2237
|
},
|
|
2220
|
-
"bytes":
|
|
2238
|
+
"bytes": 557629
|
|
2221
2239
|
}
|
|
2222
2240
|
}
|
|
2223
2241
|
}
|
|
@@ -232,8 +232,13 @@
|
|
|
232
232
|
"imports": [],
|
|
233
233
|
"format": "esm"
|
|
234
234
|
},
|
|
235
|
+
"src/core/functionArity.ts": {
|
|
236
|
+
"bytes": 1916,
|
|
237
|
+
"imports": [],
|
|
238
|
+
"format": "esm"
|
|
239
|
+
},
|
|
235
240
|
"src/core/statementValidation.ts": {
|
|
236
|
-
"bytes":
|
|
241
|
+
"bytes": 1070,
|
|
237
242
|
"imports": [
|
|
238
243
|
{
|
|
239
244
|
"path": "src/core/klikeValidation.ts",
|
|
@@ -244,6 +249,11 @@
|
|
|
244
249
|
"path": "src/core/primaryOrganizationDmlValidation.ts",
|
|
245
250
|
"kind": "import-statement",
|
|
246
251
|
"original": "./primaryOrganizationDmlValidation"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"path": "src/core/functionArity.ts",
|
|
255
|
+
"kind": "import-statement",
|
|
256
|
+
"original": "./functionArity"
|
|
247
257
|
}
|
|
248
258
|
],
|
|
249
259
|
"format": "esm"
|
|
@@ -322,7 +332,7 @@
|
|
|
322
332
|
"format": "esm"
|
|
323
333
|
},
|
|
324
334
|
"src/parser/parser.ts": {
|
|
325
|
-
"bytes":
|
|
335
|
+
"bytes": 172277,
|
|
326
336
|
"imports": [
|
|
327
337
|
{
|
|
328
338
|
"path": "src/lexer/tokens.ts",
|
|
@@ -379,7 +389,7 @@
|
|
|
379
389
|
"format": "esm"
|
|
380
390
|
},
|
|
381
391
|
"src/engine/evalFunc.ts": {
|
|
382
|
-
"bytes":
|
|
392
|
+
"bytes": 28292,
|
|
383
393
|
"imports": [
|
|
384
394
|
{
|
|
385
395
|
"path": "src/types/ast.ts",
|
|
@@ -391,6 +401,11 @@
|
|
|
391
401
|
"kind": "import-statement",
|
|
392
402
|
"original": "../core/scalarCompare"
|
|
393
403
|
},
|
|
404
|
+
{
|
|
405
|
+
"path": "src/core/functionArity.ts",
|
|
406
|
+
"kind": "import-statement",
|
|
407
|
+
"original": "../core/functionArity"
|
|
408
|
+
},
|
|
394
409
|
{
|
|
395
410
|
"path": "src/engine/evalWhere.ts",
|
|
396
411
|
"kind": "import-statement",
|
|
@@ -1978,8 +1993,11 @@
|
|
|
1978
1993
|
"src/core/primaryOrganizationDmlValidation.ts": {
|
|
1979
1994
|
"bytesInOutput": 768
|
|
1980
1995
|
},
|
|
1996
|
+
"src/core/functionArity.ts": {
|
|
1997
|
+
"bytesInOutput": 1035
|
|
1998
|
+
},
|
|
1981
1999
|
"src/core/statementValidation.ts": {
|
|
1982
|
-
"bytesInOutput":
|
|
2000
|
+
"bytesInOutput": 233
|
|
1983
2001
|
},
|
|
1984
2002
|
"src/engine/groupingRowMeta.ts": {
|
|
1985
2003
|
"bytesInOutput": 559
|
|
@@ -1997,7 +2015,7 @@
|
|
|
1997
2015
|
"bytesInOutput": 5893
|
|
1998
2016
|
},
|
|
1999
2017
|
"src/parser/parser.ts": {
|
|
2000
|
-
"bytesInOutput":
|
|
2018
|
+
"bytesInOutput": 95677
|
|
2001
2019
|
},
|
|
2002
2020
|
"src/core/fieldSemantics.ts": {
|
|
2003
2021
|
"bytesInOutput": 1368
|
|
@@ -2006,7 +2024,7 @@
|
|
|
2006
2024
|
"bytesInOutput": 2804
|
|
2007
2025
|
},
|
|
2008
2026
|
"src/engine/evalFunc.ts": {
|
|
2009
|
-
"bytesInOutput":
|
|
2027
|
+
"bytesInOutput": 10962
|
|
2010
2028
|
},
|
|
2011
2029
|
"src/engine/evalWhere.ts": {
|
|
2012
2030
|
"bytesInOutput": 5788
|
|
@@ -2237,7 +2255,7 @@
|
|
|
2237
2255
|
"bytesInOutput": 127
|
|
2238
2256
|
}
|
|
2239
2257
|
},
|
|
2240
|
-
"bytes":
|
|
2258
|
+
"bytes": 558653
|
|
2241
2259
|
}
|
|
2242
2260
|
}
|
|
2243
2261
|
}
|
package/dist-mcp/ksql-mcp.js
CHANGED
|
@@ -30911,8 +30911,9 @@ function needsSpaceBetween(prev, cur) {
|
|
|
30911
30911
|
return true;
|
|
30912
30912
|
}
|
|
30913
30913
|
var ParseError = class extends Error {
|
|
30914
|
-
constructor(
|
|
30915
|
-
super(`${
|
|
30914
|
+
constructor(rawMessage, token) {
|
|
30915
|
+
super(`${rawMessage}\uFF08\u4F4D\u7F6E ${token.pos}\u3001\u30C8\u30FC\u30AF\u30F3: \u300C${token.value}\u300D\uFF09`);
|
|
30916
|
+
this.rawMessage = rawMessage;
|
|
30916
30917
|
this.token = token;
|
|
30917
30918
|
this.name = "ParseError";
|
|
30918
30919
|
}
|
|
@@ -32298,16 +32299,33 @@ var Parser = class {
|
|
|
32298
32299
|
const byKind = PARSER_SCALAR_FUNCTION_TOKEN_MAP[this.peek().kind] ?? null;
|
|
32299
32300
|
if (byKind !== null && byKind !== "LEFT" && byKind !== "RIGHT") return byKind;
|
|
32300
32301
|
if (this.peek().kind === "IDENT" /* IDENT */) {
|
|
32301
|
-
const
|
|
32302
|
+
const nameToken = this.peek();
|
|
32303
|
+
const name = nameToken.value.toUpperCase();
|
|
32302
32304
|
if (PARSER_IDENT_SCALAR_FUNCTIONS.includes(name)) {
|
|
32303
32305
|
if (this.peekAt(1).kind === "(" /* LPAREN */) {
|
|
32304
32306
|
return name;
|
|
32305
32307
|
}
|
|
32306
32308
|
}
|
|
32309
|
+
if (this.peekAt(1).kind === "(" /* LPAREN */) {
|
|
32310
|
+
const hint = name === "DATE_SUB" ? "\u3002\u65E5\u4ED8\u3092\u6E1B\u7B97\u3059\u308B\u306B\u306F DATE_ADD \u306E\u52A0\u7B97\u5024\u3078\u8CA0\u6570\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044" : "";
|
|
32311
|
+
throw new ParseError(`\u300C${nameToken.value}\u300D\u3068\u3044\u3046\u95A2\u6570\u306F\u3042\u308A\u307E\u305B\u3093${hint}`, nameToken);
|
|
32312
|
+
}
|
|
32307
32313
|
}
|
|
32308
32314
|
return null;
|
|
32309
32315
|
}
|
|
32310
32316
|
parseStringFuncExpr() {
|
|
32317
|
+
const nameToken = this.peek();
|
|
32318
|
+
const func = this.tryStringFuncName();
|
|
32319
|
+
try {
|
|
32320
|
+
return this.parseStringFuncExprBody();
|
|
32321
|
+
} catch (error51) {
|
|
32322
|
+
if (!(error51 instanceof ParseError)) throw error51;
|
|
32323
|
+
const displayName = nameToken.value.toUpperCase();
|
|
32324
|
+
const guidance = func === "DATE_ADD" ? `${displayName} \u306E\u69CB\u6587\u306F DATE_ADD(\u5217, n, '\u5358\u4F4D') \u3067\u3059\u3002` : `${displayName} \u306E\u5F15\u6570\u69CB\u6587\u304C\u4E0D\u6B63\u3067\u3059\u3002`;
|
|
32325
|
+
throw new ParseError(`${guidance}${error51.rawMessage}`, error51.token);
|
|
32326
|
+
}
|
|
32327
|
+
}
|
|
32328
|
+
parseStringFuncExprBody() {
|
|
32311
32329
|
const tokenKind = this.peek().kind;
|
|
32312
32330
|
const func = this.tryStringFuncName();
|
|
32313
32331
|
this.advance();
|
|
@@ -36423,10 +36441,95 @@ function walkObjects2(node, visit) {
|
|
|
36423
36441
|
|
|
36424
36442
|
// src/core/statementValidation.ts
|
|
36425
36443
|
init_define_KSQL_DOCS();
|
|
36444
|
+
|
|
36445
|
+
// src/core/functionArity.ts
|
|
36446
|
+
init_define_KSQL_DOCS();
|
|
36447
|
+
function assertArity(func, args, min, max = Number.POSITIVE_INFINITY) {
|
|
36448
|
+
if (args.length >= min && args.length <= max) return;
|
|
36449
|
+
const expected = min === max ? String(min) : max === Number.POSITIVE_INFINITY ? `${min} or more` : `${min} to ${max}`;
|
|
36450
|
+
throw new Error(`ArgumentError: ${func} expects ${expected} argument(s).`);
|
|
36451
|
+
}
|
|
36452
|
+
function assertStringFunctionArity(func, args) {
|
|
36453
|
+
switch (func) {
|
|
36454
|
+
case "UPPER":
|
|
36455
|
+
case "LOWER":
|
|
36456
|
+
case "TRIM":
|
|
36457
|
+
case "LTRIM":
|
|
36458
|
+
case "RTRIM":
|
|
36459
|
+
case "LENGTH":
|
|
36460
|
+
case "LENGTH_CHAR":
|
|
36461
|
+
case "YEAR":
|
|
36462
|
+
case "MONTH":
|
|
36463
|
+
case "DAY":
|
|
36464
|
+
case "DAYOFWEEK":
|
|
36465
|
+
case "QUARTER":
|
|
36466
|
+
case "WEEK":
|
|
36467
|
+
case "LAST_DAY":
|
|
36468
|
+
case "ABS":
|
|
36469
|
+
case "SQRT":
|
|
36470
|
+
return assertArity(func, args, 1, 1);
|
|
36471
|
+
case "SUBSTRING":
|
|
36472
|
+
case "LPAD":
|
|
36473
|
+
case "RPAD":
|
|
36474
|
+
case "REGEXP_LIKE":
|
|
36475
|
+
case "REGEXP_SUBSTR":
|
|
36476
|
+
return assertArity(func, args, 2, 3);
|
|
36477
|
+
case "LEFT":
|
|
36478
|
+
case "RIGHT":
|
|
36479
|
+
case "INSTR":
|
|
36480
|
+
case "ISNULL":
|
|
36481
|
+
case "NULLIF":
|
|
36482
|
+
case "MOD":
|
|
36483
|
+
case "POWER":
|
|
36484
|
+
case "FORMAT":
|
|
36485
|
+
case "CAST":
|
|
36486
|
+
case "DATE_FORMAT":
|
|
36487
|
+
case "DATEDIFF":
|
|
36488
|
+
return assertArity(func, args, 2, 2);
|
|
36489
|
+
case "CONCAT":
|
|
36490
|
+
case "COALESCE":
|
|
36491
|
+
case "GREATEST":
|
|
36492
|
+
case "LEAST":
|
|
36493
|
+
return assertArity(func, args, 2);
|
|
36494
|
+
case "REPLACE":
|
|
36495
|
+
case "TRANSLATE":
|
|
36496
|
+
case "DATE_ADD":
|
|
36497
|
+
return assertArity(func, args, 3, 3);
|
|
36498
|
+
case "REGEXP_REPLACE":
|
|
36499
|
+
return assertArity(func, args, 3, 5);
|
|
36500
|
+
case "ROUND":
|
|
36501
|
+
case "FLOOR":
|
|
36502
|
+
case "CEIL":
|
|
36503
|
+
case "TRUNCATE":
|
|
36504
|
+
return assertArity(func, args, 1, 2);
|
|
36505
|
+
case "CURRENT_DATE":
|
|
36506
|
+
case "CURRENT_TIMESTAMP":
|
|
36507
|
+
return assertArity(func, args, 0, 0);
|
|
36508
|
+
}
|
|
36509
|
+
}
|
|
36510
|
+
|
|
36511
|
+
// src/core/statementValidation.ts
|
|
36426
36512
|
function validateStatementStatic(stmt) {
|
|
36513
|
+
validateStringFunctionArities(stmt);
|
|
36427
36514
|
validatePrimaryOrganizationDmlStatement(stmt);
|
|
36428
36515
|
validateKlikeStatement(stmt);
|
|
36429
36516
|
}
|
|
36517
|
+
function validateStringFunctionArities(stmt) {
|
|
36518
|
+
const visit = (value) => {
|
|
36519
|
+
if (value === null || typeof value !== "object") return;
|
|
36520
|
+
if (Array.isArray(value)) {
|
|
36521
|
+
value.forEach(visit);
|
|
36522
|
+
return;
|
|
36523
|
+
}
|
|
36524
|
+
const node = value;
|
|
36525
|
+
if (node.type === "STRING_FUNC") {
|
|
36526
|
+
const expr = node;
|
|
36527
|
+
assertStringFunctionArity(expr.func, expr.args);
|
|
36528
|
+
}
|
|
36529
|
+
Object.values(node).forEach(visit);
|
|
36530
|
+
};
|
|
36531
|
+
visit(stmt);
|
|
36532
|
+
}
|
|
36430
36533
|
|
|
36431
36534
|
// src/core/groupingValidation.ts
|
|
36432
36535
|
init_define_KSQL_DOCS();
|
|
@@ -37474,6 +37577,7 @@ function replaceNthMatch(input, globalRe, replacement, n) {
|
|
|
37474
37577
|
});
|
|
37475
37578
|
}
|
|
37476
37579
|
function evalStringFunc(expr, row, resolveFieldType, resolveFieldSemantics2) {
|
|
37580
|
+
assertStringFunctionArity(expr.func, expr.args);
|
|
37477
37581
|
const args = expr.args.map((a) => evalStringFuncArg(a, row, resolveFieldType, resolveFieldSemantics2));
|
|
37478
37582
|
switch (expr.func) {
|
|
37479
37583
|
case "UPPER":
|
|
@@ -37489,7 +37593,6 @@ function evalStringFunc(expr, row, resolveFieldType, resolveFieldSemantics2) {
|
|
|
37489
37593
|
case "LENGTH":
|
|
37490
37594
|
return String((args[0] ?? "").length);
|
|
37491
37595
|
case "LENGTH_CHAR":
|
|
37492
|
-
assertArity("LENGTH_CHAR", args, 1, 1);
|
|
37493
37596
|
return String([...args[0] ?? ""].length);
|
|
37494
37597
|
case "SUBSTRING": {
|
|
37495
37598
|
const str = args[0] ?? "";
|
|
@@ -37498,23 +37601,19 @@ function evalStringFunc(expr, row, resolveFieldType, resolveFieldSemantics2) {
|
|
|
37498
37601
|
return sliceSafeRange(str, start, len !== void 0 ? start + len : str.length);
|
|
37499
37602
|
}
|
|
37500
37603
|
case "LEFT": {
|
|
37501
|
-
assertArity("LEFT", args, 2, 2);
|
|
37502
37604
|
const str = args[0];
|
|
37503
37605
|
const n = Math.trunc(Number(args[1]));
|
|
37504
37606
|
return Number.isNaN(n) || n <= 0 ? "" : sliceSafePrefix(str, n);
|
|
37505
37607
|
}
|
|
37506
37608
|
case "RIGHT": {
|
|
37507
|
-
assertArity("RIGHT", args, 2, 2);
|
|
37508
37609
|
const str = args[0];
|
|
37509
37610
|
const n = Math.trunc(Number(args[1]));
|
|
37510
37611
|
return Number.isNaN(n) || n <= 0 ? "" : sliceSafeSuffix(str, n);
|
|
37511
37612
|
}
|
|
37512
37613
|
case "INSTR":
|
|
37513
|
-
assertArity("INSTR", args, 2, 2);
|
|
37514
37614
|
return String(args[0].indexOf(args[1]) + 1);
|
|
37515
37615
|
case "LPAD":
|
|
37516
37616
|
case "RPAD": {
|
|
37517
|
-
assertArity(expr.func, args, 2, 3);
|
|
37518
37617
|
const str = args[0];
|
|
37519
37618
|
const n = Math.trunc(Number(args[1]));
|
|
37520
37619
|
if (Number.isNaN(n) || n <= 0) return "";
|
|
@@ -37526,7 +37625,6 @@ function evalStringFunc(expr, row, resolveFieldType, resolveFieldSemantics2) {
|
|
|
37526
37625
|
}
|
|
37527
37626
|
case "GREATEST":
|
|
37528
37627
|
case "LEAST":
|
|
37529
|
-
assertArity(expr.func, args, 2);
|
|
37530
37628
|
return selectScalarExtreme(args, expr.func === "GREATEST" ? "greatest" : "least");
|
|
37531
37629
|
case "CONCAT":
|
|
37532
37630
|
return args.join("");
|
|
@@ -37537,22 +37635,18 @@ function evalStringFunc(expr, row, resolveFieldType, resolveFieldSemantics2) {
|
|
|
37537
37635
|
return from === "" ? str : str.split(from).join(to);
|
|
37538
37636
|
}
|
|
37539
37637
|
case "REGEXP_LIKE": {
|
|
37540
|
-
assertArity("REGEXP_LIKE", args, 2, 3);
|
|
37541
37638
|
return compileRegexp(args[1], args[2] ?? "").test(args[0]) ? "1" : "0";
|
|
37542
37639
|
}
|
|
37543
37640
|
case "REGEXP_REPLACE": {
|
|
37544
|
-
assertArity("REGEXP_REPLACE", args, 3, 5);
|
|
37545
37641
|
assertRegexpReplacement(args[2]);
|
|
37546
37642
|
const occurrence = parseRegexpOccurrence(args[4]);
|
|
37547
37643
|
const regexp = compileRegexp(args[1], args[3] ?? "", true);
|
|
37548
37644
|
return occurrence === 0 ? args[0].replace(regexp, args[2]) : replaceNthMatch(args[0], regexp, args[2], occurrence);
|
|
37549
37645
|
}
|
|
37550
37646
|
case "REGEXP_SUBSTR": {
|
|
37551
|
-
assertArity("REGEXP_SUBSTR", args, 2, 3);
|
|
37552
37647
|
return compileRegexp(args[1], args[2] ?? "").exec(args[0])?.[0] ?? "";
|
|
37553
37648
|
}
|
|
37554
37649
|
case "TRANSLATE": {
|
|
37555
|
-
assertArity("TRANSLATE", args, 3, 3);
|
|
37556
37650
|
const from = [...args[1]];
|
|
37557
37651
|
const to = [...args[2]];
|
|
37558
37652
|
if (from.length !== to.length) {
|
|
@@ -37579,7 +37673,6 @@ function evalStringFunc(expr, row, resolveFieldType, resolveFieldSemantics2) {
|
|
|
37579
37673
|
case "CEIL":
|
|
37580
37674
|
return applyRoundOp("ceil", Number(args[0] ?? "0"), Number(args[1] ?? "0"));
|
|
37581
37675
|
case "TRUNCATE":
|
|
37582
|
-
assertArity("TRUNCATE", args, 1, 2);
|
|
37583
37676
|
return applyRoundOp("trunc", Number(args[0]), Number(args[1] ?? "0"));
|
|
37584
37677
|
case "CAST": {
|
|
37585
37678
|
const val = args[0] ?? "";
|
|
@@ -37608,13 +37701,10 @@ function evalStringFunc(expr, row, resolveFieldType, resolveFieldSemantics2) {
|
|
|
37608
37701
|
return d.length >= 10 ? String(parseInt(d.slice(8, 10), 10)) : "";
|
|
37609
37702
|
}
|
|
37610
37703
|
case "DAYOFWEEK":
|
|
37611
|
-
assertArity(expr.func, args, 1, 1);
|
|
37612
37704
|
return isValidYmd(args[0]) ? String(dayOfWeekIndex(args[0]) + 1) : "";
|
|
37613
37705
|
case "QUARTER":
|
|
37614
|
-
assertArity(expr.func, args, 1, 1);
|
|
37615
37706
|
return isValidYmd(args[0]) ? String(Math.ceil(Number(args[0].slice(5, 7)) / 3)) : "";
|
|
37616
37707
|
case "WEEK":
|
|
37617
|
-
assertArity(expr.func, args, 1, 1);
|
|
37618
37708
|
return isValidYmd(args[0]) ? String(isoWeekNumber(args[0])) : "";
|
|
37619
37709
|
case "DATE_FORMAT":
|
|
37620
37710
|
return applyDateFormat(args[0] ?? "", args[1] ?? "");
|
|
@@ -37623,7 +37713,6 @@ function evalStringFunc(expr, row, resolveFieldType, resolveFieldSemantics2) {
|
|
|
37623
37713
|
case "DATE_ADD":
|
|
37624
37714
|
return applyDateAdd(args[0] ?? "", Number(args[1] ?? "0"), (args[2] ?? "DAY").toUpperCase());
|
|
37625
37715
|
case "LAST_DAY":
|
|
37626
|
-
assertArity("LAST_DAY", args, 1, 1);
|
|
37627
37716
|
return applyLastDay(args[0]);
|
|
37628
37717
|
case "ABS":
|
|
37629
37718
|
return String(Math.abs(Number(args[0] ?? "0")));
|
|
@@ -37647,11 +37736,6 @@ function evalStringFunc(expr, row, resolveFieldType, resolveFieldSemantics2) {
|
|
|
37647
37736
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
37648
37737
|
}
|
|
37649
37738
|
}
|
|
37650
|
-
function assertArity(func, args, min, max = Number.POSITIVE_INFINITY) {
|
|
37651
|
-
if (args.length >= min && args.length <= max) return;
|
|
37652
|
-
const expected = min === max ? String(min) : max === Number.POSITIVE_INFINITY ? `${min} or more` : `${min} to ${max}`;
|
|
37653
|
-
throw new Error(`ArgumentError: ${func} expects ${expected} argument(s).`);
|
|
37654
|
-
}
|
|
37655
37739
|
function parseDateParts(s) {
|
|
37656
37740
|
return {
|
|
37657
37741
|
y: s.slice(0, 4) || "0000",
|
|
@@ -57424,7 +57508,7 @@ Nested JSON/CSV subtable mutation is fail-closed on MCP: use VALIDATE ONLY/EXPLA
|
|
|
57424
57508
|
JSON child IDs are rejected and replacement renumbers all rows.
|
|
57425
57509
|
`);
|
|
57426
57510
|
}
|
|
57427
|
-
var SERVER_VERSION = true ? "3.
|
|
57511
|
+
var SERVER_VERSION = true ? "3.43.0" : "0.0.0-dev";
|
|
57428
57512
|
var FUNCTION_CATALOG_PARAGRAPH = `Complete function catalog \u2014 Scalar: ${KSQL_FUNCTION_CATALOG.scalar.join(" ")}. Aggregate: ${KSQL_FUNCTION_CATALOG.aggregate.join(" ")}. Variance and standard-deviation aggregates use explicit POP/SAMP names; unqualified STDDEV and VARIANCE are unsupported. Window: ${KSQL_FUNCTION_CATALOG.window.join(" ")} (OVER and AS alias required). Contextual: ${KSQL_FUNCTION_CATALOG.contextual.join(" ")} (kintone predicates; WHERE server-only/fail-closed; INNER JOIN direct-APP exact pushdown supported; local LOGINUSER is empty on all surfaces). Aliases: ${KSQL_FUNCTION_CATALOG.aliases.join(" ")}. Syntax: ${KSQL_FUNCTION_CATALOG.syntax.join(" ")}. This list is complete; functions from other dialects such as IFNULL do not exist. Use ksql_docs for arguments and constraints.`;
|
|
57429
57513
|
var KSQL_MCP_INSTRUCTIONS = `kSQL MCP server version ${SERVER_VERSION}.
|
|
57430
57514
|
|
package/dist-mcpb/ksql-mcp.mcpb
CHANGED
|
Binary file
|