@rex0220/kintone-sql-tools 1.13.1 → 1.13.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 +19 -8
- package/dist-mcp/ksql-mcp.js +16 -8
- package/dist-mcpb/ksql-mcp.mcpb +0 -0
- package/package.json +1 -1
package/dist-cli/ksql.js
CHANGED
|
@@ -6540,7 +6540,7 @@ function buildInsertPlan(stmt, label) {
|
|
|
6540
6540
|
const lines = [];
|
|
6541
6541
|
if (label) lines.push(label);
|
|
6542
6542
|
lines.push(` [INSERT]`);
|
|
6543
|
-
lines.push(`
|
|
6543
|
+
lines.push(` target: APP${stmt.appId} (${stmt.appId})`);
|
|
6544
6544
|
lines.push(` records: ${totalRows} \u4EF6\uFF08\u30D0\u30C3\u30C1 ${batchCount} \u56DE \xD7 \u6700\u5927 100 \u4EF6\uFF09`);
|
|
6545
6545
|
lines.push(` api: POST /k/v1/records.json \xD7 ${batchCount}`);
|
|
6546
6546
|
lines.push(` fields: ${stmt.fields.join(", ")}`);
|
|
@@ -6550,7 +6550,7 @@ function buildInsertSelectPlan(stmt, label) {
|
|
|
6550
6550
|
const lines = [];
|
|
6551
6551
|
if (label) lines.push(label);
|
|
6552
6552
|
lines.push(` [INSERT SELECT]`);
|
|
6553
|
-
lines.push(`
|
|
6553
|
+
lines.push(` target: APP${stmt.appId} (${stmt.appId})`);
|
|
6554
6554
|
lines.push(` fields: ${stmt.fields.join(", ")}`);
|
|
6555
6555
|
lines.push(` api: POST /k/v1/records.json\uFF08\u4EF6\u6570\u306F SELECT \u7D50\u679C\u306B\u4F9D\u5B58\u3001100 \u4EF6\u3054\u3068\u306B\u30D0\u30C3\u30C1\uFF09`);
|
|
6556
6556
|
lines.push("");
|
|
@@ -6563,7 +6563,7 @@ function buildUpdatePlan(stmt, label) {
|
|
|
6563
6563
|
const lines = [];
|
|
6564
6564
|
if (label) lines.push(label);
|
|
6565
6565
|
lines.push(` [UPDATE]`);
|
|
6566
|
-
lines.push(`
|
|
6566
|
+
lines.push(` target: APP${stmt.appId} (${stmt.appId})`);
|
|
6567
6567
|
lines.push(` kintone query: ${safeWhereToKintone(stmt.where)}`);
|
|
6568
6568
|
lines.push(` api: GET /k/v1/records.json \u2192 PUT /k/v1/records.json`);
|
|
6569
6569
|
const setTypes = [];
|
|
@@ -6593,7 +6593,7 @@ function buildDeletePlan(stmt, label) {
|
|
|
6593
6593
|
const lines = [];
|
|
6594
6594
|
if (label) lines.push(label);
|
|
6595
6595
|
lines.push(` [DELETE]`);
|
|
6596
|
-
lines.push(`
|
|
6596
|
+
lines.push(` target: APP${stmt.appId} (${stmt.appId})`);
|
|
6597
6597
|
lines.push(` kintone query: ${safeWhereToKintone(stmt.where)}`);
|
|
6598
6598
|
lines.push(` api: GET /k/v1/records.json \u2192 DELETE /k/v1/records.json`);
|
|
6599
6599
|
return lines;
|
|
@@ -6604,7 +6604,7 @@ function buildUpsertPlan(stmt, label) {
|
|
|
6604
6604
|
return [
|
|
6605
6605
|
...label ? [label] : [],
|
|
6606
6606
|
` [UPSERT]`,
|
|
6607
|
-
`
|
|
6607
|
+
` target: APP${stmt.appId} (${stmt.appId})`,
|
|
6608
6608
|
` records: ${totalRows} \u4EF6\uFF08\u30D0\u30C3\u30C1 ${batchCount} \u56DE \xD7 \u6700\u5927 100 \u4EF6\uFF09`,
|
|
6609
6609
|
` key fields: ${stmt.keyFields.join(", ")}`,
|
|
6610
6610
|
` fields: ${stmt.fields.join(", ")}`,
|
|
@@ -6615,7 +6615,7 @@ function buildUpsertSelectPlan(stmt, label) {
|
|
|
6615
6615
|
const lines = [
|
|
6616
6616
|
...label ? [label] : [],
|
|
6617
6617
|
` [UPSERT SELECT]`,
|
|
6618
|
-
`
|
|
6618
|
+
` target: APP${stmt.appId} (${stmt.appId})`,
|
|
6619
6619
|
` key fields: ${stmt.keyFields.join(", ")}`,
|
|
6620
6620
|
` fields: ${stmt.fields.join(", ")}`,
|
|
6621
6621
|
` api: GET /k/v1/records.json\uFF08\u91CD\u8907\u5224\u5B9A\uFF09\u2192 POST \u307E\u305F\u306F PUT /k/v1/records.json\uFF08100 \u4EF6\u3054\u3068\u306B\u30D0\u30C3\u30C1\uFF09`,
|
|
@@ -6631,7 +6631,7 @@ function buildReorderPlan(stmt, label) {
|
|
|
6631
6631
|
const lines = [
|
|
6632
6632
|
...label ? [label] : [],
|
|
6633
6633
|
` [REORDER]`,
|
|
6634
|
-
`
|
|
6634
|
+
` target: APP${stmt.appId} (${stmt.appId})`,
|
|
6635
6635
|
` table: ${target}`,
|
|
6636
6636
|
` scope: ${scope}`,
|
|
6637
6637
|
` by: ${byStr}`,
|
|
@@ -7710,6 +7710,14 @@ function tryParseStatements(sql) {
|
|
|
7710
7710
|
// src/node/sqlDiagnostics.ts
|
|
7711
7711
|
function restoreSqlDiagnosticValue(value, bindings) {
|
|
7712
7712
|
if (typeof value === "string") {
|
|
7713
|
+
const dmlTarget = value.match(/^(\s*target:\s*)APP(\d+) \((\d+)\)\s*$/);
|
|
7714
|
+
if (dmlTarget && dmlTarget[2] === dmlTarget[3]) {
|
|
7715
|
+
const binding = bindings.get(Number(dmlTarget[2]));
|
|
7716
|
+
if (binding) {
|
|
7717
|
+
const target = binding.source === "logical" ? `LAPP_${binding.logicalName} -> APP${binding.appId}@${binding.profile}` : `APP${binding.appId}@${binding.profile}`;
|
|
7718
|
+
return `${dmlTarget[1]}${target}`;
|
|
7719
|
+
}
|
|
7720
|
+
}
|
|
7713
7721
|
let restored = value;
|
|
7714
7722
|
for (const binding of bindings.values()) {
|
|
7715
7723
|
const internal = `APP${binding.mappedAppId}`;
|
|
@@ -9453,13 +9461,16 @@ query=${label}`);
|
|
|
9453
9461
|
});
|
|
9454
9462
|
return writeBatchOutput(batchResult, { format, noHeader, pretty, displayOptions, outputPath, quiet });
|
|
9455
9463
|
}
|
|
9456
|
-
|
|
9464
|
+
let result = args.dryRun ? await execute(`EXPLAIN ${sql}`, client, { maxRecords, onLimitReached: onLimit, cacheContext }) : await execute(sql, client, {
|
|
9457
9465
|
maxRecords,
|
|
9458
9466
|
fetchParallel,
|
|
9459
9467
|
onLimitReached: onLimit,
|
|
9460
9468
|
confirm: isDmlStatement ? confirm : void 0,
|
|
9461
9469
|
cacheContext
|
|
9462
9470
|
});
|
|
9471
|
+
if (args.dryRun && sqlDiagnosticContext) {
|
|
9472
|
+
result = restoreSqlDiagnosticValue(result, sqlDiagnosticContext.appBindingByMappedApp);
|
|
9473
|
+
}
|
|
9463
9474
|
if (result.type === "ASSERT") {
|
|
9464
9475
|
const output2 = buildAssertOutput(result, format, pretty);
|
|
9465
9476
|
if (outputPath) (0, import_fs2.writeFileSync)(outputPath, `${output2}
|
package/dist-mcp/ksql-mcp.js
CHANGED
|
@@ -37441,7 +37441,7 @@ function buildInsertPlan(stmt, label) {
|
|
|
37441
37441
|
const lines = [];
|
|
37442
37442
|
if (label) lines.push(label);
|
|
37443
37443
|
lines.push(` [INSERT]`);
|
|
37444
|
-
lines.push(`
|
|
37444
|
+
lines.push(` target: APP${stmt.appId} (${stmt.appId})`);
|
|
37445
37445
|
lines.push(` records: ${totalRows} \u4EF6\uFF08\u30D0\u30C3\u30C1 ${batchCount} \u56DE \xD7 \u6700\u5927 100 \u4EF6\uFF09`);
|
|
37446
37446
|
lines.push(` api: POST /k/v1/records.json \xD7 ${batchCount}`);
|
|
37447
37447
|
lines.push(` fields: ${stmt.fields.join(", ")}`);
|
|
@@ -37451,7 +37451,7 @@ function buildInsertSelectPlan(stmt, label) {
|
|
|
37451
37451
|
const lines = [];
|
|
37452
37452
|
if (label) lines.push(label);
|
|
37453
37453
|
lines.push(` [INSERT SELECT]`);
|
|
37454
|
-
lines.push(`
|
|
37454
|
+
lines.push(` target: APP${stmt.appId} (${stmt.appId})`);
|
|
37455
37455
|
lines.push(` fields: ${stmt.fields.join(", ")}`);
|
|
37456
37456
|
lines.push(` api: POST /k/v1/records.json\uFF08\u4EF6\u6570\u306F SELECT \u7D50\u679C\u306B\u4F9D\u5B58\u3001100 \u4EF6\u3054\u3068\u306B\u30D0\u30C3\u30C1\uFF09`);
|
|
37457
37457
|
lines.push("");
|
|
@@ -37464,7 +37464,7 @@ function buildUpdatePlan(stmt, label) {
|
|
|
37464
37464
|
const lines = [];
|
|
37465
37465
|
if (label) lines.push(label);
|
|
37466
37466
|
lines.push(` [UPDATE]`);
|
|
37467
|
-
lines.push(`
|
|
37467
|
+
lines.push(` target: APP${stmt.appId} (${stmt.appId})`);
|
|
37468
37468
|
lines.push(` kintone query: ${safeWhereToKintone(stmt.where)}`);
|
|
37469
37469
|
lines.push(` api: GET /k/v1/records.json \u2192 PUT /k/v1/records.json`);
|
|
37470
37470
|
const setTypes = [];
|
|
@@ -37494,7 +37494,7 @@ function buildDeletePlan(stmt, label) {
|
|
|
37494
37494
|
const lines = [];
|
|
37495
37495
|
if (label) lines.push(label);
|
|
37496
37496
|
lines.push(` [DELETE]`);
|
|
37497
|
-
lines.push(`
|
|
37497
|
+
lines.push(` target: APP${stmt.appId} (${stmt.appId})`);
|
|
37498
37498
|
lines.push(` kintone query: ${safeWhereToKintone(stmt.where)}`);
|
|
37499
37499
|
lines.push(` api: GET /k/v1/records.json \u2192 DELETE /k/v1/records.json`);
|
|
37500
37500
|
return lines;
|
|
@@ -37505,7 +37505,7 @@ function buildUpsertPlan(stmt, label) {
|
|
|
37505
37505
|
return [
|
|
37506
37506
|
...label ? [label] : [],
|
|
37507
37507
|
` [UPSERT]`,
|
|
37508
|
-
`
|
|
37508
|
+
` target: APP${stmt.appId} (${stmt.appId})`,
|
|
37509
37509
|
` records: ${totalRows} \u4EF6\uFF08\u30D0\u30C3\u30C1 ${batchCount} \u56DE \xD7 \u6700\u5927 100 \u4EF6\uFF09`,
|
|
37510
37510
|
` key fields: ${stmt.keyFields.join(", ")}`,
|
|
37511
37511
|
` fields: ${stmt.fields.join(", ")}`,
|
|
@@ -37516,7 +37516,7 @@ function buildUpsertSelectPlan(stmt, label) {
|
|
|
37516
37516
|
const lines = [
|
|
37517
37517
|
...label ? [label] : [],
|
|
37518
37518
|
` [UPSERT SELECT]`,
|
|
37519
|
-
`
|
|
37519
|
+
` target: APP${stmt.appId} (${stmt.appId})`,
|
|
37520
37520
|
` key fields: ${stmt.keyFields.join(", ")}`,
|
|
37521
37521
|
` fields: ${stmt.fields.join(", ")}`,
|
|
37522
37522
|
` api: GET /k/v1/records.json\uFF08\u91CD\u8907\u5224\u5B9A\uFF09\u2192 POST \u307E\u305F\u306F PUT /k/v1/records.json\uFF08100 \u4EF6\u3054\u3068\u306B\u30D0\u30C3\u30C1\uFF09`,
|
|
@@ -37532,7 +37532,7 @@ function buildReorderPlan(stmt, label) {
|
|
|
37532
37532
|
const lines = [
|
|
37533
37533
|
...label ? [label] : [],
|
|
37534
37534
|
` [REORDER]`,
|
|
37535
|
-
`
|
|
37535
|
+
` target: APP${stmt.appId} (${stmt.appId})`,
|
|
37536
37536
|
` table: ${target}`,
|
|
37537
37537
|
` scope: ${scope}`,
|
|
37538
37538
|
` by: ${byStr}`,
|
|
@@ -37669,6 +37669,14 @@ function buildBatchEnvelope(batch, options = {}) {
|
|
|
37669
37669
|
// src/node/sqlDiagnostics.ts
|
|
37670
37670
|
function restoreSqlDiagnosticValue(value, bindings) {
|
|
37671
37671
|
if (typeof value === "string") {
|
|
37672
|
+
const dmlTarget = value.match(/^(\s*target:\s*)APP(\d+) \((\d+)\)\s*$/);
|
|
37673
|
+
if (dmlTarget && dmlTarget[2] === dmlTarget[3]) {
|
|
37674
|
+
const binding = bindings.get(Number(dmlTarget[2]));
|
|
37675
|
+
if (binding) {
|
|
37676
|
+
const target = binding.source === "logical" ? `LAPP_${binding.logicalName} -> APP${binding.appId}@${binding.profile}` : `APP${binding.appId}@${binding.profile}`;
|
|
37677
|
+
return `${dmlTarget[1]}${target}`;
|
|
37678
|
+
}
|
|
37679
|
+
}
|
|
37672
37680
|
let restored = value;
|
|
37673
37681
|
for (const binding of bindings.values()) {
|
|
37674
37682
|
const internal = `APP${binding.mappedAppId}`;
|
|
@@ -39653,7 +39661,7 @@ Options:
|
|
|
39653
39661
|
-h, --help Show help
|
|
39654
39662
|
`);
|
|
39655
39663
|
}
|
|
39656
|
-
var SERVER_VERSION = true ? "1.13.
|
|
39664
|
+
var SERVER_VERSION = true ? "1.13.2" : "0.0.0-dev";
|
|
39657
39665
|
function createServer(args) {
|
|
39658
39666
|
const server = new McpServer({
|
|
39659
39667
|
name: "ksql-mcp",
|
package/dist-mcpb/ksql-mcp.mcpb
CHANGED
|
Binary file
|