@rex0220/kintone-sql-tools 3.18.0 → 3.19.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.
@@ -0,0 +1,98 @@
1
+ export interface ReadonlyKintoneFieldValue {
2
+ readonly value: unknown;
3
+ }
4
+ export type ReadonlyKintoneRecord = Readonly<Record<string, ReadonlyKintoneFieldValue>>;
5
+ export interface ReadonlyGetRecordsParams {
6
+ app: number;
7
+ query: string;
8
+ fields: string[];
9
+ }
10
+ export interface ReadonlyGetRecordsResult {
11
+ records: ReadonlyKintoneRecord[];
12
+ searchAborted?: boolean;
13
+ }
14
+ export interface ReadonlyCursorOpenParams {
15
+ app: number;
16
+ fields?: string[];
17
+ query: string;
18
+ size: 500;
19
+ }
20
+ export interface ReadonlyCursorPage {
21
+ records: ReadonlyKintoneRecord[];
22
+ next: boolean;
23
+ }
24
+ export interface ReadonlyCursorHandle {
25
+ readonly totalCount: number;
26
+ nextPage(): Promise<ReadonlyCursorPage>;
27
+ close(): Promise<void>;
28
+ }
29
+ export interface ReadonlyAppInfo {
30
+ appId: number;
31
+ name: string;
32
+ description: string;
33
+ }
34
+ export interface ReadonlyFieldInfo {
35
+ code: string;
36
+ label: string;
37
+ fieldType: string;
38
+ optionOrder?: Record<string, number>;
39
+ sortKind?: "number" | "string";
40
+ inSubtable?: boolean;
41
+ subtableCode?: string;
42
+ }
43
+ export type ReadonlyNumberRoundingMode = "HALF_EVEN" | "UP" | "DOWN";
44
+ export interface ReadonlyNumberPrecision {
45
+ digits: number;
46
+ decimalPlaces: number;
47
+ roundingMode: ReadonlyNumberRoundingMode;
48
+ }
49
+ export interface ReadonlyProcessStatusState {
50
+ readonly name: string;
51
+ readonly index: number;
52
+ }
53
+ export interface ReadonlyProcessStatuses {
54
+ enable: boolean;
55
+ states: ReadonlyProcessStatusState[] | null;
56
+ }
57
+ export interface ReadonlyKintoneClient {
58
+ getRecords(params: ReadonlyGetRecordsParams): Promise<ReadonlyGetRecordsResult>;
59
+ openCursor(params: ReadonlyCursorOpenParams): Promise<ReadonlyCursorHandle>;
60
+ getApps(): Promise<readonly ReadonlyAppInfo[]>;
61
+ getFields(appId: number): Promise<readonly ReadonlyFieldInfo[]>;
62
+ getNumberPrecision(appId: number): Promise<ReadonlyNumberPrecision>;
63
+ getProcessStatuses(appId: number): Promise<ReadonlyProcessStatuses>;
64
+ }
65
+ export interface RunQueryOptions {
66
+ client: ReadonlyKintoneClient;
67
+ maxRecords?: number;
68
+ onLimitReached?: "error" | "truncate";
69
+ fetchParallel?: number;
70
+ cursorMaxActive?: number;
71
+ }
72
+ export interface QueryColumn {
73
+ name: string;
74
+ valueType: "string";
75
+ }
76
+ export interface QueryMetrics {
77
+ recordGetCalls: number;
78
+ fetchedRows: number;
79
+ elapsedMs: number;
80
+ cursorRecordsScanned: number;
81
+ }
82
+ export interface QueryResult {
83
+ type: "query";
84
+ rows: readonly Readonly<Record<string, string>>[];
85
+ columns: readonly QueryColumn[];
86
+ rowCount: number;
87
+ warnings: readonly string[];
88
+ metrics: QueryMetrics;
89
+ }
90
+ export interface ExplainResult {
91
+ type: "explain";
92
+ lines: readonly string[];
93
+ text: string;
94
+ metrics: QueryMetrics;
95
+ }
96
+ export interface CreateReadonlyKintoneClientOptions {
97
+ cursorMaxActive?: number;
98
+ }
@@ -0,0 +1,3 @@
1
+ import type { ExplainResult, QueryResult, RunQueryOptions } from "./publicTypes";
2
+ export declare function runQuery(sql: string, options: RunQueryOptions): Promise<QueryResult>;
3
+ export declare function explainQuery(sql: string, options: Omit<RunQueryOptions, "onLimitReached">): Promise<ExplainResult>;
@@ -55126,7 +55126,7 @@ Nested JSON/CSV subtable mutation is fail-closed on MCP: use VALIDATE ONLY/EXPLA
55126
55126
  JSON child IDs are rejected and replacement renumbers all rows.
