@rex0220/kintone-sql-tools 3.28.0 → 3.29.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/README.md +8 -2
- package/dist-cli/ksql.js +18 -11
- package/dist-engine/batch.d.ts +13 -0
- package/dist-engine/errors.d.ts +5 -0
- package/dist-engine/index.cjs +10 -10
- package/dist-engine/index.d.ts +3 -2
- 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 +114 -22
- package/dist-engine/meta/esm.json +114 -21
- package/dist-engine/meta/umd.json +116 -24
- package/dist-engine/publicTypes.d.ts +73 -0
- package/dist-engine/query.d.ts +8 -0
- package/dist-mcp/ksql-mcp.js +29 -19
- package/dist-mcpb/ksql-mcp.mcpb +0 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -7,8 +7,14 @@ kintone アプリを SQL 風の構文で操作するツールセットです。
|
|
|
7
7
|
- MCP サーバー(AI クライアントから kintone を SQL 操作。Claude Desktop 用 MCPB 同梱)
|
|
8
8
|
- read-only エンジン・ライブラリ(ESM / CJS / UMD)
|
|
9
9
|
|
|
10
|
-
他の kintone プラグインやカスタマイズへ read-only kSQL エンジンを組み込む場合は、
|
|
11
|
-
[エンジン・ライブラリ利用ガイド](docs/ksql_engine_library.md)を参照してください。
|
|
10
|
+
他の kintone プラグインやカスタマイズへ read-only kSQL エンジンを組み込む場合は、
|
|
11
|
+
[エンジン・ライブラリ利用ガイド](docs/ksql_engine_library.md)を参照してください。
|
|
12
|
+
|
|
13
|
+
engine ライブラリでは、`runQuery()` が単文の `SELECT` / `WITH` / `UNION` /
|
|
14
|
+
`SHOW APPS` / `DESCRIBE` / 既存レコード `VALIDATE` を、`runBatch()` がそれらに加えて
|
|
15
|
+
`CREATE` / `DROP TEMP TABLE`、`SET` / `DECLARE`、`ASSERT`、`EXPLAIN` を実行します。
|
|
16
|
+
書き込み DML、DML `VALIDATE ONLY`、`IMPORT`、`APPLY` は対象外です。
|
|
17
|
+
生成 AI が MCP で作った SQL を library で実行する場合は、この API 別の境界を確認してください。
|
|
12
18
|
|
|
13
19
|
## 機能概要
|
|
14
20
|
|
package/dist-cli/ksql.js
CHANGED
|
@@ -16158,21 +16158,28 @@ async function runWithDeadline(work, remainingMs, onTimeout) {
|
|
|
16158
16158
|
}
|
|
16159
16159
|
}
|
|
16160
16160
|
function toBatchStatementError(e) {
|
|
16161
|
+
let error;
|
|
16161
16162
|
if (e instanceof ApplyWritePartialFailureError) {
|
|
16162
|
-
|
|
16163
|
-
}
|
|
16164
|
-
if (e instanceof Error) {
|
|
16163
|
+
error = { code: e.name, message: e.message, partialSuccess: e.partialSuccess };
|
|
16164
|
+
} else if (e instanceof Error) {
|
|
16165
16165
|
const name = e.name !== "Error" ? e.name : null;
|
|
16166
|
-
|
|
16167
|
-
}
|
|
16168
|
-
if (e !== null && typeof e === "object") {
|
|
16166
|
+
error = { code: name ?? codeFromMessagePrefix(e.message), message: e.message };
|
|
16167
|
+
} else if (e !== null && typeof e === "object") {
|
|
16169
16168
|
const obj = e;
|
|
16170
|
-
const
|
|
16171
|
-
const code = typeof obj.code === "string" && obj.code.length > 0 ? obj.code : codeFromMessagePrefix(
|
|
16172
|
-
|
|
16169
|
+
const message = typeof obj.message === "string" && obj.message.length > 0 ? obj.message : safeJsonStringify(e);
|
|
16170
|
+
const code = typeof obj.code === "string" && obj.code.length > 0 ? obj.code : codeFromMessagePrefix(message);
|
|
16171
|
+
error = { code, message };
|
|
16172
|
+
} else {
|
|
16173
|
+
const message = String(e);
|
|
16174
|
+
error = { code: codeFromMessagePrefix(message), message };
|
|
16173
16175
|
}
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
+
Object.defineProperty(error, "cause", {
|
|
16177
|
+
value: e,
|
|
16178
|
+
enumerable: false,
|
|
16179
|
+
configurable: false,
|
|
16180
|
+
writable: false
|
|
16181
|
+
});
|
|
16182
|
+
return error;
|
|
16176
16183
|
}
|
|
16177
16184
|
function codeFromMessagePrefix(message) {
|
|
16178
16185
|
return message.match(/^([A-Za-z]+Error):/)?.[1] ?? "Error";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BatchResult, RunBatchOptions } from "./publicTypes";
|
|
2
|
+
/**
|
|
3
|
+
* Executes a read-only multi-statement batch.
|
|
4
|
+
*
|
|
5
|
+
* In addition to the row-returning statements accepted by runQuery, this API
|
|
6
|
+
* accepts CREATE/DROP TEMP TABLE, SET, DECLARE, ASSERT, and EXPLAIN. IMPORT,
|
|
7
|
+
* APPLY, DML VALIDATE ONLY, and writing DML remain outside the library boundary.
|
|
8
|
+
*
|
|
9
|
+
* If any statement fails, this function throws KsqlEngineError without
|
|
10
|
+
* returning partial results. statementIndex and statementType identify the
|
|
11
|
+
* failed statement.
|
|
12
|
+
*/
|
|
13
|
+
export declare function runBatch(sql: string, options: RunBatchOptions): Promise<BatchResult>;
|
package/dist-engine/errors.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
export declare class KsqlEngineError extends Error {
|
|
2
2
|
readonly code: "PARSE_ERROR" | "READ_ONLY_VIOLATION" | "SEARCH_ABORTED" | "FETCH_LIMIT_EXCEEDED" | "CLIENT_ERROR" | "EXECUTION_ERROR";
|
|
3
3
|
readonly cause?: unknown;
|
|
4
|
+
/** Zero-based index of the failed statement when raised by runBatch. */
|
|
5
|
+
readonly statementIndex?: number;
|
|
6
|
+
/** Parser statement type of the failed statement when raised by runBatch. */
|
|
7
|
+
readonly statementType?: string;
|
|
4
8
|
constructor(code: KsqlEngineError["code"], message: string, cause?: unknown);
|
|
5
9
|
}
|
|
10
|
+
export declare function withStatementDiagnostic(error: KsqlEngineError, statementIndex: number, statementType: string): KsqlEngineError;
|
|
6
11
|
export declare function readOnlyViolation(message: string): KsqlEngineError;
|
|
7
12
|
export declare function parseError(message: string, cause?: unknown): KsqlEngineError;
|
|
8
13
|
export declare function searchAborted(): KsqlEngineError;
|