@rex0220/kintone-sql-tools 3.55.0 → 3.56.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 +35 -3
- package/dist-engine/index.cjs +6 -6
- package/dist-engine/index.mjs +6 -6
- package/dist-engine/ksql-engine.umd.js +6 -6
- package/dist-engine/meta/bundle-baseline.json +7 -7
- package/dist-engine/meta/cjs.json +3 -3
- package/dist-engine/meta/esm.json +3 -3
- package/dist-engine/meta/umd.json +3 -3
- package/dist-mcp/ksql-mcp.js +37 -5
- package/dist-mcpb/ksql-mcp.mcpb +0 -0
- package/package.json +1 -1
package/dist-cli/ksql.js
CHANGED
|
@@ -17931,7 +17931,7 @@ async function executeSelect(stmt, client, options, cacheContext, cteCache, capt
|
|
|
17931
17931
|
maxRecords: options.maxRecords ?? 1e4,
|
|
17932
17932
|
hasKlike: whereHasKlike(stmt.where)
|
|
17933
17933
|
}) : null;
|
|
17934
|
-
await validateSelectFieldCodes(
|
|
17934
|
+
const subtableFieldWarnings = await validateSelectFieldCodes(
|
|
17935
17935
|
stmt,
|
|
17936
17936
|
orderPlan?.kind === "CANONICAL_LOCAL" ? "FULL_SCAN" : mode,
|
|
17937
17937
|
client,
|
|
@@ -17976,7 +17976,7 @@ async function executeSelect(stmt, client, options, cacheContext, cteCache, capt
|
|
|
17976
17976
|
await inferSelectColumnMeta(stmt, result.columns, client, cacheContext, cteCache, forLibraryCapture)
|
|
17977
17977
|
);
|
|
17978
17978
|
}
|
|
17979
|
-
return mergeSelectWarnings(result, defaultRangeWarnings);
|
|
17979
|
+
return mergeSelectWarnings(result, [...defaultRangeWarnings, ...subtableFieldWarnings]);
|
|
17980
17980
|
}
|
|
17981
17981
|
async function buildRuntimePlainGroupByPlan(stmt, client, cacheContext, materializedTables) {
|
|
17982
17982
|
if (stmt.groupBy.length === 0) return void 0;
|
|
@@ -18369,6 +18369,7 @@ async function executeSimpleSelect(stmt, client, options, cacheContext, orderPla
|
|
|
18369
18369
|
return { type: "SELECT", rows: projected, columns, rowCount: projected.length, warnings: [...warnings] };
|
|
18370
18370
|
}
|
|
18371
18371
|
async function validateSelectFieldCodes(stmt, mode, client, cacheContext) {
|
|
18372
|
+
const warnings = [];
|
|
18372
18373
|
const appToFields = /* @__PURE__ */ new Map();
|
|
18373
18374
|
const addFields = (appId, fields) => {
|
|
18374
18375
|
if (fields.length === 0) return;
|
|
@@ -18379,13 +18380,25 @@ async function validateSelectFieldCodes(stmt, mode, client, cacheContext) {
|
|
|
18379
18380
|
}
|
|
18380
18381
|
for (const f of fields) target.add(f);
|
|
18381
18382
|
};
|
|
18383
|
+
const parentTableFields = /* @__PURE__ */ new Map();
|
|
18384
|
+
const addParentFields = (appId, fields) => {
|
|
18385
|
+
let target = parentTableFields.get(appId);
|
|
18386
|
+
if (!target) {
|
|
18387
|
+
target = /* @__PURE__ */ new Set();
|
|
18388
|
+
parentTableFields.set(appId, target);
|
|
18389
|
+
}
|
|
18390
|
+
for (const f of fields) target.add(f);
|
|
18391
|
+
};
|
|
18382
18392
|
if (mode === "SIMPLE") {
|
|
18383
18393
|
const params = selectToKintoneParams(stmt);
|
|
18384
18394
|
addFields(params.app, params.fields);
|
|
18395
|
+
if (!stmt.from.subtableCode) addParentFields(params.app, params.fields);
|
|
18385
18396
|
} else {
|
|
18386
18397
|
const tables = [stmt.from, ...stmt.joins.map((j) => j.table)].filter((t) => t.cteName === null);
|
|
18387
18398
|
for (const table of tables) {
|
|
18388
|
-
|
|
18399
|
+
const fields = selectToFetchAllFields(stmt, table);
|
|
18400
|
+
addFields(table.appId, fields);
|
|
18401
|
+
if (!table.subtableCode) addParentFields(table.appId, fields);
|
|
18389
18402
|
}
|
|
18390
18403
|
}
|
|
18391
18404
|
for (const [appId, fields] of appToFields.entries()) {
|
|
@@ -18398,7 +18411,21 @@ async function validateSelectFieldCodes(stmt, mode, client, cacheContext) {
|
|
|
18398
18411
|
if (unknown.length > 0) {
|
|
18399
18412
|
throw new Error(`ArgumentError: unknown field code(s): ${unknown.join(", ")} (APP${appId})`);
|
|
18400
18413
|
}
|
|
18414
|
+
const referenced = parentTableFields.get(appId);
|
|
18415
|
+
if (referenced) {
|
|
18416
|
+
const subtableFields = defs.filter(
|
|
18417
|
+
(d) => d.inSubtable === true && referenced.has(d.code)
|
|
18418
|
+
);
|
|
18419
|
+
for (const field of subtableFields) {
|
|
18420
|
+
const owner = field.subtableCode ?? "";
|
|
18421
|
+
const source = owner ? `\u30B5\u30D6\u30C6\u30FC\u30D6\u30EB\u300C${owner}\u300D` : "\u30B5\u30D6\u30C6\u30FC\u30D6\u30EB";
|
|
18422
|
+
warnings.push(
|
|
18423
|
+
`${field.code} \u306F${source}\u306E\u4E2D\u306E\u9805\u76EE\u3067\u3059\u3002APP${appId} \u304B\u3089\u9078\u3076\u3068\u3001\u30A8\u30E9\u30FC\u306B\u306A\u3089\u305A\u5168\u884C\u304C\u7A7A\u306B\u306A\u308A\u307E\u3059\u3002` + (owner ? `APP${appId}$${owner} \u304B\u3089\u9078\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u89AA\u306E\u30EC\u30B3\u30FC\u30C9 ID \u306F _pid\u3001\u89AA\u9805\u76EE\u306F _p.<\u30D5\u30A3\u30FC\u30EB\u30C9\u30B3\u30FC\u30C9> \u306B\u306A\u308A\u307E\u3059\uFF09\u3002` : "")
|
|
18424
|
+
);
|
|
18425
|
+
}
|
|
18426
|
+
}
|
|
18401
18427
|
}
|
|
18428
|
+
return warnings;
|
|
18402
18429
|
}
|
|
18403
18430
|
function b86SourceLabel(table) {
|
|
18404
18431
|
return table.cteName ?? `APP${table.appId}`;
|
|
@@ -23130,9 +23157,12 @@ var SHOW_APPS_COLUMNS = Object.freeze([
|
|
|
23130
23157
|
"\u8AAC\u660E"
|
|
23131
23158
|
]);
|
|
23132
23159
|
var DESCRIBE_COLUMNS = Object.freeze([
|
|
23160
|
+
// B145: サブテーブル列は「その項目がどの表にあるか」を示す。無いと明細項目を
|
|
23161
|
+
// 親項目と取り違え、親から SELECT して全行空という結果になる(エラーも警告も出ない)。
|
|
23133
23162
|
"\u30D5\u30A3\u30FC\u30EB\u30C9\u30B3\u30FC\u30C9",
|
|
23134
23163
|
"\u30E9\u30D9\u30EB",
|
|
23135
23164
|
"\u30BF\u30A4\u30D7",
|
|
23165
|
+
"\u30B5\u30D6\u30C6\u30FC\u30D6\u30EB",
|
|
23136
23166
|
"\u30EB\u30C3\u30AF\u30A2\u30C3\u30D7",
|
|
23137
23167
|
"\u30B3\u30D4\u30FC\u5143",
|
|
23138
23168
|
"\u91CD\u8907\u7981\u6B62",
|
|
@@ -23155,6 +23185,8 @@ async function executeDescribe(stmt, client, cacheContext) {
|
|
|
23155
23185
|
"\u30D5\u30A3\u30FC\u30EB\u30C9\u30B3\u30FC\u30C9": f.code,
|
|
23156
23186
|
"\u30E9\u30D9\u30EB": f.label,
|
|
23157
23187
|
"\u30BF\u30A4\u30D7": f.fieldType,
|
|
23188
|
+
// 明細項目はサブテーブルのフィールドコード、親項目は空文字。
|
|
23189
|
+
"\u30B5\u30D6\u30C6\u30FC\u30D6\u30EB": f.inSubtable === true ? f.subtableCode ?? "" : "",
|
|
23158
23190
|
"\u30EB\u30C3\u30AF\u30A2\u30C3\u30D7": f.hasLookup === true ? "YES" : "",
|
|
23159
23191
|
"\u30B3\u30D4\u30FC\u5143": f.isLookupCopyTarget === true ? "YES" : "",
|
|
23160
23192
|
"\u91CD\u8907\u7981\u6B62": f.isUnique === true ? "YES" : "",
|