@rex0220/kintone-sql-tools 3.48.0 → 3.50.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 +42 -5
- package/dist-engine/index.cjs +11 -9
- package/dist-engine/index.mjs +11 -9
- package/dist-engine/ksql-engine.umd.js +11 -9
- package/dist-engine/meta/bundle-baseline.json +7 -7
- package/dist-engine/meta/cjs.json +7 -7
- package/dist-engine/meta/esm.json +7 -7
- package/dist-engine/meta/umd.json +7 -7
- package/dist-engine/publicTypes.d.ts +8 -0
- package/dist-mcp/ksql-mcp.js +51 -10
- package/dist-mcpb/ksql-mcp.mcpb +0 -0
- package/package.json +1 -1
package/dist-cli/ksql.js
CHANGED
|
@@ -1053,6 +1053,12 @@ var ParseError = class extends Error {
|
|
|
1053
1053
|
this.name = "ParseError";
|
|
1054
1054
|
}
|
|
1055
1055
|
};
|
|
1056
|
+
var WINDOW_RESULT_IN_EXPRESSION_MESSAGE = [
|
|
1057
|
+
"\u30A6\u30A3\u30F3\u30C9\u30A6\u95A2\u6570\u306E\u7D50\u679C\u306F\u540C\u3058 SELECT \u306E\u5F0F\u3067\u306F\u4F7F\u3048\u307E\u305B\u3093\u3002",
|
|
1058
|
+
" \xD7 SELECT ROUND(SUM(x) OVER (), 1) AS a FROM t",
|
|
1059
|
+
" \u25CB WITH w AS (SELECT SUM(x) OVER () AS \u7DCF\u8A08 FROM t) SELECT ROUND(\u7DCF\u8A08, 1) AS a FROM w",
|
|
1060
|
+
"\u30A6\u30A3\u30F3\u30C9\u30A6\u7D50\u679C\u3092\u5217\u3068\u3057\u3066\u51FA\u3057\u3001\u305D\u308C\u3092\u4F7F\u3046\u5F0F\u306F\u6B21\u306E\u6BB5\uFF08CTE \u307E\u305F\u306F\u4E00\u6642\u30C6\u30FC\u30D6\u30EB\uFF09\u306B\u66F8\u3044\u3066\u304F\u3060\u3055\u3044"
|
|
1061
|
+
].join("\n");
|
|
1056
1062
|
var Parser = class {
|
|
1057
1063
|
constructor(tokens, capabilities = {}) {
|
|
1058
1064
|
this.tokens = tokens;
|
|
@@ -1972,7 +1978,7 @@ var Parser = class {
|
|
|
1972
1978
|
}
|
|
1973
1979
|
if (this.tryAggregateFunc() === null && this.hasNestedAggregateWindowInSelectColumn()) {
|
|
1974
1980
|
throw new ParseError(
|
|
1975
|
-
|
|
1981
|
+
WINDOW_RESULT_IN_EXPRESSION_MESSAGE,
|
|
1976
1982
|
this.peek()
|
|
1977
1983
|
);
|
|
1978
1984
|
}
|
|
@@ -2169,7 +2175,7 @@ var Parser = class {
|
|
|
2169
2175
|
this.expect(")" /* RPAREN */);
|
|
2170
2176
|
if (this.isArithOp(this.peek().kind)) {
|
|
2171
2177
|
throw new ParseError(
|
|
2172
|
-
|
|
2178
|
+
WINDOW_RESULT_IN_EXPRESSION_MESSAGE,
|
|
2173
2179
|
this.peek()
|
|
2174
2180
|
);
|
|
2175
2181
|
}
|
|
@@ -19343,6 +19349,13 @@ async function executeFullScanSelect(stmt, client, options, cacheContext, cteCac
|
|
|
19343
19349
|
);
|
|
19344
19350
|
return { type: "SELECT", rows, columns, rowCount: rows.length, warnings: [...warnings] };
|
|
19345
19351
|
}
|
|
19352
|
+
function assertUnionColumnCount(leftColumns, rightColumns) {
|
|
19353
|
+
if (leftColumns.length === rightColumns.length) return;
|
|
19354
|
+
throw new Error(
|
|
19355
|
+
`ArgumentError: UNION \u306E\u5DE6\u53F3\u3067\u5217\u6570\u304C\u4E00\u81F4\u3057\u307E\u305B\u3093\uFF08\u5DE6 ${leftColumns.length} \u5217 / \u53F3 ${rightColumns.length} \u5217\uFF09\u3002
|
|
19356
|
+
UNION \u306F\u5217\u3092\u4F4D\u7F6E\u3067\u5BFE\u5FDC\u3055\u305B\u308B\u305F\u3081\u3001\u4E21\u8FBA\u306E\u5217\u6570\u3092\u63C3\u3048\u3066\u304F\u3060\u3055\u3044`
|
|
19357
|
+
);
|
|
19358
|
+
}
|
|
19346
19359
|
async function executeUnion(stmt, client, options, cacheContext, captureColumnMeta = false, forLibraryCapture = false) {
|
|
19347
19360
|
const completePolicy = buildCompleteInputPolicy(stmt, options, null);
|
|
19348
19361
|
return withCompleteInputPolicy(completePolicy, async () => {
|
|
@@ -19378,6 +19391,7 @@ async function executeUnion(stmt, client, options, cacheContext, captureColumnMe
|
|
|
19378
19391
|
]);
|
|
19379
19392
|
const leftCols = leftResult.columns;
|
|
19380
19393
|
const rightCols = rightResult.columns;
|
|
19394
|
+
assertUnionColumnCount(leftCols, rightCols);
|
|
19381
19395
|
const remappedRight = rightResult.rows.map((row) => {
|
|
19382
19396
|
const mapped = {};
|
|
19383
19397
|
leftCols.forEach((col, i) => {
|
|
@@ -19465,6 +19479,7 @@ async function executeQueryWithCte(query, client, options, cteCache, cacheContex
|
|
|
19465
19479
|
]);
|
|
19466
19480
|
const leftCols = leftResult.columns;
|
|
19467
19481
|
const rightCols = rightResult.columns;
|
|
19482
|
+
assertUnionColumnCount(leftCols, rightCols);
|
|
19468
19483
|
const remapped = rightResult.rows.map((row) => {
|
|
19469
19484
|
const mapped = {};
|
|
19470
19485
|
leftCols.forEach((col, i) => {
|
|
@@ -22984,9 +22999,23 @@ async function executeUpsertSelect(stmt, client, options, cacheContext, cteCache
|
|
|
22984
22999
|
updatedCount: toUpdate.length
|
|
22985
23000
|
};
|
|
22986
23001
|
}
|
|
23002
|
+
var SHOW_APPS_COLUMNS = Object.freeze([
|
|
23003
|
+
"\u30A2\u30D7\u30EAID",
|
|
23004
|
+
"\u30A2\u30D7\u30EA\u540D",
|
|
23005
|
+
"\u8AAC\u660E"
|
|
23006
|
+
]);
|
|
23007
|
+
var DESCRIBE_COLUMNS = Object.freeze([
|
|
23008
|
+
"\u30D5\u30A3\u30FC\u30EB\u30C9\u30B3\u30FC\u30C9",
|
|
23009
|
+
"\u30E9\u30D9\u30EB",
|
|
23010
|
+
"\u30BF\u30A4\u30D7",
|
|
23011
|
+
"\u30EB\u30C3\u30AF\u30A2\u30C3\u30D7",
|
|
23012
|
+
"\u30B3\u30D4\u30FC\u5143",
|
|
23013
|
+
"\u91CD\u8907\u7981\u6B62",
|
|
23014
|
+
"\u8A08\u7B97\u5F0F"
|
|
23015
|
+
]);
|
|
22987
23016
|
async function executeShowApps(client) {
|
|
22988
23017
|
const apps = await client.getApps();
|
|
22989
|
-
const columns = [
|
|
23018
|
+
const columns = [...SHOW_APPS_COLUMNS];
|
|
22990
23019
|
const rows = apps.map((a) => ({
|
|
22991
23020
|
"\u30A2\u30D7\u30EAID": String(a.appId),
|
|
22992
23021
|
"\u30A2\u30D7\u30EA\u540D": a.name,
|
|
@@ -22996,11 +23025,15 @@ async function executeShowApps(client) {
|
|
|
22996
23025
|
}
|
|
22997
23026
|
async function executeDescribe(stmt, client, cacheContext) {
|
|
22998
23027
|
const fields = await getFieldsCached(stmt.appId, client, cacheContext);
|
|
22999
|
-
const columns = [
|
|
23028
|
+
const columns = [...DESCRIBE_COLUMNS];
|
|
23000
23029
|
const rows = fields.map((f) => ({
|
|
23001
23030
|
"\u30D5\u30A3\u30FC\u30EB\u30C9\u30B3\u30FC\u30C9": f.code,
|
|
23002
23031
|
"\u30E9\u30D9\u30EB": f.label,
|
|
23003
|
-
"\u30BF\u30A4\u30D7": f.fieldType
|
|
23032
|
+
"\u30BF\u30A4\u30D7": f.fieldType,
|
|
23033
|
+
"\u30EB\u30C3\u30AF\u30A2\u30C3\u30D7": f.hasLookup === true ? "YES" : "",
|
|
23034
|
+
"\u30B3\u30D4\u30FC\u5143": f.isLookupCopyTarget === true ? "YES" : "",
|
|
23035
|
+
"\u91CD\u8907\u7981\u6B62": f.isUnique === true ? "YES" : "",
|
|
23036
|
+
"\u8A08\u7B97\u5F0F": f.isCalculated === true ? "YES" : ""
|
|
23004
23037
|
}));
|
|
23005
23038
|
return { type: "SELECT", rows, columns, rowCount: rows.length };
|
|
23006
23039
|
}
|
|
@@ -25634,6 +25667,10 @@ function flattenFields(properties, lookupCopyFields, inSubtable = false, subtabl
|
|
|
25634
25667
|
minLength: normalizeConstraintValue(field.minLength),
|
|
25635
25668
|
maxLength: normalizeConstraintValue(field.maxLength),
|
|
25636
25669
|
defaultValue: field.defaultValue,
|
|
25670
|
+
hasLookup: Object.prototype.hasOwnProperty.call(field, "lookup"),
|
|
25671
|
+
isLookupCopyTarget: lookupCopyFields.has(field.code),
|
|
25672
|
+
isUnique: field.unique === true,
|
|
25673
|
+
isCalculated: field.type === "CALC" || typeof field.expression === "string" && field.expression.length > 0,
|
|
25637
25674
|
inSubtable,
|
|
25638
25675
|
...subtableCode ? { subtableCode } : {},
|
|
25639
25676
|
writable: !lookupCopyFields.has(field.code) && !NON_WRITABLE_FIELD_TYPES3.has(field.type)
|