55127
55127
  `);
55128
55128
  }
55129
- var SERVER_VERSION = true ? "3.18.0" : "0.0.0-dev";
55129
+ var SERVER_VERSION = true ? "3.19.0" : "0.0.0-dev";
55130
55130
  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; LOGINUSER resolves to an empty string in Node/MCP). 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.`;
55131
55131
  var KSQL_MCP_INSTRUCTIONS = `kSQL is a SQL-like dialect for kintone, not generic SQL. Supports cataloged families plus JOIN, aggregates, windows, subtable virtual tables, CHECK, KLIKE, KORDER BY, @variables, and LAPP_<NAME>.
55132
55132
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rex0220/kintone-sql-tools",
3
- "version": "3.18.0",
3
+ "version": "3.19.0",
4
4
  "description": "kintone SQL plugin, CLI, and MCP tools (ksql)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -18,15 +18,28 @@
18
18
  "ksql": "dist-cli/ksql.js",
19
19
  "ksql-mcp": "dist-mcp/ksql-mcp.js"
20
20
  },
21
+ "exports": {
22
+ "./engine": {
23
+ "types": "./dist-engine/index.d.ts",
24
+ "import": "./dist-engine/index.mjs",
25
+ "require": "./dist-engine/index.cjs"
26
+ },
27
+ "./package.json": "./package.json"
28
+ },
21
29
  "scripts": {
22
30
  "test": "node scripts/run-tests.mjs",
23
31
  "test:parallel": "jest --maxWorkers=2 --testPathIgnorePatterns=console\\.e2e\\.test\\.ts dml_guard\\.e2e\\.test\\.ts",
24
32
  "test:subprocess": "jest --runInBand src/cli/__tests__/console.e2e.test.ts src/cli/__tests__/dml_guard.e2e.test.ts",
25
- "build": "npm run build:plugin && npm run build:cli && npm run build:mcp && npm run build:mcpb",
33
+ "build": "npm run build:plugin && npm run build:cli && npm run build:mcp && npm run build:mcpb && npm run build:engine",
26
34
  "build:plugin": "node build.mjs",
27
35
  "build:cli": "node build-cli.mjs",
28
36
  "build:mcp": "node build-mcp.mjs",
29
37
  "build:mcpb": "node build-mcpb.mjs",
38
+ "build:engine": "node build-engine.mjs",
39
+ "engine:bundle-guard": "node scripts/engine-bundle-guard.mjs",
40
+ "engine:declaration-smoke": "node scripts/engine-declaration-smoke.mjs",
41
+ "engine:pack-smoke": "node scripts/engine-pack-smoke.mjs",
42
+ "engine:docs-smoke": "node scripts/engine-docs-examples-smoke.mjs",
30
43
  "mcp:smoke": "node scripts/mcp-smoke.mjs",
31
44
  "mcp:pack-smoke": "node scripts/mcp-pack-smoke.mjs",
32
45
  "mcp:kintone-smoke": "node scripts/mcp-kintone-smoke.mjs",
@@ -34,12 +47,13 @@
34
47
  "mcpb:verify": "npm run build:mcp && npm run build:mcpb && node scripts/mcpb-verify.mjs",
35
48
  "benchmark:b65": "node --expose-gc scripts/b65-grouping-benchmark.mjs",
36
49
  "mcp:inspector": "npx -y @modelcontextprotocol/inspector node dist-mcp/ksql-mcp.js",
37
- "prepack": "npm run build:cli && npm run build:mcp && npm run build:mcpb",
50
+ "prepack": "npm run build:cli && npm run build:mcp && npm run build:mcpb && npm run build:engine && npm run engine:bundle-guard && npm run engine:declaration-smoke",
38
51
  "start": "run-p develop upload",
39
52
  "develop": "node build.mjs --watch",
40
53
  "upload": "node scripts/upload-plugin.cjs"
41
54
  },
42
55
  "files": [
56
+ "dist-engine/",
43
57
  "dist-cli/",
44
58
  "dist-mcp/",
45
59
  "dist-mcpb/",